Interface Mapping

  • All Known Subinterfaces:
    ToDoubleMapping, ToIntMapping
    All Known Implementing Classes:
    MapMapping, ToDoubleMapMapping, ToIntMapMapping

    public interface Mapping
    A mapping from some domain of values into some range. Mappings are different from Maps (see List) in that the set of keys (domain values) is not necessarily stored with or even known to a Mapping. Enumeration of or iteration through the domain values is thus not in general possible.

    This is a base interface for specific mappings. For efficiency, the derived mappings should define their own methods to actually perform the associated mapping function. These methods can thus be specialized, for example, to return the desired return type (rather than an Object). Also, derived Mappings may choose, again for efficiency reasons, to forego any error-checking in the methods that implement their mapping functions (i.e, they may assume that the arguments are in the corresponding domains). In such cases, the inDomain(Object) method can be used when it is desired to make sure that that a candidate argument is in the domain.

    Since:
    Ptolemy II 4.0
    Version:
    $Id$
    Author:
    Shuvra S. Bhattacharyya, Shahrooz Shahparnia
    Pt.AcceptedRating:
    Red (ssb)
    Pt.ProposedRating:
    Red (ssb)
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean inDomain​(java.lang.Object object)
      Returns true if a given object is in the domain of the mapping.
      java.lang.Object toObject​(java.lang.Object object)
      Return the object associated with the given object in the mapping.
    • Method Detail

      • inDomain

        boolean inDomain​(java.lang.Object object)
        Returns true if a given object is in the domain of the mapping.
        Parameters:
        object - The given object.
        Returns:
        True if a given object is in the domain of the mapping
      • toObject

        java.lang.Object toObject​(java.lang.Object object)
        Return the object associated with the given object in the mapping.
        Parameters:
        object - The given object.
        Returns:
        Return the object associated with the given object in the mapping.