|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.erights.e.elib.tables.EMap | +--org.erights.e.elib.tables.FlexMap
Safe: A modifiable map.
Field Summary | |
(package private) static long |
serialVersionUID
|
Fields inherited from class org.erights.e.elib.tables.EMap |
|
Fields inherited from interface org.erights.e.elib.serial.PassByProxy |
HONORARY, HONORED_NAMES |
Fields inherited from interface org.erights.e.elib.serial.Persistent |
HONORARY, HONORED_NAMES |
Constructor Summary | |
(package private) |
FlexMap()
Only subclasses within the package |
Method Summary | |
Object[] |
__optUncall()
Enabled: A FlexMap is unconditionally transparent |
void |
__printOn(TextWriter out)
Enabled: Prints using E language notation |
Object |
clone()
Suppressed: Arguments defaults to keyType() and valueType(). |
ESet |
domain()
Enabled: |
(package private) static FlexMap |
fromColumns(ConstList keys,
ConstList values)
Helps with a literal pattern, an array of keys and a matching array of values, as gotten from getColumn(). |
static FlexMap |
fromPairs(Object[][] pairs,
boolean strict)
Enabled: Helps with another convenient literal pattern, an array of key-element pairs. |
static FlexMap |
fromTypes(Class keyType,
Class valType)
Enabled: |
static FlexMap |
fromTypes(Class keyType,
Class valType,
int capacity)
Enabled: |
static FlexMap |
interning(Class valType)
Enabled: @see #interning(Class, int) |
static FlexMap |
interning(Class valType,
int capacity)
Enabled: The resulting table should optimize for the assumption that keys are typically interned, but should work regardless. |
static FlexMap |
make()
Enabled: |
static FlexMap |
make(int capacity)
Enabled: |
void |
put(Object key,
Object value)
Enabled: Like 'put' of three arguments, but defaults 'strict' to false. |
abstract void |
put(Object key,
Object value,
boolean strict)
Enabled: Causes 'key' to map to 'value'. |
void |
putAll(EMap other)
Enabled: Defaults 'strict' to false |
void |
putAll(EMap other,
boolean strict)
Enabled: Add all the associations of 'other' to this map. |
EMap |
readOnly()
Enabled: |
abstract void |
removeAll()
Enabled: Removes all associations from this map, leaving this map empty. |
void |
removeKey(Object key)
Enabled: Defaults 'strict' to false |
abstract void |
removeKey(Object key,
boolean strict)
Enabled: Removes the given key (or its equivalent, according to the equal function) from the collection. |
void |
removeKeys(EMap mask)
Enabled: defaults to not strict |
void |
removeKeys(EMap mask,
boolean strict)
Enabled: Remove from this map all associations whose key is in 'mask'. |
ConstMap |
snapshot()
Enabled: |
Methods inherited from class org.erights.e.elib.tables.EMap |
and, butNot, contains, diverge, diverge, extract, get, get, getKeys, getKeys, getPair, getPair, getValues, getValues, intersects, iterate, keyType, maps, optExtract, or, or, printOn, size, sortKeys, sortKeys, sortValues, sortValues, toString, valueType, with, without |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
static final long serialVersionUID
Constructor Detail |
FlexMap()
Method Detail |
public ConstMap snapshot()
snapshot
in class EMap
public EMap readOnly()
readOnly
in class EMap
public ESet domain()
domain
in class EMap
public void put(Object key, Object value)
public abstract void put(Object key, Object value, boolean strict)
Unlike Dictionary, this doesn't return the old value. If you want it, use 'get' first.
If the key is overwritten, then the key order is unchanged. If the key is novel, it's added to the end of the order.
NotSettledException
- if the key is not settledorg.erights.e.elib.ref.Ref#isSettled
public void putAll(EMap other)
public void putAll(EMap other, boolean strict)
The order of the original keys is unchanged. This order is followed by the novel keys in their order in 'other'.
public void removeKey(Object key)
public abstract void removeKey(Object key, boolean strict)
Unlike Dictionary, this does not return the old value. If you want this for a FlexMap, use 'get' first.
If 'key' wasn't in the table, the table (including its order) is unmodified. Otherwise, the last key in the table is moved in the ordering to take the place of the removed 'key'.
key
- the key to removepublic void removeKeys(EMap mask)
public void removeKeys(EMap mask, boolean strict)
The order is the original order modified by successive removals of keys in mask's order.
public abstract void removeAll()
Rather than doing a write-fault (which would make a private copy to be immediately dropped) this decrements the sharing count and re-initializes.
public Object clone()
clone
in class Object
java.lang.Cloneable
public Object[] __optUncall()
public void __printOn(TextWriter out) throws IOException
__printOn
in interface EPrintable
IOException
public static FlexMap make()
public static FlexMap make(int capacity)
public static FlexMap fromTypes(Class keyType, Class valType)
public static FlexMap fromTypes(Class keyType, Class valType, int capacity)
public static FlexMap interning(Class valType)
public static FlexMap interning(Class valType, int capacity)
A good strategy would be to use an IdentityKeyColumn internally, and first try looking up the presented key by identity. If this fails, intern the key and try again. Only interned keys would be stored. XXX We currently don't do any such optimization.
Were we to do this optimization, the interned keys may not ever be garbage collected. One would hope that Java's interning table were weak, but no where does it state this in the spec.
static FlexMap fromColumns(ConstList keys, ConstList values) throws ArityMismatchException
ArityMismatchException
public static FlexMap fromPairs(Object[][] pairs, boolean strict)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |