Parsing Engine

danbikel.util
Class HashMapPrimitive.Entry<K>

java.lang.Object
  extended by danbikel.util.AbstractMapToPrimitive.Entry<K>
      extended by danbikel.util.HashMapPrimitive.Entry<K>
All Implemented Interfaces:
MapToPrimitive.Entry<K>, Externalizable, Serializable, Map.Entry<K,Object>
Direct Known Subclasses:
HashMapDouble.Entry, HashMapInt.Entry, HashMapTwoDoubles.Entry, HashMapTwoInts.Entry
Enclosing class:
HashMapPrimitive<K>

public abstract static class HashMapPrimitive.Entry<K>
extends AbstractMapToPrimitive.Entry<K>
implements Externalizable

A still-abstract extension of the AbstractMapToPrimitive.Entry that adds a next pointer and an int to cache the hash value of the key held by this entry.

See Also:
Serialized Form

Field Summary
protected  int keyHash
          The hash value of the key of this entry, cached here for efficiency.
protected  HashMapPrimitive.Entry<K> next
          The next pointer of this entry’s singly-linked list.
 
Fields inherited from class danbikel.util.AbstractMapToPrimitive.Entry
key
 
Constructor Summary
  HashMapPrimitive.Entry()
          Constructs a new entry, with all default values for data members (this no-argument constructor necessary for serialization).
protected HashMapPrimitive.Entry(int keyHash, K key, HashMapPrimitive.Entry<K> next)
          Constructs a new entry with the specified values for its data members.
 
Method Summary
protected abstract  Object clone()
          Returns a new copy of this type of map entry.
abstract  void copyValuesFrom(HashMapPrimitive.Entry copyFrom)
          Copies the values from the specified entry to this entry.
abstract  boolean equals(Object o)
           
 Object getValue()
          Throws an UnsupportedOperationException.
abstract  int hashCode()
           
 void readExternal(ObjectInput in)
           
protected abstract  void readValues(ObjectInput in)
           
 boolean replaceKey(K key)
          Replaces the key of this entry with the specified key.
 Object setValue(Object value)
          Throws an UnsupportedOperationException.
abstract  String toString()
           
 void writeExternal(ObjectOutput out)
           
protected abstract  void writeValues(ObjectOutput out)
           
 
Methods inherited from class danbikel.util.AbstractMapToPrimitive.Entry
add, add, add, add, add, add, add, add, add, add, add, add, getByteValue, getByteValue, getCharValue, getCharValue, getDoubleValue, getDoubleValue, getFloatValue, getFloatValue, getIntValue, getIntValue, getKey, getLongValue, getLongValue, getShortValue, getShortValue, numBytes, numChars, numDoubles, numFloats, numInts, numLongs, numShorts, set, set, set, set, set, set, set
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

keyHash

protected transient int keyHash
The hash value of the key of this entry, cached here for efficiency.


next

protected transient HashMapPrimitive.Entry<K> next
The next pointer of this entry’s singly-linked list.

Constructor Detail

HashMapPrimitive.Entry

public HashMapPrimitive.Entry()
Constructs a new entry, with all default values for data members (this no-argument constructor necessary for serialization).


HashMapPrimitive.Entry

protected HashMapPrimitive.Entry(int keyHash,
                                 K key,
                                 HashMapPrimitive.Entry<K> next)
Constructs a new entry with the specified values for its data members.

Parameters:
keyHash - the hash value of the specified key
key - the key of this hash map entry
next - the next pointer of this entry’s singly-linked list (can be null)
Method Detail

clone

protected abstract Object clone()
Returns a new copy of this type of map entry.

Overrides:
clone in class Object

replaceKey

public boolean replaceKey(K key)
Replaces the key of this entry with the specified key. A replacement will only occur if the specified key has the same hash value and is equal to the existing key of this entry (as determined by the existing key’s equals method).

Specified by:
replaceKey in interface MapToPrimitive.Entry<K>
Parameters:
key - the new key of this entry
Returns:
whether or not the replacement occurred

getValue

public Object getValue()
Throws an UnsupportedOperationException. This default implementation may be overridden by subclasses, but should be used with care, as auto-boxing might need to happen.

Specified by:
getValue in interface Map.Entry<K,Object>
Returns:
nothing
Throws:
UnsupportedOperationException - under all circumstances

setValue

public Object setValue(Object value)
Throws an UnsupportedOperationException.

Specified by:
setValue in interface Map.Entry<K,Object>
Parameters:
value - ignored
Returns:
nothing
Throws:
UnsupportedOperationException - under all circumstances

equals

public abstract boolean equals(Object o)
Specified by:
equals in interface Map.Entry<K,Object>
Overrides:
equals in class Object

hashCode

public abstract int hashCode()
Specified by:
hashCode in interface Map.Entry<K,Object>
Overrides:
hashCode in class Object

toString

public abstract String toString()
Overrides:
toString in class Object

copyValuesFrom

public abstract void copyValuesFrom(HashMapPrimitive.Entry copyFrom)
Copies the values from the specified entry to this entry.

Throws:
ClassCastException - if the specified entry is not of the same run-time type as this entry

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

writeValues

protected abstract void writeValues(ObjectOutput out)
                             throws IOException
Throws:
IOException

readValues

protected abstract void readValues(ObjectInput in)
                            throws IOException,
                                   ClassNotFoundException
Throws:
IOException
ClassNotFoundException

Parsing Engine

Author: Dan Bikel.