|
talx x1.0.5 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objecttalx.util.StringValueMap
Maps key strings to serializable values.
This class is immutable so that it can safely be broadcast without fear
of modification.
The complexity for get and put is O(log n) where n is the number of keys.
The complexity for getPairs is linear in the number of keys.
Although this map is thread-safe, multiple threads calling the put method
will change the complexity for put from O(log n) to O(n^2).
| Nested Class Summary | |
static class |
StringValueMap.Pair
Holder class for key-value pairs. |
| Field Summary | |
static java.lang.String |
ARRAY_END_TOKEN
|
static java.lang.String |
ARRAY_LIST_TOKEN
|
static java.lang.String |
ARRAY_START_TOKEN
|
static java.lang.String |
END_TOKEN
|
static java.lang.String |
LIST_TOKEN
|
static java.lang.String |
PAIR_END_TOKEN
|
static java.lang.String |
PAIR_MAP_TOKEN
|
static java.lang.String |
PAIR_START_TOKEN
|
static java.lang.String |
START_TOKEN
|
| Constructor Summary | |
StringValueMap()
Creates a StringValueMap with no mappings. |
|
StringValueMap(StringValueMap.Pair[] mappings)
Creates a StringValueMap with the given pairs. |
|
| Method Summary | |
static StringValueMap |
fromString(java.lang.String source)
Translates the results of the toString method back to a StringValueMap. |
java.io.Serializable |
get(java.lang.String key)
Returns the value associated with the key. |
StringValueMap.Pair[] |
getPairs()
Returns the entire set of key-value pairs. |
StringValueMap |
put(java.lang.String key,
java.io.Serializable value)
Returns a new StringValueMap that associates the value with the key. |
java.lang.String |
toString()
Creates a machine parseable string that represents this map. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.lang.String START_TOKEN
public static final java.lang.String END_TOKEN
public static final java.lang.String LIST_TOKEN
public static final java.lang.String PAIR_START_TOKEN
public static final java.lang.String PAIR_END_TOKEN
public static final java.lang.String PAIR_MAP_TOKEN
public static final java.lang.String ARRAY_START_TOKEN
public static final java.lang.String ARRAY_END_TOKEN
public static final java.lang.String ARRAY_LIST_TOKEN
| Constructor Detail |
public StringValueMap()
public StringValueMap(StringValueMap.Pair[] mappings)
| Method Detail |
public static StringValueMap fromString(java.lang.String source)
public StringValueMap put(java.lang.String key,
java.io.Serializable value)
public java.io.Serializable get(java.lang.String key)
public StringValueMap.Pair[] getPairs()
public java.lang.String toString()
S ::= START_TOKEN B END_TOKEN B ::= ε | L L ::= P | L LIST_TOKEN P P ::= PAIR_START_TOKEN K PAIR_MAP_TOKEN V PAIR_END_TOKEN V ::= S | A | P | K | null A ::= ARRAY_START_TOKEN ε ARRAY_END_TOKEN | ARRAY_START_TOKEN C ARRAY_END_TOKEN C ::= V | C ARRAY_LIST_TOKEN V K ::= arbitrary string of charactersObviously, the K production makes the grammar undecidable. So, the fromString method must assume that none of the string constants appear in the K production.
|
talx x1.0.5 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
© 2001-2005 University of Oregon.
Eugene OR 97403, U.S.A. All Rights Reserved.