Package ptolemy.data.ontologies
Class ParseTreeAnnotationEvaluator
- java.lang.Object
- 
- ptolemy.data.expr.AbstractParseTreeVisitor
- 
- ptolemy.data.ontologies.ParseTreeAnnotationEvaluator
 
 
- 
- All Implemented Interfaces:
- ParseTreeVisitor
 - Direct Known Subclasses:
- ParseTreeConstraintAnnotationEvaluator
 
 public class ParseTreeAnnotationEvaluator extends AbstractParseTreeVisitor This class visits parse trees and infers a property for each node in the parse tree. This property is stored in the parse tree.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Man-Kit Leung
- See Also:
- ASTPtRootNode
- Pt.AcceptedRating:
- Red (mankit)
- Pt.ProposedRating:
- Red (mankit)
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected OntologyAdapter_adapterThe property adapter that contains the top level model component containing actors that could be referenced by the node label.protected java.lang.Object_evaluatedObjectThe model component that the parse tree node refers to.
 - 
Constructor SummaryConstructors Constructor Description ParseTreeAnnotationEvaluator()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String_getNodeLabel(ASTPtLeafNode node)Return the label for the leaf node.protected IllegalActionException_unsupportedVisitException(java.lang.String name)Return an exception that describes an unsupported node type.voidevaluate(ASTPtRootNode node, OntologyAdapter adapter)Infer the property of the parse tree with the specified root node using the specified scope to resolve the values of variables.voidvisitAssignmentNode(ASTPtAssignmentNode node)Visit the assignment node when parsing a user-defined ontology annotation.voidvisitLeafNode(ASTPtLeafNode node)visitLeafNode method is called when parsing an Annotation for a manual constraint.voidvisitMethodCallNode(ASTPtMethodCallNode node)Visit the method node when parsing a user-defined ontology annotation.- 
Methods inherited from class ptolemy.data.expr.AbstractParseTreeVisitor_visitAllChildren, _visitChild, visitArrayConstructNode, visitBitwiseNode, visitFunctionalIfNode, visitFunctionApplicationNode, visitFunctionDefinitionNode, visitLogicalNode, visitMatrixConstructNode, visitPowerNode, visitProductNode, visitRecordConstructNode, visitRelationalNode, visitShiftNode, visitSumNode, visitUnaryNode, visitUnionConstructNode
 
- 
 
- 
- 
- 
Field Detail- 
_adapterprotected OntologyAdapter _adapter The property adapter that contains the top level model component containing actors that could be referenced by the node label.
 - 
_evaluatedObjectprotected java.lang.Object _evaluatedObject The model component that the parse tree node refers to.
 
- 
 - 
Method Detail- 
evaluatepublic void evaluate(ASTPtRootNode node, OntologyAdapter adapter) throws IllegalActionException Infer the property of the parse tree with the specified root node using the specified scope to resolve the values of variables.- Parameters:
- node- The root of the parse tree.
- adapter- The given property adapter.
- Throws:
- IllegalActionException- If an error occurs during evaluation.
 
 - 
visitAssignmentNodepublic void visitAssignmentNode(ASTPtAssignmentNode node) throws IllegalActionException Visit the assignment node when parsing a user-defined ontology annotation. This is for a manual annotation that assigns a Concept to a specified model component.- Specified by:
- visitAssignmentNodein interface- ParseTreeVisitor
- Overrides:
- visitAssignmentNodein class- AbstractParseTreeVisitor
- Parameters:
- node- The assignment node to be visited.
- Throws:
- IllegalActionException- If the assignment is not possible.
 
 - 
visitLeafNodepublic void visitLeafNode(ASTPtLeafNode node) throws IllegalActionException visitLeafNode method is called when parsing an Annotation for a manual constraint. Uncommented to get ontology solver to work. 12/16/09 Charles Shelton This visitLeafNode method assumes the node will refer to a component in the model and _evaluatedObject will be set to that component. If it is not, then an exception is thrown. In the derived class ParseTreeConstraintAnnotationEvaluator for constraint annotations, the node could also refer to a Concept in the Ontology. The derived class will override this method and catch its exception, then check to see if the node refers to a Concept rather than a model Component.- Specified by:
- visitLeafNodein interface- ParseTreeVisitor
- Overrides:
- visitLeafNodein class- AbstractParseTreeVisitor
- Parameters:
- node- The leaf node to be visited
- Throws:
- IllegalActionException- If the node label cannot be resolved to a component in the model
 
 - 
visitMethodCallNodepublic void visitMethodCallNode(ASTPtMethodCallNode node) throws IllegalActionException Visit the method node when parsing a user-defined ontology annotation.- Specified by:
- visitMethodCallNodein interface- ParseTreeVisitor
- Overrides:
- visitMethodCallNodein class- AbstractParseTreeVisitor
- Parameters:
- node- The method call node to be visited
- Throws:
- IllegalActionException- If the method label cannot be resolved.
 
 - 
_getNodeLabelprotected java.lang.String _getNodeLabel(ASTPtLeafNode node) Return the label for the leaf node.- Parameters:
- node- The given leaf node
- Returns:
- The string label for the node; If the node is constant this is the token contained in the node as a string, if not then this is the name of the node.
 
 - 
_unsupportedVisitExceptionprotected IllegalActionException _unsupportedVisitException(java.lang.String name) Return an exception that describes an unsupported node type.- Overrides:
- _unsupportedVisitExceptionin class- AbstractParseTreeVisitor
- Parameters:
- name- The name of the node type.
- Returns:
- An exception that describes an unsupported node type.
 
 
- 
 
-