net.ontopia.utils
Class GrabberMap<O,KG,VG>

java.lang.Object
  extended by net.ontopia.utils.GrabberMap<O,KG,VG>
All Implemented Interfaces:
java.util.Map<KG,java.util.Collection<VG>>, CachedIF

public class GrabberMap<O,KG,VG>
extends java.lang.Object
implements java.util.Map<KG,java.util.Collection<VG>>, CachedIF

INTERNAL: An implementation of Map that uses a key grabber and a value grabber to extract its content.


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
protected  java.util.Collection<O> coll
           
protected  boolean grabbed
           
protected  java.util.Map<KG,java.util.Collection<VG>> grabbed_map
           
protected  GrabberIF<O,KG> key_grabber
           
protected  GrabberIF<O,VG> value_grabber
           
 
Constructor Summary
GrabberMap(java.util.Collection<O> coll, GrabberIF<O,KG> key_grabber, GrabberIF<O,VG> value_grabber)
           
 
Method Summary
 void clear()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
 java.util.Set entrySet()
           
 boolean equals(java.lang.Object o)
           
 java.util.Collection<VG> get(java.lang.Object key)
           
protected  java.util.Map<KG,java.util.Collection<VG>> getMap()
           
 java.util.Map<KG,java.util.Collection<VG>> getNestedMap()
           
 int hashCode()
           
 boolean isEmpty()
           
 java.util.Set keySet()
           
 java.util.Collection<VG> put(KG key, java.util.Collection<VG> value)
           
 void putAll(java.util.Map t)
           
 void refresh()
          Refreshes the map by looping over the nested collection and regrabbing keys and values.
 java.util.Collection<VG> remove(java.lang.Object key)
           
 void setNestedMap(java.util.Map<KG,java.util.Collection<VG>> map)
           
 int size()
           
 java.util.Collection values()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

coll

protected java.util.Collection<O> coll

key_grabber

protected GrabberIF<O,KG> key_grabber

value_grabber

protected GrabberIF<O,VG> value_grabber

grabbed_map

protected java.util.Map<KG,java.util.Collection<VG>> grabbed_map

grabbed

protected boolean grabbed
Constructor Detail

GrabberMap

public GrabberMap(java.util.Collection<O> coll,
                  GrabberIF<O,KG> key_grabber,
                  GrabberIF<O,VG> value_grabber)
Method Detail

getNestedMap

public java.util.Map<KG,java.util.Collection<VG>> getNestedMap()

setNestedMap

public void setNestedMap(java.util.Map<KG,java.util.Collection<VG>> map)

refresh

public void refresh()
Refreshes the map by looping over the nested collection and regrabbing keys and values. Any changes done to the previous collection will be lost.

Specified by:
refresh in interface CachedIF

getMap

protected java.util.Map<KG,java.util.Collection<VG>> getMap()

clear

public void clear()
Specified by:
clear in interface java.util.Map<KG,java.util.Collection<VG>>

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface java.util.Map<KG,java.util.Collection<VG>>

containsValue

public boolean containsValue(java.lang.Object value)
Specified by:
containsValue in interface java.util.Map<KG,java.util.Collection<VG>>

entrySet

public java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map<KG,java.util.Collection<VG>>

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Map<KG,java.util.Collection<VG>>
Overrides:
equals in class java.lang.Object

get

public java.util.Collection<VG> get(java.lang.Object key)
Specified by:
get in interface java.util.Map<KG,java.util.Collection<VG>>

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Map<KG,java.util.Collection<VG>>
Overrides:
hashCode in class java.lang.Object

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map<KG,java.util.Collection<VG>>

keySet

public java.util.Set keySet()
Specified by:
keySet in interface java.util.Map<KG,java.util.Collection<VG>>

put

public java.util.Collection<VG> put(KG key,
                                    java.util.Collection<VG> value)
Specified by:
put in interface java.util.Map<KG,java.util.Collection<VG>>

putAll

public void putAll(java.util.Map t)
Specified by:
putAll in interface java.util.Map<KG,java.util.Collection<VG>>

remove

public java.util.Collection<VG> remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map<KG,java.util.Collection<VG>>

size

public int size()
Specified by:
size in interface java.util.Map<KG,java.util.Collection<VG>>

values

public java.util.Collection values()
Specified by:
values in interface java.util.Map<KG,java.util.Collection<VG>>


Copyright © 2000-2012 Ontopia.