Purple Code

com.purpletech.graph.currency
Class USDMapper

java.lang.Object
  |
  +--com.purpletech.graph.currency.CurrencyMapper
        |
        +--com.purpletech.graph.currency.USDMapper
All Implemented Interfaces:
Unit

public class USDMapper
extends CurrencyMapper

This class converts between BogoDollars and US Dollars (decimal representation, to 4 decimal places (1/100 of a penny)).

Version:
1.0 26 Sept 1998
Author:
Alex Chaffee, Ian McFarland

Field Summary
 
Fields inherited from class com.purpletech.graph.currency.CurrencyMapper
locale
 
Constructor Summary
USDMapper()
           
 
Method Summary
 int fromDouble(double val)
          converts from a double (representing an actual value in the actual underlying currency) to BogoDollars
 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 s)
          converts from a String (representing an actual value in the actual underlying currency) to BogoDollars.
 double toDouble(int val)
          converts from BogoDollars to a double representation of this currency
 java.lang.String toString(java.lang.Object val)
          converts from some Object type to a String representation of this unit
 
Methods inherited from class com.purpletech.graph.currency.CurrencyMapper
getLocale, getUnitInterval, setLocale, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

USDMapper

public USDMapper()
Method Detail

toDouble

public double toDouble(int val)
converts from BogoDollars to a double representation of this currency

Specified by:
toDouble in class CurrencyMapper

fromDouble

public int fromDouble(double val)
converts from a double (representing an actual value in the actual underlying currency) to BogoDollars

Specified by:
fromDouble in class CurrencyMapper

toString

public java.lang.String toString(java.lang.Object val)
Description copied from interface: Unit
converts from some Object type to a String representation of this unit

Parameters:
val - an object containing the value, usually a number wrapper

fromObject

public int fromObject(java.lang.Object val)
Description copied from interface: Unit
converts from an Object representing an actual value in the real units to an int.

Parameters:
val - a String representing an actual value in the real units
Returns:
an int in the abstract scale

fromString

public int fromString(java.lang.String s)
               throws java.text.ParseException
Description copied from class: CurrencyMapper
converts from a String (representing an actual value in the actual underlying currency) to BogoDollars.

Should be overridden if the Locale's parse method doesn't work correctly for this currency (e.g. fractious and fractional values)

Specified by:
fromString in interface Unit
Overrides:
fromString in class CurrencyMapper
Parameters:
s - a String representing an actual value in the real units
Returns:
an int in the abstract scale
java.text.ParseException

Documentation generated March 5 2003