goldman.collection.ordered.digitized
Class AbstractTrieLeafNode<E>

java.lang.Object
  extended by goldman.collection.ordered.digitized.AbstractTrieNode<E>
      extended by goldman.collection.ordered.digitized.AbstractTrieLeafNode<E>
All Implemented Interfaces:
TrieLeafNode<E>, TrieNode<E>
Direct Known Subclasses:
Trie.LeafNode

public abstract class AbstractTrieLeafNode<E>
extends AbstractTrieNode<E>
implements TrieLeafNode<E>

The AbstractTrieLeafNode class implements methods that can be shared by all implementations of a trie leaf node.


Constructor Summary
AbstractTrieLeafNode()
           
 
Method Summary
 void addAfter(TrieLeafNode<E> ptr)
          The TrieLeafNode interface must be supported by any class defining objects to be used as leaf nodes in a trie.
 boolean isDeleted()
          Returns true if and only if this trie leaf node is not in use.
 boolean isLeaf()
          Returns true if and only if this trie node is a leaf.
 void markDeleted()
          Marks this trie leaf node as no longer being in the collection
 TrieLeafNode<E> next()
          Returns a reference to the next leaf node in the ordered leaf chain.
 TrieLeafNode<E> prev()
          Returns a reference to previous leaf node in the ordered leaf chain.
 void remove()
          Removes this leaf node from the ordered leaf chain and marks the removed trie leaf node as deleted.
 void setNext(TrieLeafNode<E> nextNode)
          Sets the next element in the ordered leaf chain to the leaf node referenced by newNode.
 void setPrev(TrieLeafNode<E> prevNode)
          Sets the previous element in the ordered leaf chain to prevNode.
 
Methods inherited from class goldman.collection.ordered.digitized.AbstractTrieNode
child, data, parent, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface goldman.collection.ordered.digitized.TrieNode
child, data, parent, setParent
 

Constructor Detail

AbstractTrieLeafNode

public AbstractTrieLeafNode()
Method Detail

isLeaf

public boolean isLeaf()
Description copied from interface: TrieNode
Returns true if and only if this trie node is a leaf.

Specified by:
isLeaf in interface TrieNode<E>
Overrides:
isLeaf in class AbstractTrieNode<E>
Returns:
true

next

public TrieLeafNode<E> next()
Description copied from interface: TrieLeafNode
Returns a reference to the next leaf node in the ordered leaf chain.

Specified by:
next in interface TrieLeafNode<E>
Returns:
a reference to the next leaf node in the ordered leaf chain

prev

public TrieLeafNode<E> prev()
Description copied from interface: TrieLeafNode
Returns a reference to previous leaf node in the ordered leaf chain.

Specified by:
prev in interface TrieLeafNode<E>
Returns:
a reference to the previous leaf node in the ordered leaf chain

setNext

public void setNext(TrieLeafNode<E> nextNode)
Description copied from interface: TrieLeafNode
Sets the next element in the ordered leaf chain to the leaf node referenced by newNode.

Specified by:
setNext in interface TrieLeafNode<E>
Parameters:
nextNode - the value to set the next pointer.

setPrev

public void setPrev(TrieLeafNode<E> prevNode)
Description copied from interface: TrieLeafNode
Sets the previous element in the ordered leaf chain to prevNode.

Specified by:
setPrev in interface TrieLeafNode<E>
Parameters:
prevNode - the value to set the previous pointer

markDeleted

public void markDeleted()
Marks this trie leaf node as no longer being in the collection

Specified by:
markDeleted in interface TrieLeafNode<E>

isDeleted

public boolean isDeleted()
Description copied from interface: TrieLeafNode
Returns true if and only if this trie leaf node is not in use. By definition we say that FORE and AFT are deleted since they do not hold an element in the collection.

Specified by:
isDeleted in interface TrieLeafNode<E>
Returns:
true if and only if this trie leaf node is not in use.

addAfter

public void addAfter(TrieLeafNode<E> ptr)
Description copied from interface: TrieLeafNode
The TrieLeafNode interface must be supported by any class defining objects to be used as leaf nodes in a trie. Inserts this trie leaf node into the ordered leaf chain immediately after the trie leaf node referenced by ptr.

Specified by:
addAfter in interface TrieLeafNode<E>
Parameters:
ptr - and places this trie leaf node after the one referenced by ptr in the ordered leaf chain.

remove

public void remove()
Removes this leaf node from the ordered leaf chain and marks the removed trie leaf node as deleted.

Specified by:
remove in interface TrieLeafNode<E>