public class UnitConstraints extends java.lang.Object implements UnitPresentation
Red (cxh) |
Red (cxh) |
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toString
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
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