001/* Copyright (C) 2013 TU Dortmund 002 * This file is part of AutomataLib, http://www.automatalib.net/. 003 * 004 * AutomataLib is free software; you can redistribute it and/or 005 * modify it under the terms of the GNU Lesser General Public 006 * License version 3.0 as published by the Free Software Foundation. 007 * 008 * AutomataLib is distributed in the hope that it will be useful, 009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 011 * Lesser General Public License for more details. 012 * 013 * You should have received a copy of the GNU Lesser General Public 014 * License along with AutomataLib; if not, see 015 * http://www.gnu.de/documents/lgpl.en.html. 016 */ 017package net.automatalib.commons.util.mappings; 018 019import java.util.Map; 020 021/** 022 * An interface for mapping objects of a certain domain type 023 * to objects of a certain range type. 024 * <p> 025 * A mapping is very much like a {@link Map}, but the perspective is a 026 * different one: Whereas a map is a (particularly finite) key/value collection, a 027 * mapping is more like a function: it does not support retrieval of all keys or values, 028 * because it does not requires them to be stored at all. Instead, they can be calculated 029 * on the fly upon an invocation of {@link #get(Object)}. 030 * 031 * @author Malte Isberner <malte.isberner@gmail.com> 032 * 033 * @param <D> domain type. 034 * @param <R> range type. 035 */ 036public interface Mapping<D,R> { 037 /** 038 * Get the range object <code>elem</code> maps to. 039 * 040 * @param elem object from the domain. 041 * @return the object from the range corresponding to 042 * <code>elem</code>. 043 */ 044 public R get(D elem); 045}