|
Purple Code | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.purpletech.graph.currency.CurrencyMapper
This class converts between BogoDollars and a particular currency representation. A BogoDollar is an int value. The actual meaning of this value is completely dependent on the particular currency the subclass 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.
BogoDollars may need to be upgraded to be longs soon.
| Field Summary | |
protected java.util.Locale |
locale
This is not the default Locale, otherwise the USD classes would break. |
| Constructor Summary | |
CurrencyMapper()
|
|
| Method Summary | |
abstract int |
fromDouble(double val)
converts from a double (representing an actual value in the actual underlying currency) to BogoDollars |
int |
fromString(java.lang.String s)
converts from a String (representing an actual value in the actual underlying currency) to BogoDollars. |
java.util.Locale |
getLocale()
returns the Locale for which this currency is standard |
UnitInterval |
getUnitInterval()
|
protected void |
setLocale(java.util.Locale locale)
If the sublass currency is not a US currency, then the subclass must call this method in its constructor. |
abstract double |
toDouble(int val)
converts from BogoDollars to a double representation of this currency |
java.lang.String |
toString(int val)
converts from BogoDollars to a String representation of this currency |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.purpletech.graph.Unit |
fromObject, toString |
| Field Detail |
protected java.util.Locale locale
| Constructor Detail |
public CurrencyMapper()
| Method Detail |
public abstract double toDouble(int val)
public java.lang.String toString(int val)
toString in interface Unitpublic abstract int fromDouble(double val)
public int fromString(java.lang.String s)
throws java.text.ParseException
Should be overridden if the Locale's parse method doesn't work correctly for this currency (e.g. fractious and fractional values)
fromString in interface Units - a String representing an actual value in the real units
java.text.ParseExceptionpublic java.util.Locale getLocale()
protected void setLocale(java.util.Locale locale)
public UnitInterval getUnitInterval()
getUnitInterval in interface Unit
|
Documentation generated March 5 2003 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||