
public class CurrencyCounter extends Object implements Serializable
Note:
This class is not synchronized and must not be used concurrently without external
synchronization.
| Constructor and Description |
|---|
CurrencyCounter() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Currency currency)
Adds to the counter of a currency.
|
Currency[] |
getCurrencies()
Gets the currencies for which the instance holds counters.
|
long |
getValue(Currency currency)
Gets the value of the counter for a given
Currency. |
void |
substract(Currency currency)
Substracts from the counter of a currency.
|
public CurrencyCounter()
public void add(Currency currency)
currency - The currency to add to.NullPointerException - if currency is null.IndexOutOfBoundsException - if the value of the counter of currency is equal to
Long.MAX_VALUE.public Currency[] getCurrencies()
public long getValue(Currency currency)
Currency.currency - The currency to return the value of the counter for.currency.NullPointerException - if currency is null.public void substract(Currency currency)
currency - The currency to substract from.NullPointerException - if currency is null.IndexOutOfBoundsException - if the value of the counter of currency is equal to zero.Copyright © 2005–2014 jDTAUS. All rights reserved.