lrs
Class NENode<T>

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

 class NENode<T>
extends ANode<T>

Represents the non-empty state of a LStruct.

Since:
8/25/05

Field Summary
private  T _dat
           
private  LRStruct<T> _tail
           
 
Constructor Summary
NENode(T dat, LRStruct<T> tail)
          Initializes this NENode to contain dat and a given tail list.
 
Method Summary
(package private)
<R,P> R
execute(LRStruct<T> owner, IAlgo<T,R,P> algo, P... input)
          Calls the visitor's non-empty case.
(package private)  T getFirst(LRStruct<T> owner)
          Returns the first data object of the referencing LRStruct.
(package private)  LRStruct<T> getRest(LRStruct<T> owner)
          Returns the tail LRStruct of the referencing LRStruct.
(package private)  LRStruct<T> insertFront(T dat, LRStruct<T> owner)
          Inserts a data object at the front of the LRStruct owner.
(package private)  T removeFront(LRStruct<T> owner)
          Removes and returns the first data object for the referencing LRStruct.
(package private)  LRStruct<T> setFirst(T first, LRStruct<T> owner)
          Sets a new first data object for the referencing LRStruct.
(package private)  LRStruct<T> setRest(LRStruct<T> tail, LRStruct<T> owner)
          Sets a new tail for the referencing LRStruct.
 
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
 

Field Detail

_dat

private T _dat

_tail

private LRStruct<T> _tail
Constructor Detail

NENode

NENode(T dat,
       LRStruct<T> tail)
Initializes this NENode to contain dat and a given tail list.

Parameters:
dat - the data object to be stored in this NENode.
tail - the LRStruct tail of this NENode.
Method Detail

getRest

LRStruct<T> getRest(LRStruct<T> owner)
Description copied from class: ANode
Returns the tail LRStruct of the referencing LRStruct.

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)
Description copied from class: ANode
Returns the first data object of the referencing LRStruct.

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)
Description copied from class: ANode
Sets a new tail for the referencing LRStruct.

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 first,
                     LRStruct<T> owner)
Description copied from class: ANode
Sets a new first data object for the referencing LRStruct.

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)
Inserts a data object at the front of the LRStruct owner.

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

removeFront

T removeFront(LRStruct<T> owner)
Description copied from class: ANode
Removes and returns the first data object for the referencing LRStruct.

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... input)
Calls the visitor's non-empty case.

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