goldman.collection.tagged
Class TaggedElement<T,E>
java.lang.Object
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.
tag
protected T tag
element
protected E element
TaggedElement
public TaggedElement(T t,
E e)
- Initializes the tagged element to hold these values
- Parameters:
t
- the tage
- the element
REQUIRES:
the tag is not null.
TaggedElement
protected TaggedElement()
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,
tag
→ element
.