lrs
Class EmptyNode

java.lang.Object
  extended by lrs.ANode
      extended by lrs.EmptyNode

 class EmptyNode
extends ANode

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

Since:
10/09/01
Author:
Dung X. Nguyen Copyright 2001 - All rights reserved.

Field Summary
(package private) static EmptyNode Singleton
          Singleton Pattern.
 
Constructor Summary
private EmptyNode()
           
 
Method Summary
(package private)  java.lang.Object execute(IAlgo algo, java.lang.Object inp, LRStruct owner)
          Calls the IAlgo visitor's empty case.
(package private)  java.lang.Object getFirst(LRStruct owner)
          Throws java.util.NoSuchElementException.
(package private)  LRStruct getRest(LRStruct owner)
          Throws java.util.NoSuchElementException.
(package private)  LRStruct insertFront(java.lang.Object dat, LRStruct owner)
          The owner becomes non-empty and has dat as its first element.
(package private)  java.lang.Object removeFront(LRStruct owner)
          Throws java.util.NoSuchElementException.
(package private)  LRStruct setFirst(java.lang.Object dat, LRStruct owner)
          Throws java.util.NoSuchElementException.
(package private)  LRStruct setRest(LRStruct tail, LRStruct 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
 

Field Detail

Singleton

static final EmptyNode Singleton
Singleton Pattern.

Constructor Detail

EmptyNode

private EmptyNode()
Method Detail

getRest

LRStruct getRest(LRStruct owner)
Throws java.util.NoSuchElementException.

Specified by:
getRest in class ANode
Parameters:
owner - the LRStruct referencing this ANode.
Returns:
the rest LRStruct of owner.

getFirst

java.lang.Object getFirst(LRStruct owner)
Throws java.util.NoSuchElementException.

Specified by:
getFirst in class ANode
Parameters:
owner - the LRStruct referencing this ANode.
Returns:
the rest LRStruct of owner.

setRest

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

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

setFirst

LRStruct setFirst(java.lang.Object dat,
                  LRStruct owner)
Throws java.util.NoSuchElementException.

Specified by:
setFirst in class ANode
Parameters:
dat - the new data object for this ANode.
owner - the LRS referencing this ANode.
Returns:
LRStruct owner

insertFront

LRStruct insertFront(java.lang.Object dat,
                     LRStruct owner)
The owner becomes non-empty and has dat as its first element.

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

removeFront

java.lang.Object removeFront(LRStruct owner)
Throws java.util.NoSuchElementException.

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

execute

java.lang.Object execute(IAlgo algo,
                         java.lang.Object inp,
                         LRStruct owner)
Calls the IAlgo visitor's empty case.

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