public class UnitTerm extends java.lang.Object implements UnitPresentation
Red (rowland) |
Red (rowland) |
Constructor and Description |
---|
UnitTerm()
Construct a UnitTerm with no element.
|
UnitTerm(Unit unit)
Construct an instance where the contained element is a Unit.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_setType(int type) |
UnitTerm |
copy()
Make a shallow copy of this UnitTerm.
|
java.lang.String |
descriptiveForm()
Create a String that is understandable by a human.
|
int |
getExponent() |
Unit |
getUnit()
Get the element if it is a Unit.
|
UnitExpr |
getUnitExpr()
Get the element if it is a UnitExpr.
|
java.lang.String |
getVariable()
Get the element if it is a variable.
|
UnitTerm |
invert()
Invert this UnitTerm.
|
boolean |
isUnit()
True if this is a Unit.
|
boolean |
isUnitExpr()
True is this is a UnitExpr.
|
boolean |
isVariable()
True if this a variable.
|
void |
setExponent(int exponent)
Set the exponent.
|
void |
setUnit(Unit unit)
Set the element to be a Unit.
|
void |
setUnitExpr(UnitExpr expr)
Set the element to be a UnitExpr.
|
void |
setVariable(java.lang.String v)
Set the element to be a variable
|
java.lang.String |
toString() |
java.lang.Object |
visit(EquationVisitor visitor)
Visit an instance of UnitTerm.
|
public UnitTerm()
public UnitTerm(Unit unit)
unit
- The Unit that will be the element of this instance.public UnitTerm copy()
public java.lang.String descriptiveForm()
descriptiveForm
in interface UnitPresentation
UnitPresentation.descriptiveForm()
public int getExponent()
public Unit getUnit()
public UnitExpr getUnitExpr()
public java.lang.String getVariable()
public UnitTerm invert()
public boolean isUnit()
public boolean isUnitExpr()
public boolean isVariable()
public void setExponent(int exponent)
exponent
- The exponent.public void setUnit(Unit unit)
unit
- The Unit.public void setUnitExpr(UnitExpr expr)
expr
- The Unit Expression.public void setVariable(java.lang.String v)
v
- The variable.public java.lang.String toString()
toString
in interface UnitPresentation
toString
in class java.lang.Object
public java.lang.Object visit(EquationVisitor visitor) throws IllegalActionException
visitor
- The visitor.IllegalActionException
protected void _setType(int type)
type
- The Unit type.