Class MonotonicityConcept
- 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<Concept>
-
- ptolemy.data.ontologies.lattice.adapters.monotonicityAnalysis.MonotonicityConcept
-
- All Implemented Interfaces:
java.lang.Cloneable
,InequalityTerm
,Changeable
,Debuggable
,DebugListener
,Derivable
,Instantiable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class MonotonicityConcept extends MapTypeInfiniteConcept<Concept>
A concept that represents the monotoncity of an expression. Note that for an arbitrary expression, it will not have a monotonicity concept of simply Monotonic, Constant, etc. Rather, the expression will have a monotonicity that depends on it's free variables. For example, an expression of the form(x <= Concept1) ? Bottom : (y <= Concept2) ? Top : Concept1
may have a monotonicity that is monotonic with respect to the variable x, but antimonotonic with respect to y (and constant with respect to all other variables). This class represents exactly such concepts, representing them as {x = Monotonic, y = Animonotonic}, in a manner and syntax similar to records of the Ptolemy II type system. In records, however, accessing an undefined tag is an error, whereas in expressions, they are simply constant with respect to any variables that are not free.- 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
MonotonicityConcept(Ontology ontology)
Create a new Monotonicity concept, 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 MonotonicityConcept
createMonotonicityConcept(Ontology ontology)
Create a new monotonicity concept, belonging to the given ontology, with an automatically generated name.ColorAttribute
getColor()
Return the correct color for this monotonicity concept by looking at the color of the finite monotonicity representative.Concept
getMonotonicity(java.lang.String variableName)
Get the monotonicity of this concept with respect to a specific variable.Concept
greatestLowerBound(Concept concept)
Compute the greatest lower bound (GLB) of this and another concept.Concept
leastUpperBound(Concept concept)
Compute the least upper bound (LUB) of this and another concept.void
putMonotonicity(java.lang.String variable, Concept monotonicity)
Set the monotonicity of this concept with respect to a specific variable.-
Methods inherited from class ptolemy.data.ontologies.MapTypeInfiniteConcept
_combinedKeys, _commonKeys, _values, equals, getConcept, hashCode, keySet, putConcept, toString
-
Methods inherited from class ptolemy.data.ontologies.InfiniteConcept
getRepresentative
-
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
-
-
-
-
Constructor Detail
-
MonotonicityConcept
protected MonotonicityConcept(Ontology ontology) throws IllegalActionException, NameDuplicationException
Create a new Monotonicity concept, belonging to the given ontology.- Parameters:
ontology
- The finite ontology to which this belongs. This should be the 4 element monotonicity lattice if we are really going to be doing inference on monotonicity of expressions.- Throws:
NameDuplicationException
- Should never be thrown.IllegalActionException
- If the base class throws it.
-
-
Method Detail
-
createMonotonicityConcept
public static MonotonicityConcept createMonotonicityConcept(Ontology ontology)
Create a new monotonicity concept, belonging to the given ontology, with an automatically generated name.- Parameters:
ontology
- The finite ontology to which this belongs. This should be the 4 element monotonicity lattice if we are really going to be doing inference on monotonicity of expressions.- Returns:
- The newly created MonotonicityConcept.
-
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)
-
getColor
public ColorAttribute getColor() throws IllegalActionException
Return the correct color for this monotonicity concept by looking at the color of the finite monotonicity representative.- Overrides:
getColor
in classConcept
- Returns:
- A ColorAttribute corresponding to the highlight color of this monotonicity concept.
- Throws:
IllegalActionException
- Thrown if there is an error getting the color for the finite monotonicity concept.
-
getMonotonicity
public Concept getMonotonicity(java.lang.String variableName)
Get the monotonicity of this concept with respect to a specific variable. While the overall monotonicity of an expression cannot be represented so simply, the monotonicity with respect to a single variable can be represented as one of:- Constant
- Monotonic
- Antimonotonic
- General
- NonMonotonic_{Counterexamples}
- NonAntimonotonic_{Counterexamples}
- Parameters:
variableName
- The variable whose monotonicity we are querying.- Returns:
- The monotonicity of this concept with respect to the given variable; one of Constant, Monotonic, Antimonotonic, or General.
-
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.
-
putMonotonicity
public void putMonotonicity(java.lang.String variable, Concept monotonicity)
Set the monotonicity of this concept with respect to a specific variable.- Parameters:
variable
- The variable whose monotonicity we are querying.monotonicity
- The monotonicity of this concept with respect to the given variable.- See Also:
getMonotonicity(String)
-
-