|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectptolemy.moml.unit.UnitTerm
public class UnitTerm
UnitTerm represents a term in a Unit Expression. A UnitTerm has 1) an exponent and 2) an element. The element can be either 1) a Unit, 2) a variable, or 3) a Unit Expression. These choices for element are mutually exclusive. UnitTerms are usually constructed as a result of parsing a Unit Expression.
| Red (rowland) |
| Red (rowland) |
| Field Summary | |
|---|---|
private int |
_exponent
|
private int |
_type
|
private Unit |
_unit
|
private static int |
_UNIT
|
private UnitExpr |
_unitExpr
|
private static int |
_UNITEXPR
|
private java.lang.String |
_variable
|
private static int |
_VARIABLE
|
| Constructor Summary | |
|---|---|
UnitTerm()
Construct a UnitTerm with no element. |
|
UnitTerm(Unit unit)
Construct an instance where the contained element is a Unit. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final int _UNIT
private static final int _UNITEXPR
private static final int _VARIABLE
private int _exponent
private int _type
private Unit _unit
private UnitExpr _unitExpr
private java.lang.String _variable
| Constructor Detail |
|---|
public UnitTerm()
public UnitTerm(Unit unit)
unit - The Unit that will be the element of this instance.| Method Detail |
|---|
public UnitTerm copy()
public java.lang.String descriptiveForm()
descriptiveForm in interface UnitPresentationUnitPresentation.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 UnitPresentationtoString in class java.lang.Object
public java.lang.Object visit(EquationVisitor visitor)
throws IllegalActionException
visitor - The visitor.
IllegalActionExceptionprotected void _setType(int type)
type - The Unit type.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||