Package ptolemy.moml.unit
Class ExpandPortNames
- java.lang.Object
-
- ptolemy.moml.unit.EquationVisitor
-
- 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$
- Author:
- Rowland R Johnson
- Pt.AcceptedRating:
- Red (rowland)
- Pt.ProposedRating:
- Red (rowland)
-
-
Constructor Summary
Constructors Constructor Description ExpandPortNames()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
-
-
-
-
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 classEquationVisitor
- 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)
-
-