|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.moml.unit.UnitConstraints
public class UnitConstraints
UnitConstraints represents a group, with duplicates allowed, of UnitConstraints. The are two general ways to create an instance of this class. The first requires you to create an instance without any UnitConstraints and then add them with the method addConstraint. The second is to specify a TypedCompositeActor as well as specific nodes and relations in the TypedCompositeActor, and have the UnitConstraintCollection constructor determine which UnitConstraints belong to the collection.
Red (cxh) |
Red (cxh) |
Field Summary | |
---|---|
private Bindings |
_bindings
|
private java.util.Vector |
_constraints
|
private boolean |
_debug
|
private static ExpandPortNames |
_equationVisitor
|
private TypedCompositeActor |
_model
|
Constructor Summary | |
---|---|
UnitConstraints()
Construct an empty collection of Unit constraints. |
|
UnitConstraints(TypedCompositeActor model,
java.util.Vector entities,
java.util.Vector relations)
Construct a collection of Unit constraints from the specified componentEntities and relations of a model. |
Method Summary | |
---|---|
void |
addConstraint(UnitConstraint constraint)
Add a UnitConstraint to the collection. |
Solution |
completeSolution()
Generate a complete solution. |
java.lang.String |
descriptiveForm()
This method generates the descriptive form. |
java.util.Vector |
getConstraints()
Get the constraints in the collection. |
java.util.Vector |
minimalSpanSolutions()
Generate the minimal span solutions of the collection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface ptolemy.moml.unit.UnitPresentation |
---|
toString |
Field Detail |
---|
private Bindings _bindings
private java.util.Vector _constraints
private boolean _debug
private static ExpandPortNames _equationVisitor
private TypedCompositeActor _model
Constructor Detail |
---|
public UnitConstraints()
public UnitConstraints(TypedCompositeActor model, java.util.Vector entities, java.util.Vector relations) throws IllegalActionException
For each componentEntity each constraints in the form of Unit equation is retrieved and then used a basis to create a Unit constraint to add to the collection. Each port on the componentEntity is inspected to see if it has a Unit specified for it. If so, then that Unit specification is used to create a corresponding Unit constraint that gets added to the collection.
A component entity itself may have Unit constraint(s) that then get added to the collection. For example, the AddSubtract actor would likely have a constraint that requires that the plus, and minus ports be equal.
The relations are then considered. Any relation that connects two ports seen on a component entity in the first step is used to create a Unit equation that gets added to the collection.
model
- The model containing the component entities.entities
- The component entities.relations
- The relations.
IllegalActionException
Method Detail |
---|
public void addConstraint(UnitConstraint constraint)
constraint
- The UnitConstraint to be added to the collection.public Solution completeSolution() throws IllegalActionException
IllegalActionException
public java.lang.String descriptiveForm()
UnitPresentation
The descriptive form is invariant across Unit Systems. That is, calorie is calorie regardless of the Unit System. But, the internal form may be 4.1868E7*<2, 1, 1, 0, 0> in one Unit System, and 1.0*<2, 1, 1, 0, 0> in another. Therefore the descriptive form is used as the external representation. This makes it possible to save a model under one Unit System, and then load it under a different Unit System.
descriptiveForm
in interface UnitPresentation
UnitPresentation.descriptiveForm()
public java.util.Vector getConstraints()
public java.util.Vector minimalSpanSolutions() throws IllegalActionException
IllegalActionException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |