ptolemy.actor.gt
Class GTParameter.TypeInference

java.lang.Object
  extended by ptolemy.data.expr.AbstractParseTreeVisitor
      extended by ptolemy.data.expr.ParseTreeTypeInference
          extended by ptolemy.actor.gt.GTParameter.TypeInference
All Implemented Interfaces:
ParseTreeVisitor
Enclosing class:
GTParameter

public static class GTParameter.TypeInference
extends ParseTreeTypeInference

The type inference used to infer types of names in the host model and in the pattern, which is used in GTParameter.Evaluator.

Since:
Ptolemy II 7.1
Version:
$Id: GTParameter.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Thomas Huining Feng
Accepted Rating:
Red (tfeng)
Proposed Rating:
Yellow (tfeng)

Field Summary
private  MatchResult _matchResult
          The match result.
private  Pattern _pattern
          The pattern.
 
Fields inherited from class ptolemy.data.expr.ParseTreeTypeInference
_inferredChildType, _scope
 
Constructor Summary
GTParameter.TypeInference(Pattern pattern, MatchResult matchResult)
          Construct a type inference.
 
Method Summary
 Type inferTypes(ASTPtRootNode node, ParserScope scope)
          Infer the type of the parse tree with the specified root node using the specified scope to resolve the values of variables.
 void visitMethodCallNode(ASTPtMethodCallNode node)
          Set the type of the given node to be the return type of the method determined for the given node.
 
Methods inherited from class ptolemy.data.expr.ParseTreeTypeInference
_assert, _getMethodReturnType, _getTypeForName, _inferAllChildren, _inferChild, _isValidName, _methodCall, _setType, inferTypes, visitArrayConstructNode, visitBitwiseNode, visitFunctionalIfNode, visitFunctionApplicationNode, visitFunctionDefinitionNode, visitLeafNode, visitLogicalNode, visitMatrixConstructNode, visitPowerNode, visitProductNode, visitRecordConstructNode, visitRelationalNode, visitShiftNode, visitSumNode, visitUnaryNode
 
Methods inherited from class ptolemy.data.expr.AbstractParseTreeVisitor
_unsupportedVisitException, _visitAllChildren, _visitChild, visitAssignmentNode, visitUnionConstructNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_matchResult

private MatchResult _matchResult
The match result.


_pattern

private Pattern _pattern
The pattern.

Constructor Detail

GTParameter.TypeInference

public GTParameter.TypeInference(Pattern pattern,
                                 MatchResult matchResult)
Construct a type inference.

Parameters:
pattern - The pattern.
matchResult - The match result for the match between the pattern and a host model.
Method Detail

inferTypes

public Type inferTypes(ASTPtRootNode node,
                       ParserScope scope)
                throws IllegalActionException
Infer the type of the parse tree with the specified root node using the specified scope to resolve the values of variables.

Overrides:
inferTypes in class ParseTreeTypeInference
Parameters:
node - The root of the parse tree.
scope - The scope for evaluation.
Returns:
The result of evaluation.
Throws:
IllegalActionException - If an error occurs during evaluation.

visitMethodCallNode

public void visitMethodCallNode(ASTPtMethodCallNode node)
                         throws IllegalActionException
Set the type of the given node to be the return type of the method determined for the given node.

Specified by:
visitMethodCallNode in interface ParseTreeVisitor
Overrides:
visitMethodCallNode in class ParseTreeTypeInference
Parameters:
node - The specified node.
Throws:
IllegalActionException - If an inference error occurs.