lrs
Class EmptyNode<T>

java.lang.Object
  extended by lrs.ANode<T>
      extended by lrs.EmptyNode<T>

 class EmptyNode<T>
extends ANode<T>

Represents the empty state of a mutable list LRStruct. Uses the Singleton pattern.

Since:
8/25/05

Constructor Summary
EmptyNode()
           
 
Method Summary
(package private)
<R,P> R
execute(LRStruct<T> owner, IAlgo<T,R,P> algo, P... inp)
          Calls the IAlgo visitor's empty case.
(package private)  T getFirst(LRStruct<T> owner)
          Throws java.util.NoSuchElementException.
(package private)  LRStruct<T> getRest(LRStruct<T> owner)
          Throws java.util.NoSuchElementException.
(package private)  LRStruct<T> insertFront(T dat, LRStruct<T> owner)
          The owner becomes non-empty and has dat as its first element.
(package private)  T removeFront(LRStruct<T> owner)
          Throws java.util.NoSuchElementException.
(package private)  LRStruct<T> setFirst(T dat, LRStruct<T> owner)
          Throws java.util.NoSuchElementException.
(package private)  LRStruct<T> setRest(LRStruct<T> tail, LRStruct<T> owner)
          Throws java.util.NoSuchElementException.
 
Methods inherited from class lrs.ANode
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmptyNode

EmptyNode()
Method Detail

getRest

LRStruct<T> getRest(LRStruct<T> owner)
Throws java.util.NoSuchElementException.

Specified by:
getRest in class ANode<T>
Parameters:
owner - the LRStruct referencing this ANode.
Returns:
the tail LRStruct of owner.

getFirst

T getFirst(LRStruct<T> owner)
Throws java.util.NoSuchElementException.

Specified by:
getFirst in class ANode<T>
Parameters:
owner - the LRStruct referencing this ANode.
Returns:
the tail LRStruct of owner.

setRest

LRStruct<T> setRest(LRStruct<T> tail,
                    LRStruct<T> owner)
Throws java.util.NoSuchElementException.

Specified by:
setRest in class ANode<T>
Parameters:
tail - the new tail for the owner LRStruct.
owner - the LRS referencing this ANode.
Returns:
LRStruct owner

setFirst

LRStruct<T> setFirst(T dat,
                     LRStruct<T> owner)
Throws java.util.NoSuchElementException.

Specified by:
setFirst in class ANode<T>
owner - the LRS referencing this ANode.
Returns:
LRStruct owner

insertFront

LRStruct<T> insertFront(T dat,
                        LRStruct<T> owner)
The owner becomes non-empty and has dat as its first element.

Specified by:
insertFront in class ANode<T>
Parameters:
dat - the object to be inserted at the front.
owner - the LRS referencing this ANode.
Returns:
LRStruct owner

removeFront

T removeFront(LRStruct<T> owner)
Throws java.util.NoSuchElementException.

Specified by:
removeFront in class ANode<T>
Parameters:
owner - the LRS referencing this ANode.
Returns:
the front data of the LRStruct owner.

execute

<R,P> R execute(LRStruct<T> owner,
                IAlgo<T,R,P> algo,
                P... inp)
Calls the IAlgo visitor's empty case.

Specified by:
execute in class ANode<T>
Parameters:
owner - the LRStruct referencing this ANode.
algo - the visitor algorithm to be executed.
inp - the inputs needed by the algorithm.