Package ptolemy.data.ontologies.lattice
Class ActorConstraintsDefinitionAdapter
- java.lang.Object
-
- ptolemy.data.ontologies.OntologyAdapter
-
- ptolemy.data.ontologies.lattice.LatticeOntologyAdapter
-
- ptolemy.data.ontologies.lattice.ActorConstraintsDefinitionAdapter
-
- Direct Known Subclasses:
ActorProductLatticeConstraintsDefinitionAdapter
public class ActorConstraintsDefinitionAdapter extends LatticeOntologyAdapter
A class that creates a lattice-based ontology adapter from a model-based actor constraints definition attribute.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Charles Shelton
- See Also:
ActorConstraintsDefinitionAttribute
- Pt.AcceptedRating:
- Red (cshelton)
- Pt.ProposedRating:
- Green (cshelton)
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<StringParameter>
_constraintTermExpressions
The list of expressions that represent the constraint terms for each constraint in the actor.-
Fields inherited from class ptolemy.data.ontologies.lattice.LatticeOntologyAdapter
_ownConstraints, _subAdapterConstraints, _useDefaultConstraints, interconnectConstraintType
-
Fields inherited from class ptolemy.data.ontologies.OntologyAdapter
_annotationEvaluator, _solver
-
-
Constructor Summary
Constructors Constructor Description ActorConstraintsDefinitionAdapter(LatticeOntologySolver solver, ComponentEntity component, java.util.List<StringParameter> constraintExpressions)
Construct the lattice ontology adapter for the given component and property lattice.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ConceptFunctionInequalityTerm
_getConceptFunctionTerm(NamedObj actorElement, java.lang.String functionString)
Return the inequality term representing the concept function defined by the specified string.protected java.util.List<Attribute>
_getPropertyableAttributes()
Return the list of property-able Attributes.protected void
_setConstraints(NamedObj actorElement, java.lang.String constraintExpressionString)
Set the constraints for the actor attribute or port based on the parsed expression string.java.util.List<Inequality>
constraintList()
Return the constraints of this component.java.util.List<java.lang.Object>
getPropertyables()
Return a list of property-able ports and attributes contained by the component.-
Methods inherited from class ptolemy.data.ontologies.lattice.LatticeOntologyAdapter
_addDefaultConstraints, _addSubAdapterConstraints, _annotationEvaluator, _constrainAttributes, _constrainObject, _constrainObjectLists, _constrainSingleObject, _getConstrainedPorts, _getConstraintingPorts, _getSubAdapters, _setConnectionConstraintType, _union, getPropertyTerm, getSolver, isConstraintSource, reinitialize, setAtLeast, setAtMost, setSameAs
-
Methods inherited from class ptolemy.data.ontologies.OntologyAdapter
_getASTNodeAdapters, _getAttributeParseTrees, _getSinkPortList, _getSourcePortList, getComponent, getContainerEntity, getName, getParseTree, putAttribute, setComponent, setEquals, toString
-
-
-
-
Field Detail
-
_constraintTermExpressions
protected java.util.List<StringParameter> _constraintTermExpressions
The list of expressions that represent the constraint terms for each constraint in the actor.
-
-
Constructor Detail
-
ActorConstraintsDefinitionAdapter
public ActorConstraintsDefinitionAdapter(LatticeOntologySolver solver, ComponentEntity component, java.util.List<StringParameter> constraintExpressions) throws IllegalActionException
Construct the lattice ontology adapter for the given component and property lattice.- Parameters:
solver
- The specified lattice-based ontology solver.component
- The given component.constraintExpressions
- The list of constraint expressions for each port or component in the actor.- Throws:
IllegalActionException
- Thrown if the adapter cannot be initialized.
-
-
Method Detail
-
constraintList
public java.util.List<Inequality> constraintList() throws IllegalActionException
Return the constraints of this component. The constraints are generated from the expressions passed in from an ActorConstraintsDefinitionAttribute that allows the user to define actor constraints in the OntologySolver model.- Overrides:
constraintList
in classLatticeOntologyAdapter
- Returns:
- The list of constraints for this component.
- Throws:
IllegalActionException
- If there is a problem parsing the constraint expression strings to create the actor constraints.
-
getPropertyables
public java.util.List<java.lang.Object> getPropertyables()
Return a list of property-able ports and attributes contained by the component. If any of the actor element expressions are set to IGNORE then they are not added to the list of property-able objects.- Overrides:
getPropertyables
in classOntologyAdapter
- Returns:
- The list of property-able ports and attributes.
-
_getConceptFunctionTerm
protected ConceptFunctionInequalityTerm _getConceptFunctionTerm(NamedObj actorElement, java.lang.String functionString) throws IllegalActionException
Return the inequality term representing the concept function defined by the specified string.- Parameters:
actorElement
- The actor element for which this concept function constraint is being defined.functionString
- The string containing the expression for the concept function.- Returns:
- The concept function inequality term that implements the concept function and contains the correct inequality term inputs.
- Throws:
IllegalActionException
- If the string cannot be correctly parsed and the concept function cannot be created.
-
_getPropertyableAttributes
protected java.util.List<Attribute> _getPropertyableAttributes()
Return the list of property-able Attributes. This list is defined by the expressions for each attribute taken from the ActorConstraintsDefinitionAttribute. Any attribute that is set to IGNORE is not added to the list of property-able attributes.- Overrides:
_getPropertyableAttributes
in classOntologyAdapter
- Returns:
- The list of property-able Attributes.
-
_setConstraints
protected void _setConstraints(NamedObj actorElement, java.lang.String constraintExpressionString) throws IllegalActionException
Set the constraints for the actor attribute or port based on the parsed expression string.- Parameters:
actorElement
- The attribute or port from the actor to be constrained.constraintExpressionString
- The expression string that is parsed to get the constraints for the actor attribute or port.- Throws:
IllegalActionException
- If the constraint cannot be set due to problems parsing the expression.
-
-