Class MapTypeInfiniteConcept<C extends Concept>

  • Type Parameters:
    C - The type of the concepts that form the range of this mapping.
    All Implemented Interfaces:
    java.lang.Cloneable, InequalityTerm, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
    Direct Known Subclasses:
    MonotonicityConcept, RecordConcept

    public abstract class MapTypeInfiniteConcept<C extends Concept>
    extends InfiniteConcept
    A concept that represents a type mapping tokens to concepts. Each concept of this type contains a mapping of token values to concepts. This is used in situations like the RecordConcept, which is a mapping of strings to arbitrary concepts, and the MontonicityConcept, which is a mapping of Strings to a fixed set of FiniteConcepts.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Ben Lickly
    Pt.AcceptedRating:
    Red (blickly)
    Pt.ProposedRating:
    Red (blickly)
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object object)
        Return true if the class of the argument is RecordToken, and the argument has the same set of labels as this token and the corresponding fields are equal, as determined by the equals method of the contained tokens.
        Overrides:
        equals in class InfiniteConcept
        Parameters:
        object - An instance of Object.
        Returns:
        True if the argument is equal to this token.
        See Also:
        hashCode()
      • getConcept

        public C getConcept​(java.lang.String key)
        Get the concept contained by at the given key in this map concept, or the default value if the key is not contained in this map concept.
        Parameters:
        key - The key whose concept value we are querying.
        Returns:
        The concept value held by this map concept at the key, or the default value if there is no such concept.
      • keySet

        public java.util.Set<java.lang.String> keySet()
        Get the set of all keys referred to by this map concept.
        Returns:
        A set of all the keys which map to a concept.
      • hashCode

        public int hashCode()
        Return the hash code of this map concept, which is uniquely determined by the ontology and the set of key-concept mappings.
        Specified by:
        hashCode in class InfiniteConcept
        Returns:
        The hash code of this concept.
        See Also:
        Object.hashCode()
      • putConcept

        public void putConcept​(java.lang.String key,
                               C concept)
        Set the specified key of this map to the given concept value.
        Parameters:
        key - The key whose concept value we are setting.
        concept - The concept value of the given key.
        See Also:
        getConcept(String)
      • toString

        public java.lang.String toString()
        Return the string representation of this map concept. Note that the syntax here is the same as that used for the string representation of record tokens (e.g. {x = Const, y = NonConst}).
        Specified by:
        toString in class Concept
        Returns:
        The string representation of this concept.
      • _commonKeys

        protected java.util.Set<java.lang.String> _commonKeys​(MapTypeInfiniteConcept<C> otherConcept)
        Return the string keys common to this and the given map concept.
        Parameters:
        otherConcept - The other map concept.
        Returns:
        The common keys, as a set of Strings.
      • _combinedKeys

        protected java.util.Set<java.lang.String> _combinedKeys​(MapTypeInfiniteConcept<C> otherConcept)
        Return the string keys in either this or the given map concept.
        Parameters:
        otherConcept - The other map concept.
        Returns:
        The combined keys, as a set of Strings.
      • _values

        protected java.util.Collection<C> _values()
        Get the set of all entries referred to by this map concept.
        Returns:
        A set of all the entries which map to a concept.