|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.walend.lyophil.collection.AbstractFreezerHashMap
This Map maps any Object as a key to a Freezable. It stores a mapping of keys to identifiers and uses a Freezer to get the Freezables. Use this class's subclasses when you don't want to store all of the Freezables in local memory, and have time to go back to the Freezer to thaw them.
Field Summary | |
private MutableMap |
keysToIdentifiers
|
Fields inherited from interface net.walend.collection.Map |
EMPTY |
Constructor Summary | |
protected |
AbstractFreezerHashMap()
|
protected |
AbstractFreezerHashMap(Identitor identitor)
|
protected |
AbstractFreezerHashMap(Identitor identitor,
int capacity)
|
protected |
AbstractFreezerHashMap(Identitor identitor,
int capacity,
float loadFactor)
|
protected |
AbstractFreezerHashMap(int capacity)
|
protected |
AbstractFreezerHashMap(int capacity,
float loadFactor)
|
protected |
AbstractFreezerHashMap(Map map)
|
protected |
AbstractFreezerHashMap(java.util.Map map)
|
Method Summary | |
protected void |
clear()
Removes all key, value pairs from this Map. |
boolean |
containsAll(Map c)
Returns true if this collection contains all of the Objects in the specified collection. |
boolean |
containsIdentifier(java.io.Serializable identifier)
Returns true if one of the keys in the map is associated with identifier. |
boolean |
containsKey(java.lang.Object key)
Returns true if this map contains an entry for key. |
boolean |
containsValue(java.lang.Object value)
Returns true if this map contains value. |
java.lang.Object |
get(java.lang.Object key)
Returns the value for the key. |
Collection |
getdentifiers()
Returns a collection of all the identifiers. |
protected Freezable |
getFreezableForID(java.io.Serializable id)
|
protected Freezer |
getFreezer()
|
java.io.Serializable |
getIdentifier(java.lang.Object key)
Returns the idetnifier associated with key, or null if no identifier is associated with the key. |
Identitor |
getIdentitor()
Returns the Identitor for this Map. |
java.util.Map |
getJavaMap()
Return a java.util.Collection of these Objects. |
Set |
getKeys()
Returns an immutable shallow copy of the Set of keys. |
java.lang.Class |
getPrincipleInterface()
Returns the class's principle interface for state comparisons. |
Collection |
getValues()
Returns an immutable shallow copy of the Collection of values. |
java.util.Iterator |
identifierIterator()
Returns an iterator over the identifiers. |
boolean |
isEmpty()
Returns true if this Map has no entries. |
java.util.Iterator |
keyIterator()
Returns an iterator over the keys. |
Map |
keysToIdentifiers()
Creates a new Map which maps the keys to their identifiers. |
protected java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
protected void |
putAll(Map map)
|
protected void |
putAllIdentifiers(Map map)
|
protected java.lang.Object |
putIdentifier(java.lang.Object key,
java.io.Serializable identifier)
|
protected java.lang.Object |
remove(java.lang.Object key)
Removes the key, value pair from this Map. |
boolean |
sameContentsAs(Map c)
Returns true if this Collection's contents are equal to c's. |
boolean |
sameStateAs(HasState victem)
If two HasStates have the same internal state, return true. |
int |
size()
Returns the number of key-value pairs in this map. |
java.lang.String |
toString()
|
FreezableIterator |
valueFreezableIterator()
Returns a FreezableIterator over the values so that you can work with both identifiers and Freezables. |
java.util.Iterator |
valueIterator()
Returns an iterator over the values. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private MutableMap keysToIdentifiers
Constructor Detail |
protected AbstractFreezerHashMap(Identitor identitor, int capacity, float loadFactor)
protected AbstractFreezerHashMap(int capacity, float loadFactor)
protected AbstractFreezerHashMap(Identitor identitor, int capacity)
protected AbstractFreezerHashMap(int capacity)
protected AbstractFreezerHashMap(Identitor identitor)
protected AbstractFreezerHashMap()
protected AbstractFreezerHashMap(Map map)
protected AbstractFreezerHashMap(java.util.Map map)
Method Detail |
protected Freezer getFreezer()
public Identitor getIdentitor()
getIdentitor
in interface Map
public int size()
size
in interface Map
public boolean isEmpty()
isEmpty
in interface Map
public boolean containsKey(java.lang.Object key)
containsKey
in interface Map
java.lang.NullPointerException
- if key is null.public boolean containsValue(java.lang.Object value)
containsValue
in interface Map
java.lang.NullPointerException
- if value is null.protected Freezable getFreezableForID(java.io.Serializable id)
public java.lang.Object get(java.lang.Object key)
get
in interface Map
java.lang.NullPointerException
- if the key is null.public Set getKeys()
getKeys
in interface Map
public Collection getValues()
getValues
in interface Map
public java.util.Iterator keyIterator()
keyIterator
in interface Map
public java.util.Iterator valueIterator()
valueIterator
in interface Map
public boolean containsAll(Map c)
containsAll
in interface Map
public boolean sameContentsAs(Map c)
sameContentsAs
in interface Map
public java.util.Map getJavaMap()
getJavaMap
in interface Map
public boolean containsIdentifier(java.io.Serializable identifier)
MapToFreezables
containsIdentifier
in interface MapToFreezables
public java.io.Serializable getIdentifier(java.lang.Object key)
MapToFreezables
getIdentifier
in interface MapToFreezables
public Collection getdentifiers()
MapToFreezables
getdentifiers
in interface MapToFreezables
public java.util.Iterator identifierIterator()
MapToFreezables
identifierIterator
in interface MapToFreezables
public Map keysToIdentifiers()
MapToFreezables
keysToIdentifiers
in interface MapToFreezables
protected java.lang.Object put(java.lang.Object key, java.lang.Object value)
protected java.lang.Object remove(java.lang.Object key)
java.lang.NullPointerException
- if the key is null.protected void putAll(Map map)
protected void clear()
protected java.lang.Object putIdentifier(java.lang.Object key, java.io.Serializable identifier)
protected void putAllIdentifiers(Map map)
public FreezableIterator valueFreezableIterator()
valueFreezableIterator
in interface MapToFreezables
public java.lang.Class getPrincipleInterface()
getPrincipleInterface
in interface HasState
public boolean sameStateAs(HasState victem)
For objects with subobjects, Generally this method should only return true if the internal objects are equal. Implement a contentsHaveSameState() method to determine if the contents have the same state.
sameStateAs
in interface HasState
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |