|
Agent System POND 1.2 (28.2.2002) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--FIM.payment.Currency
A class representing a currency. Also includes a (fixed) conversion factor.
Includes a static list of the currencies available.
Currently includes Euro, ATS, DEM and US$
Field Summary | |
protected String[] |
abbrev
The list of abbreviations of the currency. |
protected static Vector |
currencies
The static list of currencies available. |
Constructor Summary | |
Currency(Element elem)
Creates a new currency object from values stored in an XML Element. |
|
Currency(String shortName,
String longName,
boolean pre,
String[] abbrev,
Locale loc,
double exchangeRate)
Creates a new currency object. |
Method Summary | |
(package private) static void |
Creates the four standard objects and adds them to the static list. |
static void |
addCurrency(Currency cur)
Adds a currency to the list. |
static void |
clearCurrencies()
Clears the list of all currencies. |
static int |
currenciesCount()
Retrieve the number of currencies in the list |
static int |
currencyPos(Currency cur)
Retrieve the index of a certain currency |
void |
decodeXMLElement(Element elem)
Parse back the currency from an XML element. |
boolean |
equals(Object obj)
Compares two currencies for equality. |
static Currency |
findCurrency(String str)
Finds the first currency equivalent to the string. |
String[] |
getAbbreviations()
Retrieve the abbreviations of this currency. |
Serializable |
getAsSerializable()
Retrieve the currency as a serializable (just returns this as this object is directly serializable). |
Element |
getAsXMLElement(Document doc)
Retrieve the currency as an XML element. |
static Currency[] |
getCurrencies()
Retrieve an array of all currencies available. |
double |
getExchangeRateToStandard()
Retrieve the exchange rate for this currency to the Euro. xxxx units of this currency are 1 Euro. |
Locale |
getLocale()
Retrieve the locale to be used for parsing values of this currency. |
String |
getLongName()
Retrieve the long name of this currency. |
String |
getShortName()
Retrieve the short name of this currency. |
boolean |
isPreValue()
Retrieve whether this currency is a prefix to the value (e. g. |
protected boolean |
matchString(String str)
Matches a string to the abbreviations for this currency (case-sensitive). |
double |
parseCurrencyValue(String str)
Parses the value from a string according to the currency ('.' or ',' as thousands-separator, ...). |
static void |
removeCurrency(Currency cur)
Removes a currency from the list. |
void |
setExchangeRateToStandard(double exchangeRate)
Set the exchange rate for this currency to the Euro. xxxx units of this currency are 1 Euro. |
String |
toString()
Returns a string representation of the object; in this case the short name of the currency. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected String[] abbrev
protected static Vector currencies
Constructor Detail |
public Currency(String shortName, String longName, boolean pre, String[] abbrev, Locale loc, double exchangeRate)
shortName
- the short name for the currencylongName
- the long name for the currencypre
- if true
, the currency is in front of the value, otherwise behindabbrev
- the list of abbreviations for this currency (may be empty or null
)loc
- the locale to use for parsing values in this currencyexchangeRate
- the exchange rate to 1 Euro (xxxx units of this currency are 1 Euro); provide 0.0 if not applicable or unknownpublic Currency(Element elem)
elem
- the XML element to parse the values fromIllegalArgumentException
- if the currency could not be parsed back completelyMethod Detail |
static void()
public void setExchangeRateToStandard(double exchangeRate)
exchangeRate
- the factor for conversion (msut be >=0.0)public double getExchangeRateToStandard()
public String[] getAbbreviations()
public String getShortName()
public String getLongName()
public Locale getLocale()
public boolean isPreValue()
true
if the currency text is in front of the valuepublic String toString()
toString
in interface XMLEncodeable
toString
in class Object
protected boolean matchString(String str)
str
- the string to matchtrue
if the string matches one of the abbrevationspublic static void addCurrency(Currency cur)
cur
- the currency to add.public static void removeCurrency(Currency cur)
cur
- the currency to removepublic static void clearCurrencies()
public static int currenciesCount()
public static int currencyPos(Currency cur)
cur
- the currency to findpublic static Currency[] getCurrencies()
an
- array of all currency-objects availablepublic static Currency findCurrency(String str)
str
- the string containing the value of the currency denominatornull
or the currency for the stringpublic double parseCurrencyValue(String str)
str
- the string containing the value to parsepublic boolean equals(Object obj)
equals
in class Object
obj
- the object this one to compare totrue
if both objects are equalpublic Serializable getAsSerializable()
this
as this object is directly serializable).getAsSerializable
in interface XMLEncodeable
public Element getAsXMLElement(Document doc)
getAsXMLElement
in interface XMLEncodeable
doc
- the document within which to create the elementpublic void decodeXMLElement(Element elem) throws IllegalArgumentException
decodeXMLElement
in interface XMLEncodeable
elem
- the element containing the currency to parse backIllegalArgumentException
- if the element is incorrect (e. g. wrong tag name)
|
Agent System POND 1.2 (28.2.2002) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |