|
Purple Code | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
A Unit maps an int to a string representation. It also provides a natural interval (UnitInterval).
The int represents some value. The actual meaning of this value is completely dependent on the particular unit the implementing class represents. But since it's an int, we can optimize our calculations and our display code, and then provide a mapping to String or to double for display or storage purposes.
| Method Summary | |
int |
fromObject(java.lang.Object val)
converts from an Object representing an actual value in the real units to an int. |
int |
fromString(java.lang.String val)
converts from a String representing an actual value in the real units to an int. |
UnitInterval |
getUnitInterval()
|
java.lang.String |
toString(int val)
converts from int to a String representation of this unit |
java.lang.String |
toString(java.lang.Object val)
converts from some Object type to a String representation of this unit |
| Method Detail |
public java.lang.String toString(int val)
public java.lang.String toString(java.lang.Object val)
val - an object containing the value, usually a number wrapper
public int fromString(java.lang.String val)
throws java.text.ParseException
val - a String representing an actual value in the real units
java.text.ParseExceptionpublic int fromObject(java.lang.Object val)
val - a String representing an actual value in the real units
public UnitInterval getUnitInterval()
|
Documentation generated March 5 2003 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||