|
|||||||||||
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.AbstractHashMapToFreezables
This Map maps any Object as a key to a Freezable. It stores a mapping of keys to Freezables, and uses the Freezables to get the identifiers. Use this Map's subclasses when the Map has few entries, or when the application does not have time to go to the Freezer to get the Freezable.
Nested Class Summary | |
private class |
AbstractHashMapToFreezables.IDIterator
|
private class |
AbstractHashMapToFreezables.IteratorOfFreezables
|
Field Summary | |
private MutableMap |
keysToFreezables
|
Fields inherited from interface net.walend.collection.Map |
EMPTY |
Constructor Summary | |
protected |
AbstractHashMapToFreezables()
|
protected |
AbstractHashMapToFreezables(Identitor identitor)
|
protected |
AbstractHashMapToFreezables(Identitor identitor,
int capacity)
|
protected |
AbstractHashMapToFreezables(Identitor identitor,
int capacity,
float loadFactor)
|
protected |
AbstractHashMapToFreezables(int capacity)
|
protected |
AbstractHashMapToFreezables(int capacity,
float loadFactor)
|
protected |
AbstractHashMapToFreezables(Map map)
|
protected |
AbstractHashMapToFreezables(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. |
protected java.io.Serializable |
getIDForFreezable(Freezable freezy)
|
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 keysToFreezables
Constructor Detail |
protected AbstractHashMapToFreezables(Identitor identitor, int capacity, float loadFactor)
protected AbstractHashMapToFreezables(int capacity, float loadFactor)
protected AbstractHashMapToFreezables(Identitor identitor, int capacity)
protected AbstractHashMapToFreezables(int capacity)
protected AbstractHashMapToFreezables(Identitor identitor)
protected AbstractHashMapToFreezables()
protected AbstractHashMapToFreezables(Map map)
protected AbstractHashMapToFreezables(java.util.Map map)
Method Detail |
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 java.io.Serializable getIDForFreezable(Freezable freezy)
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 Freezer getFreezer()
protected Freezable getFreezableForID(java.io.Serializable id)
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 |