|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.stanford.nlp.util.TwoDimensionalCollectionValuedMap<K1,K2,V>
public class TwoDimensionalCollectionValuedMap<K1,K2,V>
A class which can store mappings from Object keys to Collections of Object values.
Important methods are the add(K1, K2, V) and for adding a value
to/from the Collection associated with the key, and the get(K1, K2) method for
getting the Collection associated with a key.
The class is quite general, because on construction, it is possible to pass a MapFactory
which will be used to create the underlying map and a CollectionFactory which will
be used to create the Collections. Thus this class can be configured to act like a "HashSetValuedMap"
or a "ListValuedMap", or even a "HashSetValuedIdentityHashMap". The possibilities are endless!
| Field Summary | |
|---|---|
protected CollectionFactory<V> |
cf
|
protected MapFactory<K2,java.util.Collection<V>> |
mf
|
| Constructor Summary | |
|---|---|
TwoDimensionalCollectionValuedMap()
Creates a new empty TwoDimensionalCollectionValuedMap which uses a HashMap as the underlying Map, and HashSets as the Collections in each mapping. |
|
TwoDimensionalCollectionValuedMap(CollectionFactory<V> cf)
Creates a new empty TwoDimensionalCollectionValuedMap which uses a HashMap as the underlying Map. |
|
TwoDimensionalCollectionValuedMap(MapFactory<K2,java.util.Collection<V>> mf,
CollectionFactory<V> cf)
Creates a new empty TwoDimensionalCollectionValuedMap. |
|
TwoDimensionalCollectionValuedMap(MapFactory<K2,java.util.Collection<V>> mf,
CollectionFactory<V> cf,
boolean treatCollectionsAsImmutable)
Creates a new empty TwoDimensionalCollectionValuedMap. |
|
| Method Summary | |
|---|---|
void |
add(K1 key1,
K2 key2,
java.util.Collection<V> value)
Adds a collection of values to the Collection mapped to by the key. |
void |
add(K1 key1,
K2 key2,
V value)
Adds the value to the Collection mapped to by the key. |
void |
addKey(K1 key1)
yes, this is a weird method, but i need it. |
void |
clear()
|
boolean |
containsKey(K1 key)
|
java.util.Set<java.util.Map.Entry<K1,CollectionValuedMap<K2,V>>> |
entrySet()
|
java.util.Set<K1> |
firstKeySet()
|
java.util.Collection<V> |
get(K1 key1,
K2 key2)
|
CollectionValuedMap<K2,V> |
getCollectionValuedMap(K1 key1)
|
java.util.Set<K1> |
keySet()
|
void |
retainAll(java.util.Set<K1> keys)
|
java.util.Set<K2> |
secondKeySet()
|
java.lang.String |
toString()
|
java.util.Collection<V> |
values()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected MapFactory<K2,java.util.Collection<V>> mf
protected CollectionFactory<V> cf
| Constructor Detail |
|---|
public TwoDimensionalCollectionValuedMap()
public TwoDimensionalCollectionValuedMap(CollectionFactory<V> cf)
cf - a CollectionFactory which will be used to generate the
Collections in each mapping
public TwoDimensionalCollectionValuedMap(MapFactory<K2,java.util.Collection<V>> mf,
CollectionFactory<V> cf)
mf - a MapFactory which will be used to generate the underlying Mapcf - a CollectionFactory which will be used to generate the Collections in each mapping
public TwoDimensionalCollectionValuedMap(MapFactory<K2,java.util.Collection<V>> mf,
CollectionFactory<V> cf,
boolean treatCollectionsAsImmutable)
mf - a MapFactory which will be used to generate the underlying Mapcf - a CollectionFactory which will be used to generate the Collections in each mappingtreatCollectionsAsImmutable - if true, forces this Map to create new a Collection everytime
a new value is added to or deleted from the Collection a mapping.| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Objectpublic CollectionValuedMap<K2,V> getCollectionValuedMap(K1 key1)
public java.util.Collection<V> get(K1 key1,
K2 key2)
public void add(K1 key1,
K2 key2,
V value)
public void add(K1 key1,
K2 key2,
java.util.Collection<V> value)
public void addKey(K1 key1)
public void clear()
public java.util.Set<K1> keySet()
public java.util.Set<java.util.Map.Entry<K1,CollectionValuedMap<K2,V>>> entrySet()
public boolean containsKey(K1 key)
public void retainAll(java.util.Set<K1> keys)
public java.util.Set<K1> firstKeySet()
public java.util.Set<K2> secondKeySet()
public java.util.Collection<V> values()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||