ptolemy.moml.unit
Class ExpandPortNames

java.lang.Object
  extended by ptolemy.moml.unit.EquationVisitor
      extended by ptolemy.moml.unit.ExpandPortNames

public class ExpandPortNames
extends EquationVisitor

Visit a UnitEquation and for each contained variable that represents a port substitute it with a variable that represents the port from the perspective of the model that contains the actor that contains the port. For example, the variable representing the value of the plus port of an actor named AddSubtract22 would originally have the variable label plus which would be substituted with AddSubtract22.plus. The reason for doing this is that a ComponentEntity will have constraints on units specified as a set of UnitEquations. Within each UnitEquation a variable of the form $PortName is used to represent the Unit value at that port. Since a CompositeEntity will have several ComponentEntities, each with a set of ports, it is possible that port names will be duplicated.

Since:
Ptolemy II 8.0
Version:
$Id: ExpandPortNames.java 57044 2010-01-27 22:41:05Z cxh $
Author:
Rowland R Johnson
Accepted Rating:
Red (rowland)
Proposed Rating:
Red (rowland)

Field Summary
(package private)  java.util.List _actorPorts
           
 
Constructor Summary
ExpandPortNames()
           
 
Method Summary
protected  java.lang.Object _visitUnitTerm(UnitTerm uTerm)
          The method that actually does the substitution of a variable with the model name of the port.
 void expand(UnitEquation equation, ComponentEntity actor)
          The method is the entry point to the class.
 
Methods inherited from class ptolemy.moml.unit.EquationVisitor
_visitUnitEquation, _visitUnitExpr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_actorPorts

java.util.List _actorPorts
Constructor Detail

ExpandPortNames

public ExpandPortNames()
Method Detail

expand

public void expand(UnitEquation equation,
                   ComponentEntity actor)
            throws IllegalActionException
The method is the entry point to the class.

Parameters:
equation - The UnitEquation to be visited.
actor - The ComponentEntity that contains ports that may be referenced in the equation.
Throws:
IllegalActionException

_visitUnitTerm

protected java.lang.Object _visitUnitTerm(UnitTerm uTerm)
                                   throws IllegalActionException
The method that actually does the substitution of a variable with the model name of the port.

Overrides:
_visitUnitTerm in class EquationVisitor
Parameters:
uTerm - The UnitTerm to visit.
Returns:
Null, can be overridden in a concrete visitor.
Throws:
IllegalActionException - Not thrown in this base class.
See Also:
EquationVisitor._visitUnitTerm(UnitTerm)