Package ptolemy.data.ontologies
Class MapTypeInfiniteConcept<C extends Concept>
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.InstantiableNamedObj
-
- ptolemy.kernel.Entity<T>
-
- ptolemy.kernel.ComponentEntity
-
- ptolemy.data.ontologies.Concept
-
- ptolemy.data.ontologies.InfiniteConcept
-
- ptolemy.data.ontologies.MapTypeInfiniteConcept<C>
-
- 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)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
-
Fields inherited from class ptolemy.data.ontologies.Concept
isAcceptable
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
MapTypeInfiniteConcept(Ontology ontology)
Create a new MapTypeInfiniteConcept contained in the given ontology.protected
MapTypeInfiniteConcept(Ontology ontology, C defaultConcept)
Create a new MapTypeInfiniteConcept contained in the given ontology, with the given default concept.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Set<java.lang.String>
_combinedKeys(MapTypeInfiniteConcept<C> otherConcept)
Return the string keys in either this or the given map concept.protected java.util.Set<java.lang.String>
_commonKeys(MapTypeInfiniteConcept<C> otherConcept)
Return the string keys common to this and the given map concept.protected java.util.Collection<C>
_values()
Get the set of all entries referred to by this map concept.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.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.int
hashCode()
Return the hash code of this map concept, which is uniquely determined by the ontology and the set of key-concept mappings.java.util.Set<java.lang.String>
keySet()
Get the set of all keys referred to by this map concept.void
putConcept(java.lang.String key, C concept)
Set the specified key of this map to the given concept value.java.lang.String
toString()
Return the string representation of this map concept.-
Methods inherited from class ptolemy.data.ontologies.InfiniteConcept
compare, getRepresentative, greatestLowerBound, leastUpperBound
-
Methods inherited from class ptolemy.data.ontologies.Concept
getAssociatedObject, getColor, getOntology, getValue, getVariables, initialize, isAboveOrEqualTo, isSettable, isValueAcceptable, setValue
-
Methods inherited from class ptolemy.kernel.ComponentEntity
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, newPort, propagateExistence, setContainer, setName
-
Methods inherited from class ptolemy.kernel.Entity
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, connectionsChanged, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, validateSettables, workspace
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getDisplayName, getFullName, getName, getName
-
-
-
-
Constructor Detail
-
MapTypeInfiniteConcept
protected MapTypeInfiniteConcept(Ontology ontology, C defaultConcept) throws IllegalActionException, NameDuplicationException
Create a new MapTypeInfiniteConcept contained in the given ontology, with the given default concept.- Parameters:
ontology
- The containing ontology.defaultConcept
- The concept value mapped to by all keys not contained in this map.- Throws:
NameDuplicationException
- Not thrown.IllegalActionException
- If the base class throws it.
-
MapTypeInfiniteConcept
protected MapTypeInfiniteConcept(Ontology ontology) throws IllegalActionException, NameDuplicationException
Create a new MapTypeInfiniteConcept contained in the given ontology.- Parameters:
ontology
- The containing ontology.- Throws:
NameDuplicationException
- Not thrown.IllegalActionException
- If the base class throws it.
-
-
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 classInfiniteConcept
- 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 classInfiniteConcept
- 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}).
-
_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.
-
-