Package ptolemy.graph.mapping
Class MapMapping
- java.lang.Object
-
- ptolemy.graph.mapping.MapMapping
-
- All Implemented Interfaces:
Mapping
- Direct Known Subclasses:
ToDoubleMapMapping
,ToIntMapMapping
public abstract class MapMapping extends java.lang.Object implements Mapping
A Mapping that is based on a Map. The domain of the Mapping is the set of keys in the Map. MapMappings are immutable in the sense that the underlying Map cannot be changed (although the keys and values associated with the Map can be changed).- Since:
- Ptolemy II 4.0
- Version:
- $Id$
- Author:
- Shuvra S. Bhattacharyya
- Pt.AcceptedRating:
- Red (ssb)
- Pt.ProposedRating:
- Red (ssb)
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map
_map
The Map on which this Mapping is based.
-
Constructor Summary
Constructors Constructor Description MapMapping(java.util.Map map)
Construct a MapMapping from a given Map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object object)
Return true if the given object is of the same Class and based on the same Map as this one.int
hashCode()
Return the hash code of this MapMapping.boolean
inDomain(java.lang.Object object)
Return true if the given object is a key in the Map that is associated with this mapping.java.lang.String
toString()
Return a string representation of this MapMapping.
-
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object object)
Return true if the given object is of the same Class and based on the same Map as this one.- Overrides:
equals
in classjava.lang.Object
- Parameters:
object
- The given object.- Returns:
- True if the given object is of the same class and based on the same Map as this one.
-
hashCode
public int hashCode()
Return the hash code of this MapMapping. The hash code is simply that of the Map that this Mapping is based on.- Overrides:
hashCode
in classjava.lang.Object
-
inDomain
public boolean inDomain(java.lang.Object object)
Return true if the given object is a key in the Map that is associated with this mapping.
-
toString
public java.lang.String toString()
Return a string representation of this MapMapping. The string representation is the class name, followed by a delimiting string, followed by a string representation of the underlying Map.- Overrides:
toString
in classjava.lang.Object
-
-