org.semanticweb.elk.util.collections.entryset
Class StrongKeyEntry<T,K>

java.lang.Object
  extended by org.semanticweb.elk.util.collections.entryset.StrongKeyEntry<T,K>
Type Parameters:
T - the type of the keys for linked entries
K - the type of the key of this entry
All Implemented Interfaces:
KeyEntry<T,K>

public abstract class StrongKeyEntry<T,K>
extends Object
implements KeyEntry<T,K>

A prototype class for entries with keys. Sub-classes should implement the method for computing the equality function for the entry and hash code of the keys, which will be used for initializing the hash code of the entry. The hashCode and equals method should be compatible as usual.

Author:
"Yevgeny Kazakov"

Field Summary
protected  int hash
          The value used as a hash code of this entry
protected  K key
           
 
Constructor Summary
StrongKeyEntry(K key)
           
 
Method Summary
abstract  int computeHashCode()
          Compute the value which will be used as a final hash code for this object.
abstract  boolean equals(Object object)
           
 K getKey()
           
 KeyEntry<T,? extends T> getNext()
          Returns the next next element of the entry, or null if there is no next element
 int hashCode()
           
 void setNext(KeyEntry<T,? extends T> next)
          Setting the input element as the next element of the entry.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

key

protected final K key

hash

protected final int hash
The value used as a hash code of this entry

Constructor Detail

StrongKeyEntry

public StrongKeyEntry(K key)
Method Detail

getKey

public K getKey()
Specified by:
getKey in interface KeyEntry<T,K>

setNext

public void setNext(KeyEntry<T,? extends T> next)
Setting the input element as the next element of the entry.

Parameters:
next - the object that should be set as the next element of the record

getNext

public KeyEntry<T,? extends T> getNext()
Returns the next next element of the entry, or null if there is no next element

Returns:
the next element of the entry

hashCode

public int hashCode()
Overrides:
hashCode in class Object

computeHashCode

public abstract int computeHashCode()
Compute the value which will be used as a final hash code for this object. Must be compatible with the equals(Object) method usual.

Returns:
the value which will be used as a hash code for this object

equals

public abstract boolean equals(Object object)
Overrides:
equals in class Object


Copyright © 2011-2013 Department of Computer Science, University of Oxford. All Rights Reserved.