ptolemy.moml.unit
Class UnitEquation

java.lang.Object
  extended by ptolemy.moml.unit.UnitConstraint
      extended by ptolemy.moml.unit.UnitEquation
All Implemented Interfaces:
UnitPresentation

public class UnitEquation
extends UnitConstraint
implements UnitPresentation

A Unit equation is a particular type of Unit constraint, another type being a Unit inequality.

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

Field Summary
 
Fields inherited from class ptolemy.moml.unit.UnitConstraint
_lhs, _operator, _rhs, _source
 
Constructor Summary
UnitEquation(UnitExpr lhs, UnitExpr rhs)
          Construct a UnitEquation from the left and right hand sides.
 
Method Summary
static boolean areSatisfied(java.util.Vector equations)
          Return true if the equations are all satisfied.
 UnitEquation canonicalize()
          Transform to the canonical form of the equation.
 UnitEquation copy()
          Make a copy where the left and right sides are alos copied.
 boolean isSatisfied()
          Return true if this equation is satisfied.
 java.lang.Object visit(EquationVisitor visitor)
          Visit this Unit equation (on the way to visiting the leaves)
 
Methods inherited from class ptolemy.moml.unit.UnitConstraint
descriptiveForm, getLhs, getOperator, getRhs, getSource, setLhs, setRhs, setSource, toString
 
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
descriptiveForm, toString
 

Constructor Detail

UnitEquation

public UnitEquation(UnitExpr lhs,
                    UnitExpr rhs)
Construct a UnitEquation from the left and right hand sides.

Parameters:
lhs - The left hand side.
rhs - The right hand side.
Method Detail

areSatisfied

public static boolean areSatisfied(java.util.Vector equations)
Return true if the equations are all satisfied.

Parameters:
equations - The equations.
Returns:
True if the equations are all satisfied.

canonicalize

public UnitEquation canonicalize()
Transform to the canonical form of the equation. The canonical form of an equation is Ex1, Ex2, ..., Exn = A where each Exi is a Unit term containing only one variable, and A is a Unit term containing one Unit and no variables.

Returns:
unitEquation The UnitEquation in canonical form.

copy

public UnitEquation copy()
Make a copy where the left and right sides are alos copied.

Returns:
The copy.

isSatisfied

public boolean isSatisfied()
Return true if this equation is satisfied.

Returns:
True if this equation is satisfied.

visit

public java.lang.Object visit(EquationVisitor visitor)
                       throws IllegalActionException
Visit this Unit equation (on the way to visiting the leaves)

Parameters:
visitor - The visitor.
Returns:
Whatever may be returned by the visitor.
Throws:
IllegalActionException - Not thrown in this base class.