Package ptolemy.data.ontologies
Class FlatTokenInfiniteConcept
- 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.FlatTokenInfiniteConcept
-
- All Implemented Interfaces:
java.lang.Cloneable
,InequalityTerm
,Changeable
,Debuggable
,DebugListener
,Derivable
,Instantiable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
- Direct Known Subclasses:
FlatScalarTokenInfiniteConcept
,UnitConcept
public class FlatTokenInfiniteConcept extends InfiniteConcept
A concept that represents the concept values of entries in a record token. A conceptable model element such as a port or node in a Ptolemy expression could contain a token value that is a record data type. A record token is a token that is a collection of multiple token values of different types. For example, we might want to specify a record that indicates the (x,y) pixel position on a black-and-white screen, and also true or false for whether that pixel position is on or off. We can use a record of the form: {x = 34, y = 26, pixelOn = true}This RecordConcept allows any record to be assigned concept values for its individual elements from an arbitrary finite ontology. For example, if we wanted to assign a concept to the token above from the constAbstractInterpretation ontology, it would be: {x = Positive, y = Positive, pixelOn = BooleanTrue} This code is adapted from the
MonotonicityConcept
implementation.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Charles Shelton
- See Also:
FlatTokenRepresentativeConcept
- 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 Modifier and Type Field Description protected FlatTokenRepresentativeConcept
_representative
The finite concept that represents where the infinite token concepts belong in the ontology lattice.protected Token
_tokenValue
The token value for this FlatTokenInfiniteConcept.-
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
FlatTokenInfiniteConcept(Ontology ontology, FlatTokenRepresentativeConcept representative, Token value)
Create a new FlatTokenInfiniteConcept, belonging to the given ontology.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(Concept concept)
Compare this concept with the given concept.static FlatTokenInfiniteConcept
createFlatTokenInfiniteConcept(Ontology ontology, FlatTokenRepresentativeConcept representative, Token value)
Create a new flat token infinite concept, belonging to the given ontology, with an automatically generated name.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.ColorAttribute
getColor()
Return the color attribute associated with this FlatTokenInfiniteConcept.FlatTokenRepresentativeConcept
getRepresentative()
Get the concept that represents this set of infinite concepts in the ontology lattice.Token
getTokenValue()
Get the token value contained by this concept.Concept
greatestLowerBound(Concept concept)
Compute the greatest lower bound (GLB) of this and another concept.int
hashCode()
Return the hash code of this record concept, which is uniquely determined by the ontology and the set of record field-concept mappings.Concept
leastUpperBound(Concept concept)
Compute the least upper bound (LUB) of this and another concept.java.lang.String
toString()
Return the string representation of this flat token infinite concept.-
Methods inherited from class ptolemy.data.ontologies.Concept
getAssociatedObject, 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
-
-
-
-
Field Detail
-
_representative
protected FlatTokenRepresentativeConcept _representative
The finite concept that represents where the infinite token concepts belong in the ontology lattice.
-
_tokenValue
protected Token _tokenValue
The token value for this FlatTokenInfiniteConcept.
-
-
Constructor Detail
-
FlatTokenInfiniteConcept
protected FlatTokenInfiniteConcept(Ontology ontology, FlatTokenRepresentativeConcept representative, Token value) throws IllegalActionException, NameDuplicationException
Create a new FlatTokenInfiniteConcept, belonging to the given ontology.- Parameters:
ontology
- The ontology to which this concept belongs.representative
- The finite concept that represents where the infinite token concepts belong in the ontology lattice.value
- The token value for this FlatTokenInfiniteConcept.- Throws:
NameDuplicationException
- Should never be thrown.IllegalActionException
- If the base class throws it.
-
-
Method Detail
-
createFlatTokenInfiniteConcept
public static FlatTokenInfiniteConcept createFlatTokenInfiniteConcept(Ontology ontology, FlatTokenRepresentativeConcept representative, Token value) throws IllegalActionException
Create a new flat token infinite concept, belonging to the given ontology, with an automatically generated name.- Parameters:
ontology
- The ontology to which this concept belongs.representative
- The finite concept that represents where the infinite token concepts belong in the ontology lattice.value
- The token value for this FlatTokenInfiniteConcept.- Returns:
- The newly created RecordConcept.
- Throws:
IllegalActionException
- If the base class throws it.
-
compare
public int compare(Concept concept) throws IllegalActionException
Compare this concept with the given concept. Returns an int value that corresponds to the ordering between the elements as given in the CPO interface.- Specified by:
compare
in classInfiniteConcept
- Parameters:
concept
- The concept with which we are comparing.- Returns:
- CPO.HIGHER if this concept is above the given concept, CPO.LOWER if this concept is below the given concept, CPO.SAME if both concepts are the same, and CPO.INCOMPARABLE if concepts are incomparable.
- Throws:
IllegalActionException
- If the specified concept does not have the same ontology as this one.- See Also:
Concept.isAboveOrEqualTo(ptolemy.data.ontologies.Concept)
-
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()
-
getColor
public ColorAttribute getColor() throws IllegalActionException
Return the color attribute associated with this FlatTokenInfiniteConcept. This will be the color to be the color of the FlatTokenRepresentativeConcept representative which is a finite concept with a color given by its model color attribute.- Overrides:
getColor
in classConcept
- Returns:
- The color attribute of the representative concept.
- Throws:
IllegalActionException
- Thrown if there is an error getting the color from the representative concept.
-
getRepresentative
public FlatTokenRepresentativeConcept getRepresentative()
Get the concept that represents this set of infinite concepts in the ontology lattice.- Overrides:
getRepresentative
in classInfiniteConcept
- Returns:
- The representative concept.
-
getTokenValue
public Token getTokenValue()
Get the token value contained by this concept.- Returns:
- The token value contained by this concept.
-
greatestLowerBound
public Concept greatestLowerBound(Concept concept)
Compute the greatest lower bound (GLB) of this and another concept.- Specified by:
greatestLowerBound
in classInfiniteConcept
- Parameters:
concept
- The other concept- Returns:
- The concept that is the GLB of this and the given concept.
-
leastUpperBound
public Concept leastUpperBound(Concept concept)
Compute the least upper bound (LUB) of this and another concept.- Specified by:
leastUpperBound
in classInfiniteConcept
- Parameters:
concept
- The other concept- Returns:
- The concept that is the LUB of this and the given concept.
-
hashCode
public int hashCode()
Return the hash code of this record concept, which is uniquely determined by the ontology and the set of record field-concept mappings.- Specified by:
hashCode
in classInfiniteConcept
- Returns:
- The hash code of this concept.
- See Also:
Object.hashCode()
-
-