|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap<K,Object>
danbikel.util.AbstractMapToPrimitive<K>
public abstract class AbstractMapToPrimitive<K>
This class and its associated inner class provide templates for easily
creating implementations of maps to primitive types, by implementing
all primitive-specific methods to throw an
UnsupportedOperationException
. In this way, concrete
subclasses need only implement methods for the primitives they support.
Nested Class Summary | |
---|---|
static class |
AbstractMapToPrimitive.Entry<K>
Provides convenient abstract implementation of the MapToPrimitive.Entry interface: all primitive-specific
methods are implemented to throw an
UnsupportedOperationException . |
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
Constructor Summary | |
---|---|
AbstractMapToPrimitive()
|
Method Summary | |
---|---|
void |
add(K key,
byte addend)
Adds the specified addend to the byte value (at index 0)
associated with the specified key, or if no mapping previously existed
for the specified key, then this method adds a new map entry mapping
the key to the specified addend. |
void |
add(K key,
double addend)
Adds the specified addend to the double value (at index 0)
associated with the specified key, or if no mapping previously existed for
the specified key, then this method adds a new map entry mapping the key
to the specified addend. |
void |
add(K key,
float addend)
Adds the specified addend to the float value (at index 0)
associated with the specified key, or if no mapping previously existed
for the specified key, then this method adds a new map entry mapping
the key to the specified addend. |
void |
add(K key,
int addend)
Adds the specified addend to the int value (at index 0)
associated with the specified key, or if no mapping previously existed
for the specified key, then this method adds a new map entry mapping
the key to the specified addend. |
void |
add(K key,
int index,
byte addend)
Adds the specified addend to the byte value at the specified
index associated with the specified key, or if no mapping previously
existed for the specified key, then this method adds a new map entry
mapping the key to the specified addend at the specified index. |
void |
add(K key,
int index,
double addend)
Adds the specified addend to the double value at the specified
index associated with the specified key, or if no mapping previously
existed for the specified key, then this method adds a new map entry
mapping the key to the specified addend at the specified index. |
void |
add(K key,
int index,
float addend)
Adds the specified addend to the float value at the specified
index associated with the specified key, or if no mapping previously
existed for the specified key, then this method adds a new map entry
mapping the key to the specified addend at the specified index. |
void |
add(K key,
int index,
int addend)
Adds the specified addend to the int value at the specified
index associated with the specified key, or if no mapping previously
existed for the specified key, then this method adds a new map entry
mapping the key to the specified addend at the specified index. |
void |
add(K key,
int index,
long addend)
Adds the specified addend to the long value at the specified
index associated with the specified key, or if no mapping previously
existed for the specified key, then this method adds a new map entry
mapping the key to the specified addend at the specified index. |
void |
add(K key,
int index,
short addend)
Adds the specified addend to the short value at the specified
index associated with the specified key, or if no mapping previously
existed for the specified key, then this method adds a new map entry
mapping the key to the specified addend at the specified index. |
void |
add(K key,
long addend)
Adds the specified addend to the long value (at index 0)
associated with the specified key, or if no mapping previously existed
for the specified key, then this method adds a new map entry mapping
the key to the specified addend. |
void |
add(K key,
short addend)
Adds the specified addend to the short value (at index 0)
associated with the specified key, or if no mapping previously existed
for the specified key, then this method adds a new map entry mapping
the key to the specified addend. |
abstract MapToPrimitive.Entry |
getEntry(K key)
Gets the map entry associated with the specified key, or null
if this map does not contain such a mapping. |
abstract MapToPrimitive.Entry |
getEntryMRU(K key)
Gets the map entry for the specified key and, as a side-effect, puts the map entry at the front of the bucket list, indicating that it is the most-recently used entry (useful for caches implementing a bucket-LRU replacement scheme). |
byte |
put(K key,
byte value)
Associates the specified byte value (at index 0) with the
specified key. |
char |
put(K key,
char value)
|
double |
put(K key,
double value)
|
float |
put(K key,
float value)
|
int |
put(K key,
int value)
|
byte |
put(K key,
int index,
byte value)
|
char |
put(K key,
int index,
char value)
|
double |
put(K key,
int index,
double value)
|
float |
put(K key,
int index,
float value)
|
int |
put(K key,
int index,
int value)
|
long |
put(K key,
int index,
long addend)
|
short |
put(K key,
int index,
short value)
|
long |
put(K key,
long addend)
|
short |
put(K key,
short value)
|
void |
removeRandom()
Removes a random mapping from this map (optional operation). |
abstract void |
removeRandom(int bucketIndex)
Removes a random entry from the bucket at the specified index (optional operation). |
String |
toString()
Returns a string representation of this map. |
Methods inherited from class java.util.AbstractMap |
---|
clear, clone, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface danbikel.util.MapToPrimitive |
---|
getEntry, getEntryMRU |
Methods inherited from interface java.util.Map |
---|
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
Constructor Detail |
---|
public AbstractMapToPrimitive()
Method Detail |
---|
public abstract MapToPrimitive.Entry getEntry(K key)
null
if this map does not contain such a mapping.
getEntry
in interface MapToPrimitive<K>
key
- the key for which to look up a map entry
null
if no
such mapping exists in this mappublic abstract MapToPrimitive.Entry getEntryMRU(K key)
getEntryMRU
in interface MapToPrimitive<K>
key
- the key whose map entry is to be retrieved and made the
MRU in its bucket inside the hash map
UnsupportedOperationException
- if this map is not a hash mappublic void removeRandom()
removeRandom
in interface MapToPrimitive<K>
UnsupportedOperationException
- if this operation is not supportedpublic abstract void removeRandom(int bucketIndex)
removeRandom
in interface MapToPrimitive<K>
bucketIndex
- the index of the bucket from which to remove an
element
IllegalArgumentException
- if
0 <= bucketIndex < getCapacity()is
false
UnsupportedOperationException
- if this map is not a hash mappublic byte put(K key, byte value)
byte
value (at index 0) with the
specified key.
put
in interface MapToPrimitive<K>
byte
value associated with this key;
if there was no previous mapping for the specified key or if the
previous mapping mapped the key to 0b (the default value for
byte instance variables), then 0b is returned; the
containsKey
method can be used to distinguish between
these two cases
UnsupportedOperationException
- if this map does not map keys
to byte
valuespublic byte put(K key, int index, byte value)
put
in interface MapToPrimitive<K>
public void add(K key, byte addend)
byte
value (at index 0)
associated with the specified key, or if no mapping previously existed
for the specified key, then this method adds a new map entry mapping
the key to the specified addend. If this map maps keys to
multiple byte
values, then the other byte
s will
be set to their default instance-variable value, 0.
add
in interface MapToPrimitive<K>
key
- the key whose byte
value is to be incrementedaddend
- the amount by which to increment the byte
value
for the specified keypublic void add(K key, int index, byte addend)
byte
value at the specified
index associated with the specified key, or if no mapping previously
existed for the specified key, then this method adds a new map entry
mapping the key to the specified addend at the specified index. If this
map maps keys to multiple byte
values, then the other
byte
s will be set to their default instance-variable value,
0.
add
in interface MapToPrimitive<K>
key
- the key whose byte
value is to be incremented,
or for which a mapping is to be added to the specified addendindex
- the index of the byte
value to be incrementedaddend
- the amount by which to increment the byte
value
for the specified keypublic char put(K key, char value)
put
in interface MapToPrimitive<K>
public char put(K key, int index, char value)
put
in interface MapToPrimitive<K>
public short put(K key, short value)
put
in interface MapToPrimitive<K>
public short put(K key, int index, short value)
put
in interface MapToPrimitive<K>
public void add(K key, short addend)
short
value (at index 0)
associated with the specified key, or if no mapping previously existed
for the specified key, then this method adds a new map entry mapping
the key to the specified addend. If this map maps keys to
multiple short
values, then the other short
s will
be set to their default instance-variable value, 0.
add
in interface MapToPrimitive<K>
key
- the key whose short
value is to be incrementedaddend
- the amount by which to increment the short
value
for the specified keypublic void add(K key, int index, short addend)
short
value at the specified
index associated with the specified key, or if no mapping previously
existed for the specified key, then this method adds a new map entry
mapping the key to the specified addend at the specified index. If this
map maps keys to multiple short
values, then the other
short
s will be set to their default instance-variable value,
0.
add
in interface MapToPrimitive<K>
key
- the key whose short
value is to be incremented,
or for which a mapping is to be added to the specified addendindex
- the index of the short
value to be incrementedaddend
- the amount by which to increment the short
value
for the specified key
IllegalArgumentException
- if the index is out of rangepublic int put(K key, int value)
put
in interface MapToPrimitive<K>
public int put(K key, int index, int value)
put
in interface MapToPrimitive<K>
public void add(K key, int addend)
int
value (at index 0)
associated with the specified key, or if no mapping previously existed
for the specified key, then this method adds a new map entry mapping
the key to the specified addend. If this map maps keys to
multiple int
values, then the other int
s will
be set to their default instance-variable value, 0.
add
in interface MapToPrimitive<K>
key
- the key whose int
value is to be incrementedaddend
- the amount by which to increment the int
value
for the specified keypublic void add(K key, int index, int addend)
int
value at the specified
index associated with the specified key, or if no mapping previously
existed for the specified key, then this method adds a new map entry
mapping the key to the specified addend at the specified index. If this
map maps keys to multiple int
values, then the other
int
s will be set to their default instance-variable value,
0.
add
in interface MapToPrimitive<K>
key
- the key whose int
value is to be incremented,
or for which a mapping is to be added to the specified addendindex
- the index of the int
value to be incrementedaddend
- the amount by which to increment the int
value
for the specified keypublic long put(K key, long addend)
put
in interface MapToPrimitive<K>
public long put(K key, int index, long addend)
put
in interface MapToPrimitive<K>
public void add(K key, long addend)
long
value (at index 0)
associated with the specified key, or if no mapping previously existed
for the specified key, then this method adds a new map entry mapping
the key to the specified addend. If this map maps keys to
multiple long
values, then the other long
s will
be set to their default instance-variable value, 0.
add
in interface MapToPrimitive<K>
key
- the key whose long
value is to be incrementedaddend
- the amount by which to increment the long
value
for the specified keypublic void add(K key, int index, long addend)
long
value at the specified
index associated with the specified key, or if no mapping previously
existed for the specified key, then this method adds a new map entry
mapping the key to the specified addend at the specified index. If this
map maps keys to multiple long
values, then the other
long
s will be set to their default instance-variable value,
0.
add
in interface MapToPrimitive<K>
key
- the key whose long
value is to be incremented,
or for which a mapping is to be added to the specified addendindex
- the index of the long
value to be incrementedaddend
- the amount by which to increment the long
value
for the specified keypublic float put(K key, float value)
put
in interface MapToPrimitive<K>
public float put(K key, int index, float value)
put
in interface MapToPrimitive<K>
public void add(K key, float addend)
float
value (at index 0)
associated with the specified key, or if no mapping previously existed
for the specified key, then this method adds a new map entry mapping
the key to the specified addend. If this map maps keys to
multiple float
values, then the other float
s will
be set to their default instance-variable value, 0.
add
in interface MapToPrimitive<K>
key
- the key whose float
value is to be incrementedaddend
- the amount by which to increment the float
value
for the specified keypublic void add(K key, int index, float addend)
float
value at the specified
index associated with the specified key, or if no mapping previously
existed for the specified key, then this method adds a new map entry
mapping the key to the specified addend at the specified index. If this
map maps keys to multiple float
values, then the other
float
s will be set to their default instance-variable value,
0.
add
in interface MapToPrimitive<K>
key
- the key whose float
value is to be incremented,
or for which a mapping is to be added to the specified addendindex
- the index of the float
value to be incrementedaddend
- the amount by which to increment the float
value
for the specified keypublic double put(K key, double value)
put
in interface MapToPrimitive<K>
public double put(K key, int index, double value)
put
in interface MapToPrimitive<K>
public void add(K key, double addend)
double
value (at index 0)
associated with the specified key, or if no mapping previously existed for
the specified key, then this method adds a new map entry mapping the key
to the specified addend. If this map maps keys to multiple
double
values, then the other double
s will be
set to their default instance-variable value, 0.
add
in interface MapToPrimitive<K>
key
- the key whose double
value is to be incrementedaddend
- the amount by which to increment the double
value for the specified keypublic void add(K key, int index, double addend)
double
value at the specified
index associated with the specified key, or if no mapping previously
existed for the specified key, then this method adds a new map entry
mapping the key to the specified addend at the specified index. If this
map maps keys to multiple double
values, then the other
double
s will be set to their default instance-variable value,
0.
add
in interface MapToPrimitive<K>
key
- the key whose double
value is to be incremented,
or for which a mapping is to be added to the specified addendindex
- the index of the double
value to be incrementedaddend
- the amount by which to increment the double
value for the specified keypublic String toString()
toString
in class AbstractMap<K,Object>
|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |