|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.util.ArrayCoreMap
public class ArrayCoreMap
Base implementation of CoreMap
backed by Java Arrays.
Reasonable care has been put into ensuring that this class is both fast and has a light memory footprint.
Note that like the base classes in the Collections API, this implementation is not thread-safe. For speed reasons, these methods are not synchronized. A synchronized wrapper could be developed by anyone so inclined.
Equality is defined over the complete set of keys and values currently stored in the map. Because this class is mutable, it should not be used as a key in a HashMap.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface edu.stanford.nlp.util.TypesafeMap |
---|
TypesafeMap.Key<BASE,VALUE> |
Constructor Summary | |
---|---|
ArrayCoreMap()
Default constructor - initializes with default initial annotation capacity of 4. |
|
ArrayCoreMap(ArrayCoreMap other)
Copy constructor. |
|
ArrayCoreMap(CoreMap other)
Copy constructor. |
|
ArrayCoreMap(int capacity)
Initializes this MapNLPObject, pre-allocating arrays to hold up to capacity key,value pairs. |
Method Summary | ||
---|---|---|
void |
compact()
Reduces memory consumption to the minimum for representing the values currently stored stored in this object. |
|
|
containsKey(Class<KEY> key)
Returns true if contains the given key. |
|
boolean |
equals(Object obj)
Two CoreMaps are equal iff all keys and values are .equal. |
|
|
get(Class<KEY> key)
Returns the value associated with the given key or null if none is provided. |
|
|
has(Class<KEY> key)
Returns true if the map contains the given key. |
|
int |
hashCode()
Returns a composite hashcode over all the keys and values currently stored in the map. |
|
Set<Class<?>> |
keySet()
Collection of keys currently held in this map. |
|
|
remove(Class<KEY> key)
Removes the given key from the map, returning the value removed. |
|
|
set(Class<KEY> key,
VALUE value)
Associates the given value with the given type for future calls to get. |
|
int |
size()
Returns the number of elements in this map. |
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ArrayCoreMap()
public ArrayCoreMap(int capacity)
capacity
- Initial capacity of object in key,value pairspublic ArrayCoreMap(ArrayCoreMap other)
other
- The ArrayCoreMap to copypublic ArrayCoreMap(CoreMap other)
other
- The ArrayCoreMap to copyMethod Detail |
---|
public <VALUE,KEY extends TypesafeMap.Key<CoreMap,VALUE>> VALUE get(Class<KEY> key)
get
in interface TypesafeMap<CoreMap>
public <VALUE,KEY extends TypesafeMap.Key<CoreMap,VALUE>> boolean has(Class<KEY> key)
has
in interface TypesafeMap<CoreMap>
public <VALUEBASE,VALUE extends VALUEBASE,KEY extends TypesafeMap.Key<CoreMap,VALUEBASE>> VALUE set(Class<KEY> key, VALUE value)
set
in interface TypesafeMap<CoreMap>
public Set<Class<?>> keySet()
keySet
in interface TypesafeMap<CoreMap>
public <VALUE,KEY extends TypesafeMap.Key<CoreMap,VALUE>> VALUE remove(Class<KEY> key)
remove
in interface TypesafeMap<CoreMap>
public <VALUE,KEY extends TypesafeMap.Key<CoreMap,VALUE>> boolean containsKey(Class<KEY> key)
containsKey
in interface TypesafeMap<CoreMap>
public void compact()
public int size()
size
in interface TypesafeMap<CoreMap>
public String toString()
toString
in class Object
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |