ptolemy.actor.util
Class FreeVariableModelAnalysis

java.lang.Object
  extended by ptolemy.actor.util.FreeVariableModelAnalysis

public class FreeVariableModelAnalysis
extends java.lang.Object

An analysis that traverses a model to determine all the free variables in a hierarchical model. The free variables in a model are defined to be the set of identifiers that are referenced by the model, but are not defined in the model. The free variables must be assigned values for the model to be executable. This class traverses the model, but it not read synchronized on the model, therefore its caller should be.

Since:
Ptolemy II 4.0
Version:
$Id: FreeVariableModelAnalysis.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Stephen Neuendorffer
Accepted Rating:
Yellow (neuendor)
Proposed Rating:
Yellow (neuendor)

Field Summary
private  java.util.HashMap _entityToFreeVariableNameSet
           
 
Constructor Summary
FreeVariableModelAnalysis(Entity model)
          Analyze the given model to return a set of names which must be defined externally for the model to be completely specified.
 
Method Summary
private  java.util.Set _freeVariables(Entity model)
           
 java.util.Set getFreeVariables(Entity entity)
          Return the computed free variables for the given entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_entityToFreeVariableNameSet

private java.util.HashMap _entityToFreeVariableNameSet
Constructor Detail

FreeVariableModelAnalysis

public FreeVariableModelAnalysis(Entity model)
                          throws IllegalActionException
Analyze the given model to return a set of names which must be defined externally for the model to be completely specified. In addition, store the intermediate results for contained actors so they can be retrieved by the getFreeVariables() method.

Parameters:
model - The model that will be analyzed.
Throws:
IllegalActionException - If an exception occurs during analysis.
Method Detail

getFreeVariables

public java.util.Set getFreeVariables(Entity entity)
Return the computed free variables for the given entity.

Parameters:
entity - An entity, which must be deeply contained by the model for which this analysis was created.
Returns:
The computed free variables for the given entity.
Throws:
java.lang.RuntimeException - If the free variables for the entity have not already been computed.

_freeVariables

private java.util.Set _freeVariables(Entity model)
                              throws IllegalActionException
Throws:
IllegalActionException