|
|||||||||||
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 | +--org.erights.e.elib.tables.FlexMapImpl | +--org.erights.e.elib.tables.IntTable
Untamed: An optimization to provide a non-boxing protocol for int gets and puts.
XXX This class needs its own writeReplace() method.
Field Summary | |
static int |
DEFAULT_INIT_CAPACITY
Similarly, the default initial capacity of java.util.Hashtable is 101. |
static float |
DEFAULT_LOAD_FACTOR
This default load factor is calculated to preserve the same marginal space cost per hash map entry as java.util.Hashtable, given its default load factor of 0.75. |
(package private) KeyColumn |
myKeys
|
(package private) float |
myLoadFactor
The load factor for the map. |
(package private) ShareCount |
myShareCount
|
(package private) int |
mySizeThreshold
The current size threshold for the map, that is, the number of elements to hold before growing. |
(package private) Column |
myValues
|
(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 | |
|
IntTable()
Enabled: Reasonable defaults |
|
IntTable(Class keyType)
Enabled: Reasonable defaults |
private |
IntTable(KeyColumn keys)
Reasonable defaults |
private |
IntTable(KeyColumn keys,
Column values,
float loadFactor,
ShareCount shareCount)
JAY -- had to add this to clear up a foo2j bug where it was not finding constructor XXX Is this still necessary? --MarkM |
private |
IntTable(KeyColumn keys,
float loadFactor)
|
private |
IntTable(KeyColumn keys,
IntColumn values,
float loadFactor,
ShareCount shareCount)
|
Method Summary | |
Object |
clone()
Suppressed: |
FlexMap |
diverge(Class kType,
Class vType)
Unlike java.util.Hashtable, this part efficiently makes a lazy copy by copy-on-write sharing. |
Object |
get(Object key)
Returns the value to which the key is mapped in this map. |
Object |
get(Object key,
Object instead)
Returns the value to which the key is mapped in this map. |
int |
getInt(Object key)
Enabled: unboxed value optimization |
int |
getInt(Object key,
int instead)
Enabled: unboxed value optimization |
Object |
getKeys(Class type)
Enabled: Returns a divergent array-of-type of all the keys in order. |
Object |
getValues(Class type)
Enabled: Returns a divergent array-of-type of all the values in order. |
void |
iterate(AssocFunc func)
Enabled: Call 'func' with each key-value pair in the table, in order. |
Class |
keyType()
All keys in this map must be of this type |
boolean |
maps(Object key)
Returns true if the specified object is a key in the collection, as defined by the equality function of the collection. |
void |
put(Object key,
Object value,
boolean strict)
Enabled: Causes 'key' to map to 'value'. |
void |
putInt(Object key,
int value)
Enabled: unboxed value optimization |
void |
putInt(Object key,
int value,
boolean strict)
Enabled: unboxed value optimization |
(package private) void |
rehash()
|
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. |
void |
removeKey(Object key,
boolean strict)
Enabled: Removes the given key (or its equivalent, according to the equal function) from the collection. |
int |
size()
The number of keys in the collection |
Class |
valueType()
All values in this map must be of this type |
(package private) void |
writeFault()
|
Methods inherited from class org.erights.e.elib.tables.FlexMap |
__optUncall, __printOn, domain, fromColumns, fromPairs, fromTypes, fromTypes, interning, interning, make, make, put, putAll, putAll, readOnly, removeKey, removeKeys, removeKeys, snapshot |
Methods inherited from class org.erights.e.elib.tables.EMap |
and, butNot, contains, diverge, extract, getKeys, getPair, getPair, getValues, intersects, optExtract, or, or, printOn, sortKeys, sortKeys, sortValues, sortValues, toString, with, without |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
static final long serialVersionUID
public static final float DEFAULT_LOAD_FACTOR
public static final int DEFAULT_INIT_CAPACITY
KeyColumn myKeys
Column myValues
int mySizeThreshold
float myLoadFactor
ShareCount myShareCount
Constructor Detail |
public IntTable()
public IntTable(Class keyType)
private IntTable(KeyColumn keys)
private IntTable(KeyColumn keys, float loadFactor)
private IntTable(KeyColumn keys, Column values, float loadFactor, ShareCount shareCount)
private IntTable(KeyColumn keys, IntColumn values, float loadFactor, ShareCount shareCount)
Method Detail |
public Object clone()
clone
in class FlexMap
java.lang.Cloneable
public int getInt(Object key) throws IndexOutOfBoundsException
IndexOutOfBoundsException
org.erights.e.elib.tables.EMap#get
public int getInt(Object key, int instead)
org.erights.e.elib.tables.EMap#get
public void putInt(Object key, int value)
org.erights.e.elib.tables.FlexMap#put
public void putInt(Object key, int value, boolean strict)
org.erights.e.elib.tables.FlexMap#put
public Object get(Object key) throws IndexOutOfBoundsException
get
in class EMap
key
- nullOk;
IndexOutOfBoundsException
- if key doesn't map to anything.org.erights.e.elib.ref.Ref#isSettled
public Object get(Object key, Object instead)
get
in class EMap
key
- nullOk;instead
- nullOk;
org.erights.e.elib.ref.Ref#isSettled
public int size()
size
in class EMap
public void iterate(AssocFunc func)
EMap
iterate
in interface Iteratable
iterate
in class EMap
public boolean maps(Object key)
maps
in class EMap
key
- the object to look for
public Object getKeys(Class type)
EMap
XXX Should 'type' be a ValueGuard rather than a Class?
getKeys
in class EMap
public Object getValues(Class type)
EMap
XXX Should 'type' be a ValueGuard rather than a Class?
getValues
in class EMap
public void put(Object key, Object value, boolean strict)
FlexMap
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.
put
in class FlexMap
org.erights.e.elib.ref.Ref#isSettled
void rehash()
public void removeKey(Object key, boolean strict)
FlexMap
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'.
removeKey
in class FlexMap
key
- the key to removepublic void removeAll()
removeAll
in class FlexMap
public FlexMap diverge(Class kType, Class vType)
diverge
in class EMap
public Class keyType()
keyType
in class EMap
public Class valueType()
valueType
in class EMap
void writeFault()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |