Parsing Engine

danbikel.util
Class AbstractMapToPrimitive.Entry<K>

java.lang.Object
  extended by danbikel.util.AbstractMapToPrimitive.Entry<K>
All Implemented Interfaces:
MapToPrimitive.Entry<K>, Serializable, Map.Entry<K,Object>
Direct Known Subclasses:
HashMapPrimitive.Entry, Trainer.EventEntry
Enclosing class:
AbstractMapToPrimitive<K>

public abstract static class AbstractMapToPrimitive.Entry<K>
extends Object
implements MapToPrimitive.Entry<K>, Serializable

Provides convenient abstract implementation of the MapToPrimitive.Entry interface: all primitive-specific methods are implemented to throw an UnsupportedOperationException. In this way, a concrete subclass need only implement methods specific to the primitives it supports.

See Also:
Serialized Form

Field Summary
protected  K key
          The key of this map entry.
 
Constructor Summary
AbstractMapToPrimitive.Entry()
           
 
Method Summary
 void add(byte addend)
          Increments the byte at index 0 by the specified amount.
 void add(double addend)
          Increments the double at index 0 by the specified amount.
 void add(float addend)
          Increments the float at index 0 by the specified amount.
 void add(int addend)
          Increments the int at index 0 by the specified amount.
 void add(int index, byte addend)
          Increments the byte at the specified index by the specified amount.
 void add(int index, double addend)
          Increments the double at the specified index by the specified amount.
 void add(int index, float addend)
          Increments the float at the specified index by the specified amount.
 void add(int index, int addend)
          Increments the int at the specified index by the specified amount.
 void add(int index, long addend)
          Increments the long at the specified index by the specified amount.
 void add(int index, short addend)
          Increments the short at the specified index by the specified amount.
 void add(long addend)
          Increments the long at index 0 by the specified amount.
 void add(short addend)
          Increments the short at index 0 by the specified amount.
 byte getByteValue()
          Gets the byte value associated with the key contained in this entry.
 byte getByteValue(int index)
          Returns the byte value of the specified index associated with the key in this map entry.
 char getCharValue()
          Gets the char value associated with the key contained in this entry.
 char getCharValue(int index)
          Returns the char value of the specified index associated with the key in this map entry.
 double getDoubleValue()
          Gets the double value associated with the key contained in this entry.
 double getDoubleValue(int index)
          Returns the double value of the specified index associated with the key in this map entry.
 float getFloatValue()
          Gets the float value associated with the key contained in this entry.
 float getFloatValue(int index)
          Returns the float value of the specified index associated with the key in this map entry.
 int getIntValue()
          Gets the int value associated with the key contained in this entry.
 int getIntValue(int index)
          Returns the int value of the specified index associated with the key in this map entry.
 K getKey()
           
 long getLongValue()
          Gets the long value associated with the key contained in this entry.
 long getLongValue(int index)
          Returns the long value of the specified index associated with the key in this map entry.
 short getShortValue()
          Gets the short value associated with the key contained in this entry.
 short getShortValue(int index)
          Returns the short value of the specified index associated with the key in this map entry.
 int numBytes()
          Returns 0.
 int numChars()
          Returns 0.
 int numDoubles()
          Returns 0.
 int numFloats()
          Returns 0.
 int numInts()
          Returns 0.
 int numLongs()
          Returns 0.
 int numShorts()
          Returns 0.
 byte set(int index, byte value)
          Sets the char value for the key in this entry to be the specified character.
 char set(int index, char value)
          Sets the char value for the key in this entry to be the specified character.
 double set(int index, double value)
          Sets the char value for the key in this entry to be the specified character.
 float set(int index, float value)
          Sets the float value for the key in this entry to be the specified character.
 int set(int index, int value)
          Sets the char value for the key in this entry to be the specified character.
 long set(int index, long value)
          Sets the char value for the key in this entry to be the specified character.
 short set(int index, short value)
          Sets the short value for the key in this entry to be the specified character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface danbikel.util.MapToPrimitive.Entry
replaceKey
 
Methods inherited from interface java.util.Map.Entry
equals, getValue, hashCode, setValue
 

Field Detail

key

protected transient K key
The key of this map entry.

Constructor Detail

AbstractMapToPrimitive.Entry

public AbstractMapToPrimitive.Entry()
Method Detail

getKey

public K getKey()
Specified by:
getKey in interface Map.Entry<K,Object>

numBytes

public int numBytes()
Returns 0.

Specified by:
numBytes in interface MapToPrimitive.Entry<K>

getByteValue

public byte getByteValue()
Gets the byte value associated with the key contained in this entry. If an implementor associates multiple byte values, this method retrieves the first one.

Specified by:
getByteValue in interface MapToPrimitive.Entry<K>
Throws:
UnsupportedOperationException - if the implementor does not associate bytes with its keys

getByteValue

public byte getByteValue(int index)
Returns the byte value of the specified index associated with the key in this map entry. If the implementor associates only a single byte with its key, then the specified index must be 0.

Specified by:
getByteValue in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the byte value to retrieve
Throws:
IllegalArgumentException - if
0 <= index < numBytes()
is false
UnsupportedOperationException - if the implementor does not associate bytes with its key

numShorts

public int numShorts()
Returns 0.

Specified by:
numShorts in interface MapToPrimitive.Entry<K>

getShortValue

public short getShortValue()
Gets the short value associated with the key contained in this entry. If an implementor associates multiple short values, this method retrieves the first one.

Specified by:
getShortValue in interface MapToPrimitive.Entry<K>
Throws:
UnsupportedOperationException - if the implementor does not associate shorts with its keys

getShortValue

public short getShortValue(int index)
Returns the short value of the specified index associated with the key in this map entry. If the implementor associates only a single short with its key, then the specified index must be 0.

Specified by:
getShortValue in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the short value to retrieve
Throws:
IllegalArgumentException - if
0 <= index < numShorts()
is false
UnsupportedOperationException - if the implementor does not associate shorts with its key

numChars

public int numChars()
Returns 0.

Specified by:
numChars in interface MapToPrimitive.Entry<K>

getCharValue

public char getCharValue()
Gets the char value associated with the key contained in this entry. If an implementor associates multiple char values, this method retrieves the first one.

Specified by:
getCharValue in interface MapToPrimitive.Entry<K>
Throws:
UnsupportedOperationException - if the implementor does not associate chars with its keys

getCharValue

public char getCharValue(int index)
Returns the char value of the specified index associated with the key in this map entry. If the implementor associates only a single char with its key, then the specified index must be 0.

Specified by:
getCharValue in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the char value to retrieve
Throws:
IllegalArgumentException - if
0 <= index < numChars()
is false
UnsupportedOperationException - if the implementor does not associate chars with its key

numInts

public int numInts()
Returns 0.

Specified by:
numInts in interface MapToPrimitive.Entry<K>

getIntValue

public int getIntValue()
Gets the int value associated with the key contained in this entry. If an implementor associates multiple int values, this method retrieves the first one.

Specified by:
getIntValue in interface MapToPrimitive.Entry<K>
Throws:
UnsupportedOperationException - if the implementor does not associate ints with its keys

getIntValue

public int getIntValue(int index)
Returns the int value of the specified index associated with the key in this map entry. If the implementor associates only a single int with its key, then the specified index must be 0.

Specified by:
getIntValue in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the int value to retrieve
Throws:
IllegalArgumentException - if
0 <= index < numInts()
is false
UnsupportedOperationException - if the implementor does not associate ints with its key

numLongs

public int numLongs()
Returns 0.

Specified by:
numLongs in interface MapToPrimitive.Entry<K>

getLongValue

public long getLongValue()
Gets the long value associated with the key contained in this entry. If an implementor associates multiple long values, this method retrieves the first one.

Specified by:
getLongValue in interface MapToPrimitive.Entry<K>
Throws:
UnsupportedOperationException - if the implementor does not associate longs with its keys

getLongValue

public long getLongValue(int index)
Returns the long value of the specified index associated with the key in this map entry. If the implementor associates only a single long with its key, then the specified index must be 0.

Specified by:
getLongValue in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the long value to retrieve
Throws:
IllegalArgumentException - if
0 <= index < numLongs()
is false
UnsupportedOperationException - if the implementor does not associate longs with its key

numFloats

public int numFloats()
Returns 0.

Specified by:
numFloats in interface MapToPrimitive.Entry<K>

getFloatValue

public float getFloatValue()
Gets the float value associated with the key contained in this entry. If an implementor associates multiple float values, this method retrieves the first one.

Specified by:
getFloatValue in interface MapToPrimitive.Entry<K>
Throws:
UnsupportedOperationException - if the implementor does not associate floats with its keys

getFloatValue

public float getFloatValue(int index)
Returns the float value of the specified index associated with the key in this map entry. If the implementor associates only a single float with its key, then the specified index must be 0.

Specified by:
getFloatValue in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the float value to retrieve
Throws:
IllegalArgumentException - if
0 <= index < numFloats()
is false
UnsupportedOperationException - if the implementor does not associate floats with its key

numDoubles

public int numDoubles()
Returns 0.

Specified by:
numDoubles in interface MapToPrimitive.Entry<K>

getDoubleValue

public double getDoubleValue()
Gets the double value associated with the key contained in this entry. If an implementor associates multiple double values, this method retrieves the first one.

Specified by:
getDoubleValue in interface MapToPrimitive.Entry<K>
Throws:
UnsupportedOperationException - if the implementor does not associate doubles with its keys

getDoubleValue

public double getDoubleValue(int index)
Returns the double value of the specified index associated with the key in this map entry. If the implementor associates only a single double with its key, then the specified index must be 0.

Specified by:
getDoubleValue in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the double value to retrieve
Throws:
IllegalArgumentException - if
0 <= index < numDoubles()
is false
UnsupportedOperationException - if the implementor does not associate doubles with its key

set

public byte set(int index,
                byte value)
Sets the char value for the key in this entry to be the specified character.

Specified by:
set in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the character value to set
value - the byte to which to set as a value for the key of this map entry
Throws:
UnsupportedOperationException - if the implementor does not associate bytes with its key

add

public void add(byte addend)
Description copied from interface: MapToPrimitive.Entry
Increments the byte at index 0 by the specified amount. This is simply a convenience method, completely equivalent to calling add(0, addend).

Specified by:
add in interface MapToPrimitive.Entry<K>
Parameters:
addend - the amount by which to increment the byte value at the specified index

add

public void add(int index,
                byte addend)
Description copied from interface: MapToPrimitive.Entry
Increments the byte at the specified index by the specified amount.

Specified by:
add in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the byte value to be incremented
addend - the amount by which to increment the byte value at the specified index

set

public char set(int index,
                char value)
Sets the char value for the key in this entry to be the specified character.

Specified by:
set in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the character value to set
value - the character to set as a value for the key of this map entry
Throws:
UnsupportedOperationException - if the implementor does not associate chars with its key

set

public short set(int index,
                 short value)
Sets the short value for the key in this entry to be the specified character.

Specified by:
set in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the character value to set
value - the short to set as a value for the key of this map entry
Throws:
UnsupportedOperationException - if the implementor does not associate shorts with its key

add

public void add(short addend)
Description copied from interface: MapToPrimitive.Entry
Increments the short at index 0 by the specified amount. This is simply a convenience method, completely equivalent to calling add(0, addend).

Specified by:
add in interface MapToPrimitive.Entry<K>
Parameters:
addend - the amount by which to increment the short value at the specified index

add

public void add(int index,
                short addend)
Description copied from interface: MapToPrimitive.Entry
Increments the short at the specified index by the specified amount.

Specified by:
add in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the short value to be incremented
addend - the amount by which to increment the short value at the specified index

set

public int set(int index,
               int value)
Sets the char value for the key in this entry to be the specified character.

Specified by:
set in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the character value to set
value - the character to set as a value for the key of this map entry
Throws:
UnsupportedOperationException - if the implementor does not associate ints with its key

add

public void add(int addend)
Increments the int at index 0 by the specified amount. This is simply a convenience method, completely equivalent to calling add(0, addend).

Specified by:
add in interface MapToPrimitive.Entry<K>
Parameters:
addend - the amount by which to increment the int value at the specified index

add

public void add(int index,
                int addend)
Increments the int at the specified index by the specified amount.

Specified by:
add in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the int value to be incremented
addend - the amount by which to increment the int value at the specified index

set

public long set(int index,
                long value)
Sets the char value for the key in this entry to be the specified character.

Specified by:
set in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the character value to set
value - the long to set as a value for the key of this map entry
Throws:
UnsupportedOperationException - if the implementor does not associate longs with its key

add

public void add(long addend)
Description copied from interface: MapToPrimitive.Entry
Increments the long at index 0 by the specified amount. This is simply a convenience method, completely equivalent to calling add(0, addend).

Specified by:
add in interface MapToPrimitive.Entry<K>
Parameters:
addend - the amount by which to increment the long value at the specified index

add

public void add(int index,
                long addend)
Description copied from interface: MapToPrimitive.Entry
Increments the long at the specified index by the specified amount.

Specified by:
add in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the long value to be incremented
addend - the amount by which to increment the long value at the specified index

set

public float set(int index,
                 float value)
Sets the float value for the key in this entry to be the specified character.

Specified by:
set in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the character value to set
value - the float to set as a value for the key of this map entry
Throws:
UnsupportedOperationException - if the implementor does not associate floats with its key

add

public void add(float addend)
Description copied from interface: MapToPrimitive.Entry
Increments the float at index 0 by the specified amount. This is simply a convenience method, completely equivalent to calling add(0, addend).

Specified by:
add in interface MapToPrimitive.Entry<K>
Parameters:
addend - the amount by which to increment the float value at the specified index

add

public void add(int index,
                float addend)
Description copied from interface: MapToPrimitive.Entry
Increments the float at the specified index by the specified amount.

Specified by:
add in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the float value to be incremented
addend - the amount by which to increment the float value at the specified index

set

public double set(int index,
                  double value)
Sets the char value for the key in this entry to be the specified character.

Specified by:
set in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the character value to set
value - the double to set as a value for the key of this map entry
Throws:
UnsupportedOperationException - if the implementor does not associate doubles with its key

add

public void add(double addend)
Description copied from interface: MapToPrimitive.Entry
Increments the double at index 0 by the specified amount. This is simply a convenience method, completely equivalent to calling add(0, addend).

Specified by:
add in interface MapToPrimitive.Entry<K>
Parameters:
addend - the amount by which to increment the double value at the specified index

add

public void add(int index,
                double addend)
Description copied from interface: MapToPrimitive.Entry
Increments the double at the specified index by the specified amount.

Specified by:
add in interface MapToPrimitive.Entry<K>
Parameters:
index - the index of the double value to be incremented
addend - the amount by which to increment the double value at the specified index

Parsing Engine

Author: Dan Bikel.