public abstract class OntologyAdapter
extends java.lang.Object
The model component can be an object of any Ptolemy class (e.g. ASTPtRootNode, Sink, Entity, and FSMActor). A model component, in turn, may have one or multiple property-able objects. Each constraint is relevant to a property-able object. For example, the PropertyAdapter associated with an actor may have each of its IOPorts as property-able.
A property-able object is an object that can be annotated with a Property object. Users can define different Property classes as part of their use-case definition.
Every PropertyAdapter is associated a property solver. PropertyAdapters support hierarchical structuring. They may have downward links to sub-adapters. This is helpful to construct PropertyAdapter for hierarchical component in the model. For example, a PropertyAdapter for the CompositeActor have all the contained actors' adapters as its sub-adapters.
A PropertyAdapter supports manual annotation. Users can define their own annotation evaluator to evaluate property expressions and/or constraints.
Red (mankit) |
Red (mankit) |
Modifier and Type | Field and Description |
---|---|
protected ParseTreeAnnotationEvaluator |
_annotationEvaluator
The annotation evaluator.
|
protected OntologySolver |
_solver
The associated ontology solver.
|
Constructor and Description |
---|
OntologyAdapter() |
Modifier and Type | Method and Description |
---|---|
protected abstract ParseTreeAnnotationEvaluator |
_annotationEvaluator()
Create a new ParseTreeAnnotationEvaluator that is tailored for the
ontology.
|
protected java.util.List<OntologyAdapter> |
_getASTNodeAdapters()
Return the list of PropertyAdapters for ASTPtRootNodes.
|
protected java.util.List<ASTPtRootNode> |
_getAttributeParseTrees()
Return the list of parse trees for all settable Attributes
of the component.
|
protected java.util.List<Attribute> |
_getPropertyableAttributes()
Return the list of property-able Attributes.
|
protected static java.util.List<IOPort> |
_getSinkPortList(IOPort port)
Return the list of receiving (down-stream) ports that are
connected to the specified port.
|
protected static java.util.List<IOPort> |
_getSourcePortList(IOPort port)
Return the list of sending (up-stream) ports that are connected
to the specified port.
|
protected java.util.List<OntologyAdapter> |
_getSubAdapters()
Return the list of sub-adapters.
|
java.lang.Object |
getComponent()
Return the associated component object.
|
Entity |
getContainerEntity(ASTPtRootNode node)
Return the container entity for the specified ASTPtRootNode.
|
java.lang.String |
getName()
Return the name of the PropertyAdapter.
|
protected ASTPtRootNode |
getParseTree(Attribute attribute)
Return the ASTPtRootNode for the specified Attribute.
|
java.util.List<java.lang.Object> |
getPropertyables()
Return a list of property-able NamedObj contained by the component.
|
OntologySolver |
getSolver()
Return The PropertySolver that uses this adapter.
|
protected void |
putAttribute(ASTPtRootNode node,
Attribute attribute)
Record the association between the specified ASTPtRootNode and the
specified Attribute.
|
void |
reinitialize()
Reset and initialize the PropertyAdapter.
|
void |
setComponent(java.lang.Object component)
Associate this PropertyAdapter with the specified component.
|
void |
setEquals(java.lang.Object object,
Concept property)
Set the property of specified object equal to the specified property.
|
java.lang.String |
toString()
Return the string representation of the PropertyAdapter.
|
protected ParseTreeAnnotationEvaluator _annotationEvaluator
protected OntologySolver _solver
public java.lang.Object getComponent()
setComponent(java.lang.Object)
public Entity getContainerEntity(ASTPtRootNode node)
node
- The specified ASTPtRootNode.public java.lang.String getName()
public java.util.List<java.lang.Object> getPropertyables()
public OntologySolver getSolver()
public void reinitialize() throws IllegalActionException
IllegalActionException
- Thrown if
getPropertyables()
throws it.public void setComponent(java.lang.Object component)
component
- The specified component.getComponent()
public void setEquals(java.lang.Object object, Concept property)
object
- The specified object.property
- The specified property.public java.lang.String toString()
toString
in class java.lang.Object
protected abstract ParseTreeAnnotationEvaluator _annotationEvaluator()
protected java.util.List<OntologyAdapter> _getASTNodeAdapters() throws IllegalActionException
IllegalActionException
- If the AST expression is not parseableprotected java.util.List<ASTPtRootNode> _getAttributeParseTrees() throws IllegalActionException
IllegalActionException
- Thrown if there is a problem getting
the parse trees for the attributes.protected java.util.List<Attribute> _getPropertyableAttributes()
protected static java.util.List<IOPort> _getSinkPortList(IOPort port)
port
- The specified port.protected static java.util.List<IOPort> _getSourcePortList(IOPort port)
port
- The specified port.protected java.util.List<OntologyAdapter> _getSubAdapters() throws IllegalActionException
IllegalActionException
- Not thrown in this base class.protected ASTPtRootNode getParseTree(Attribute attribute) throws IllegalActionException
attribute
- The specified attribute.IllegalActionException
- Thrown if
OntologySolverBase.getParseTree(Attribute)
throws it.protected void putAttribute(ASTPtRootNode node, Attribute attribute)
node
- The specified ASTPtRootNode.attribute
- The specified Attribute.