goldman.collection.tagged
Class TaggedElement<T,E>

java.lang.Object
  extended by goldman.collection.tagged.TaggedElement<T,E>
Direct Known Subclasses:
MutableTaggedElement

public class TaggedElement<T,E>
extends Object

Each element and its associated tag is stored in a tagged collection as a tagged element.


Field Summary
protected  E element
           
protected  T tag
           
 
Constructor Summary
protected TaggedElement()
           
  TaggedElement(T t, E e)
          Initializes the tagged element to hold these values
 
Method Summary
 E getElement()
           
 T getTag()
           
 int hashCode()
           
 void setElement(E e)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

tag

protected T tag

element

protected E element
Constructor Detail

TaggedElement

public TaggedElement(T t,
                     E e)
Initializes the tagged element to hold these values

Parameters:
t - the tag
e - the element
REQUIRES: the tag is not null.

TaggedElement

protected TaggedElement()
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object
Returns:
a hashcode based on only the tag

getTag

public T getTag()
Returns:
the tag from this tagged element.

getElement

public E getElement()
Returns:
the element from this tagged element.

setElement

public void setElement(E e)
Parameters:
e - the new value for the element field

toString

public String toString()
Overrides:
toString in class Object
Returns:
a string of the form, tagelement.