CurrencyList class
Generated class containing all the CurrencyImpl instances. This is just the fallback in case the I18N module is not included.
class CurrencyList extends Iterable<CurrencyData> { /** * Return the singleton instance of CurrencyList. */ static CurrencyList get() { return CurrencyListInstance.instance; } /** * Add all entries in {@code override} to the original map, replacing * any existing entries. This is used by subclasses that need to slightly * alter the data used by the parent locale. */ //static JavaScriptObject overrideMap(JavaScriptObject original, JavaScriptObject override) /*-{ static Map overrideMap(Map original, Map override) { for (var key in override.keys) { // if (override.hasOwnProperty(key)) { original[key] = override[key]; // } } return original; } /** * Add currency codes contained in the map to an ArrayList. */ //static void loadCurrencyValuesNative(JavaScriptObject map, ArrayList<CurrencyData> collection) /*-{ // static void loadCurrencyValuesNative(Map map, List<CurrencyData> collection) { // for (var key in map.keys) { //// if (map.hasOwnProperty(key)) { // //collection.@java.util.ArrayList::add(Ljava/lang/Object;)(map[key]); // collection.add(map[key]); //// } // } // } /** * Directly reference an entry in the currency names map JSO. * * @param code ISO4217 currency code * @return currency name, or the currency code if not known */ //static String lookupNameNative(JavaScriptObject namesMap, String code) { // static String lookupNameNative(Map namesMap, String code) { // return namesMap[code] == null ? code : namesMap[code]; // } /** * Directly reference an entry in the currency map JSO. * * @param code ISO4217 currency code * @return currency data */ //static CurrencyData lookupNative(JavaScriptObject dataMap, String code) /*-{ // static CurrencyData lookupNative(Map dataMap, String code) { // return dataMap[code]; // } /** * Map of currency codes to CurrencyData. */ Map<String, CurrencyData> dataMapJava; /** * JS map of currency codes to CurrencyData objects. Each currency code is * assumed to be a valid JS object key. */ //JavaScriptObject dataMapNative; // Map dataMapNative; /** * Map of currency codes to localized currency names. This is kept separate * from {@link #dataMapJava} above so that the names can be completely removed by * the compiler if they are not used. */ Map<String, String> namesMapJava; /** * JS map of currency codes to localized currency names. This is kept separate * from {@link #dataMapNative} above so that the names can be completely * removed by the compiler if they are not used. Each currency code is assumed * to be a valid JS object key. */ //JavaScriptObject namesMapNative; // Map namesMapNative; /** * Return the default currency data for this locale. * * Generated implementations override this method. */ CurrencyData getDefault() { // if (GWT.isScript()) { // return getDefaultNative(); // } else { return getDefaultJava(); // } } /** * Returns an iterator for the list of currencies, optionally including * deprecated ones. * * @param includeDeprecated true if deprecated currencies should be included */ Iterator<CurrencyData> get iterator { bool includeDeprecated = false; ensureCurrencyMap(); List<CurrencyData> collection = new List<CurrencyData>(); // if (GWT.isScript()) { // loadCurrencyValuesNative(dataMapNative, collection); // } else { for (CurrencyData item in dataMapJava.values) { collection.add(item); } // } if (!includeDeprecated) { List<CurrencyData> newCollection = new List<CurrencyData>(); for (CurrencyData value in collection) { if (!value.isDeprecated()) { newCollection.add(value); } } collection = newCollection; } //return Collections.unmodifiableList(collection).iterator(); return collection.iterator; } /** * Lookup a currency based on the ISO4217 currency code. * * @param currencyCode ISO4217 currency code * @return currency data, or null if code not found */ CurrencyData lookup(String currencyCode) { ensureCurrencyMap(); // if (GWT.isScript()) { // return lookupNative(dataMapNative, currencyCode); // } else { return dataMapJava[currencyCode]; // } } /** * Lookup a currency name based on the ISO4217 currency code. * * @param currencyCode ISO4217 currency code * @return name of the currency, or null if code not found */ String lookupName(String currencyCode) { ensureNamesMap(); // if (GWT.isScript()) { // return lookupNameNative(namesMapNative, currencyCode); // } else { String result = namesMapJava[currencyCode]; return (result == null) ? currencyCode : result; // } } /** * Return the default currency data for this locale. * * Generated implementations override this method. */ CurrencyData getDefaultJava() { return new CurrencyDataImpl("USD", "\$", 2, "US\$", "\$"); } /** * Return the default currency data for this locale. * * Generated implementations override this method. */ // CurrencyData getDefaultNative() { // return [ "USD", "$", 2, "US$" ]; // } /** * Loads the currency map. * * Generated implementations override this method. */ Map<String, CurrencyData> loadCurrencyMapJava() { Map<String, CurrencyData> result = { "USD": new CurrencyDataImpl("USD", "\$", 2, "US\$", "\$"), "EUR": new CurrencyDataImpl("EUR", "€", 2, "€", "€"), "GBP": new CurrencyDataImpl("GBP", "UK£", 2, "UK£", "£"), "JPY": new CurrencyDataImpl("JPY", "¥", 0, "JP¥", "¥") }; return result; } /** * Loads the currency map from a JS object literal. * * Generated implementations override this method. */ //JavaScriptObject loadCurrencyMapNative() { // Map loadCurrencyMapNative() { // return { // "USD": [ "USD", "\$", 2 ], // "EUR": [ "EUR", "€", 2 ], // "GBP": [ "GBP", "UK£", 2 ], // "JPY": [ "JPY", "¥", 0 ], // }; // } /** * Loads the currency names map. * * Generated implementations override this method. */ Map<String, String> loadNamesMapJava() { Map<String, String> result = { "USD": "US Dollar", "EUR": "Euro", "GBP": "British Pound Sterling", "JPY": "Japanese Yen"}; return result; } /** * Loads the currency names map from a JS object literal. * * Generated implementations override this method. */ //JavaScriptObject loadNamesMapNative() /*-{ // Map loadNamesMapNative() { // return { // "USD": "US Dollar", // "EUR": "Euro", // "GBP": "British Pound Sterling", // "JPY": "Japanese Yen", // }; // } /** * Ensure that the map of currency data has been initialized. */ void ensureCurrencyMap() { // if (GWT.isScript()) { // if (dataMapNative == null) { // dataMapNative = loadCurrencyMapNative(); // } // } else { if (dataMapJava == null) { dataMapJava = loadCurrencyMapJava(); } // } } /** * Ensure that the map of currency data has been initialized. */ void ensureNamesMap() { // if (GWT.isScript()) { // if (namesMapNative == null) { // namesMapNative = loadNamesMapNative(); // } // } else { if (namesMapJava == null) { namesMapJava = loadNamesMapJava(); } // } } //********************** int get length { throw new UnsupportedError("");} bool contains(CurrencyData element) { throw new UnsupportedError("");} bool get isEmpty { throw new UnsupportedError("");} bool get isNotEmpty { throw new UnsupportedError("");} CurrencyData get first { throw new UnsupportedError("");} CurrencyData get last { throw new UnsupportedError("");} CurrencyData get single { throw new UnsupportedError("");} Iterable map(f(CurrencyData element)) { throw new UnsupportedError("");} Iterable<CurrencyData> where(bool f(CurrencyData element)) { throw new UnsupportedError("");} Iterable expand(Iterable f(CurrencyData element)) { throw new UnsupportedError("");} void forEach(void f(CurrencyData element)) { throw new UnsupportedError("");} CurrencyData reduce(CurrencyData combine(CurrencyData value, CurrencyData element)) { throw new UnsupportedError("");} dynamic fold(var initialValue, dynamic combine(var previousValue, CurrencyData element)) { throw new UnsupportedError("");} bool every(bool f(CurrencyData element)) { throw new UnsupportedError("");} bool any(bool f(CurrencyData element)) { throw new UnsupportedError("");} List<CurrencyData> toList({ bool growable: true }) { throw new UnsupportedError("");} Set<CurrencyData> toSet() { throw new UnsupportedError("");} Iterable<CurrencyData> take(int n) { throw new UnsupportedError("");} Iterable<CurrencyData> takeWhile(bool test(CurrencyData value)) { throw new UnsupportedError("");} Iterable<CurrencyData> skip(int n) { throw new UnsupportedError("");} Iterable<CurrencyData> skipWhile(bool test(CurrencyData value)) { throw new UnsupportedError("");} CurrencyData firstWhere(bool test(CurrencyData value), { CurrencyData orElse() }) { throw new UnsupportedError("");} CurrencyData lastWhere(bool test(CurrencyData value), {CurrencyData orElse()}) { throw new UnsupportedError("");} CurrencyData singleWhere(bool test(CurrencyData value)) { throw new UnsupportedError("");} CurrencyData elementAt(int index) { throw new UnsupportedError("");} }
Extends
Iterable<CurrencyData> > CurrencyList
Static Methods
CurrencyList get() #
Return the singleton instance of CurrencyList.
static CurrencyList get() { return CurrencyListInstance.instance; }
Map overrideMap(Map original, Map override) #
Add all entries in {@code override} to the original map, replacing any existing entries. This is used by subclasses that need to slightly alter the data used by the parent locale.
static Map overrideMap(Map original, Map override) { for (var key in override.keys) { // if (override.hasOwnProperty(key)) { original[key] = override[key]; // } } return original; }
Properties
Map<String, CurrencyData> dataMapJava #
Add currency codes contained in the map to an ArrayList.
/ if (map.hasOwnProperty(key)) { / }
Directly reference an entry in the currency names map JSO.
@param code ISO4217 currency code @return currency name, or the currency code if not known
Directly reference an entry in the currency map JSO.
@param code ISO4217 currency code @return currency data
Map of currency codes to CurrencyData.
Map<String, CurrencyData> dataMapJava
final CurrencyData first #
Returns the first element.
If this
is empty throws a StateError. Otherwise this method is
equivalent to this.elementAt(0)
CurrencyData get first { throw new UnsupportedError("");}
final bool isEmpty #
Returns true if there is no element in this collection.
bool get isEmpty { throw new UnsupportedError("");}
final bool isNotEmpty #
Returns true if there is at least one element in this collection.
bool get isNotEmpty { throw new UnsupportedError("");}
final Iterator<CurrencyData> iterator #
Returns an iterator for the list of currencies, optionally including deprecated ones.
@param includeDeprecated true if deprecated currencies should be included
Iterator<CurrencyData> get iterator { bool includeDeprecated = false; ensureCurrencyMap(); List<CurrencyData> collection = new List<CurrencyData>(); // if (GWT.isScript()) { // loadCurrencyValuesNative(dataMapNative, collection); // } else { for (CurrencyData item in dataMapJava.values) { collection.add(item); } // } if (!includeDeprecated) { List<CurrencyData> newCollection = new List<CurrencyData>(); for (CurrencyData value in collection) { if (!value.isDeprecated()) { newCollection.add(value); } } collection = newCollection; } //return Collections.unmodifiableList(collection).iterator(); return collection.iterator; }
final CurrencyData last #
Returns the last element.
If this
is empty throws a StateError.
CurrencyData get last { throw new UnsupportedError("");}
final int length #
Returns the number of elements in this
.
Counting all elements may be involve running through all elements and can therefore be slow.
int get length { throw new UnsupportedError("");}
Map<String, String> namesMapJava #
JS map of currency codes to CurrencyData objects. Each currency code is assumed to be a valid JS object key.
Map of currency codes to localized currency names. This is kept separate from {@link #dataMapJava} above so that the names can be completely removed by the compiler if they are not used.
Map<String, String> namesMapJava
final CurrencyData single #
Returns the single element in this
.
If this
is empty or has more than one element throws a StateError.
CurrencyData get single { throw new UnsupportedError("");}
Methods
bool any(bool f(CurrencyData element)) #
Returns true if one element of this collection satisfies the
predicate test
. Returns false otherwise.
bool any(bool f(CurrencyData element)) { throw new UnsupportedError("");}
bool contains(CurrencyData element) #
Returns true if the collection contains an element equal to element.
bool contains(CurrencyData element) { throw new UnsupportedError("");}
CurrencyData elementAt(int index) #
Returns the indexth element.
If this
has fewer than
index elements throws a RangeError.
Note: if this
does not have a deterministic iteration order then the
function may simply return any element without any iteration if there are
at least
index elements in this
.
CurrencyData elementAt(int index) { throw new UnsupportedError("");}
void ensureCurrencyMap() #
Loads the currency names map from a JS object literal.
Generated implementations override this method.
Ensure that the map of currency data has been initialized.
void ensureCurrencyMap() { // if (GWT.isScript()) { // if (dataMapNative == null) { // dataMapNative = loadCurrencyMapNative(); // } // } else { if (dataMapJava == null) { dataMapJava = loadCurrencyMapJava(); } // } }
void ensureNamesMap() #
Ensure that the map of currency data has been initialized.
void ensureNamesMap() { // if (GWT.isScript()) { // if (namesMapNative == null) { // namesMapNative = loadNamesMapNative(); // } // } else { if (namesMapJava == null) { namesMapJava = loadNamesMapJava(); } // } }
bool every(bool f(CurrencyData element)) #
Returns true if every elements of this collection satisify the
predicate test
. Returns false
otherwise.
bool every(bool f(CurrencyData element)) { throw new UnsupportedError("");}
Iterable expand(Iterable f(CurrencyData element)) #
Expands each element of this Iterable into zero or more elements.
The resulting Iterable runs through the elements returned by f for each element of this, in order.
The returned Iterable is lazy, and calls f for each element of this every time it's iterated.
Iterable expand(Iterable f(CurrencyData element)) { throw new UnsupportedError("");}
CurrencyData firstWhere(bool test(CurrencyData value), {CurrencyData orElse()}) #
Returns the first element that satisfies the given predicate test.
If none matches, the result of invoking the
orElse function is
returned. By default, when
orElse is null
, a StateError is
thrown.
CurrencyData firstWhere(bool test(CurrencyData value), { CurrencyData orElse() }) { throw new UnsupportedError("");}
dynamic fold(initialValue, combine(previousValue, CurrencyData element)) #
Reduces a collection to a single value by iteratively combining each element of the collection with an existing value using the provided function.
Use initialValue as the initial value, and the function combine to create a new value from the previous one and an element.
Example of calculating the sum of an iterable:
iterable.fold(0, (prev, element) => prev + element);
dynamic fold(var initialValue, dynamic combine(var previousValue, CurrencyData element)) { throw new UnsupportedError("");}
void forEach(void f(CurrencyData element)) #
Applies the function f to each element of this collection.
void forEach(void f(CurrencyData element)) { throw new UnsupportedError("");}
CurrencyData getDefault() #
JS map of currency codes to localized currency names. This is kept separate from {@link #dataMapNative} above so that the names can be completely removed by the compiler if they are not used. Each currency code is assumed to be a valid JS object key.
Return the default currency data for this locale.
Generated implementations override this method.
CurrencyData getDefault() { // if (GWT.isScript()) { // return getDefaultNative(); // } else { return getDefaultJava(); // } }
CurrencyData getDefaultJava() #
Return the default currency data for this locale.
Generated implementations override this method.
CurrencyData getDefaultJava() { return new CurrencyDataImpl("USD", "\$", 2, "US\$", "\$"); }
String join([String separator = ""]) #
Converts each element to a String and concatenates the strings.
Converts each element to a String by calling Object.toString on it. Then concatenates the strings, optionally separated by the separator string.
String join([String separator = ""]) { StringBuffer buffer = new StringBuffer(); buffer.writeAll(this, separator); return buffer.toString(); }
CurrencyData lastWhere(bool test(CurrencyData value), {CurrencyData orElse()}) #
Returns the last element that satisfies the given predicate test.
If none matches, the result of invoking the
orElse function is
returned. By default, when
orElse is null
, a StateError is
thrown.
CurrencyData lastWhere(bool test(CurrencyData value), {CurrencyData orElse()}) { throw new UnsupportedError("");}
Map<String, CurrencyData> loadCurrencyMapJava() #
Return the default currency data for this locale.
Generated implementations override this method.
Loads the currency map.
Generated implementations override this method.
Map<String, CurrencyData> loadCurrencyMapJava() { Map<String, CurrencyData> result = { "USD": new CurrencyDataImpl("USD", "\$", 2, "US\$", "\$"), "EUR": new CurrencyDataImpl("EUR", "€", 2, "€", "€"), "GBP": new CurrencyDataImpl("GBP", "UK£", 2, "UK£", "£"), "JPY": new CurrencyDataImpl("JPY", "¥", 0, "JP¥", "¥") }; return result; }
Map<String, String> loadNamesMapJava() #
Loads the currency map from a JS object literal.
Generated implementations override this method.
Loads the currency names map.
Generated implementations override this method.
Map<String, String> loadNamesMapJava() { Map<String, String> result = { "USD": "US Dollar", "EUR": "Euro", "GBP": "British Pound Sterling", "JPY": "Japanese Yen"}; return result; }
CurrencyData lookup(String currencyCode) #
Lookup a currency based on the ISO4217 currency code.
@param currencyCode ISO4217 currency code @return currency data, or null if code not found
CurrencyData lookup(String currencyCode) { ensureCurrencyMap(); // if (GWT.isScript()) { // return lookupNative(dataMapNative, currencyCode); // } else { return dataMapJava[currencyCode]; // } }
String lookupName(String currencyCode) #
Lookup a currency name based on the ISO4217 currency code.
@param currencyCode ISO4217 currency code @return name of the currency, or null if code not found
String lookupName(String currencyCode) { ensureNamesMap(); // if (GWT.isScript()) { // return lookupNameNative(namesMapNative, currencyCode); // } else { String result = namesMapJava[currencyCode]; return (result == null) ? currencyCode : result; // } }
Iterable map(f(CurrencyData element)) #
Returns a lazy Iterable where each element e
of this
is replaced
by the result of f(e)
.
This method returns a view of the mapped elements. As long as the returned Iterable is not iterated over, the supplied function f will not be invoked. The transformed elements will not be cached. Iterating multiple times over the the returned Iterable will invoke the supplied function f multiple times on the same element.
Iterable map(f(CurrencyData element)) { throw new UnsupportedError("");}
CurrencyData reduce(CurrencyData combine(CurrencyData value, CurrencyData element)) #
Reduces a collection to a single value by iteratively combining elements of the collection using the provided function.
Example of calculating the sum of an iterable:
iterable.reduce((value, element) => value + element);
CurrencyData reduce(CurrencyData combine(CurrencyData value, CurrencyData element)) { throw new UnsupportedError("");}
CurrencyData singleWhere(bool test(CurrencyData value)) #
Returns the single element that satisfies test. If no or more than one element match then a StateError is thrown.
CurrencyData singleWhere(bool test(CurrencyData value)) { throw new UnsupportedError("");}
Iterable<CurrencyData> skip(int n) #
Returns an Iterable that skips the first n elements.
If this
has fewer than
n elements, then the resulting Iterable is
empty.
It is an error if n is negative.
Iterable<CurrencyData> skip(int n) { throw new UnsupportedError("");}
Iterable<CurrencyData> skipWhile(bool test(CurrencyData value)) #
Returns an Iterable that skips elements while test is satisfied.
The filtering happens lazily. Every new Iterator of the returned
Iterable iterates over all elements of this
.
As long as the iterator's elements satisfy
test they are
discarded. Once an element does not satisfy the
test the iterator stops
testing and uses every later element unconditionally. That is, the elements
of the returned Iterable are the elements of this
starting from the
first element that does not satisfy
test.
Iterable<CurrencyData> skipWhile(bool test(CurrencyData value)) { throw new UnsupportedError("");}
Iterable<CurrencyData> take(int n) #
Returns an Iterable with at most n elements.
The returned Iterable may contain fewer than
n elements, if this
contains fewer than
n elements.
It is an error if n is negative.
Iterable<CurrencyData> take(int n) { throw new UnsupportedError("");}
Iterable<CurrencyData> takeWhile(bool test(CurrencyData value)) #
Returns an Iterable that stops once test is not satisfied anymore.
The filtering happens lazily. Every new Iterator of the returned
Iterable starts iterating over the elements of this
.
When the iterator encounters an element e
that does not satisfy
test,
it discards e
and moves into the finished state. That is, it does not
get or provide any more elements.
Iterable<CurrencyData> takeWhile(bool test(CurrencyData value)) { throw new UnsupportedError("");}
List<CurrencyData> toList({bool growable: true}) #
Creates a List containing the elements of this Iterable.
The elements are in iteration order. The list is fixed-length if growable is false.
List<CurrencyData> toList({ bool growable: true }) { throw new UnsupportedError("");}
Set<CurrencyData> toSet() #
Creates a Set containing the elements of this Iterable.
Set<CurrencyData> toSet() { throw new UnsupportedError("");}
Iterable<CurrencyData> where(bool f(CurrencyData element)) #
Returns a lazy Iterable with all elements that satisfy the
predicate test
.
This method returns a view of the mapped elements. As long as the
returned Iterable is not iterated over, the supplied function test
will
not be invoked. Iterating will not cache results, and thus iterating
multiple times over the returned Iterable will invoke the supplied
function test
multiple times on the same element.
Iterable<CurrencyData> where(bool f(CurrencyData element)) { throw new UnsupportedError("");}