lrs
Class ANode

java.lang.Object
  extended by lrs.ANode
Direct Known Subclasses:
EmptyNode, NENode

abstract class ANode
extends java.lang.Object

Represents the abstract list state. Has a concrete toString () method that

uses anynomous inner classes to compute the String representation of the

LRStruct owner.

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

Constructor Summary
ANode()
           
 
Method Summary
(package private) abstract  java.lang.Object execute(IAlgo algo, java.lang.Object inp, LRStruct owner)
          Executes a visitor algorithm and returns the output.
(package private) abstract  java.lang.Object getFirst(LRStruct owner)
          Returns the first data object of the referencing LRStruct.
(package private) abstract  LRStruct getRest(LRStruct owner)
          Returns the rest LRStruct of the referencing LRStruct.
(package private) abstract  LRStruct insertFront(java.lang.Object dat, LRStruct owner)
          Inserts a data object at the front of the LRStruct owner.
(package private) abstract  java.lang.Object removeFront(LRStruct owner)
          Removes and returns the first data object for the referencing LRStruct.
(package private) abstract  LRStruct setFirst(java.lang.Object dat, LRStruct owner)
          Sets a new first data object for the referencing LRStruct.
(package private) abstract  LRStruct setRest(LRStruct tail, LRStruct owner)
          Sets a new rest for the referencing LRStruct.
(package private)  java.lang.String toString(LRStruct owner)
          Uses anonymous visitor class to compute a String representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ANode

ANode()
Method Detail

toString

java.lang.String toString(LRStruct owner)
Uses anonymous visitor class to compute a String representation.

Anonymous inner classes will be discussed soon!


getRest

abstract LRStruct getRest(LRStruct owner)
Returns the rest LRStruct of the referencing LRStruct.

Parameters:
owner - the LRStruct referencing this ANode.
Returns:
the rest LRStruct of owner.
Throws:
java.util.NoSuchElementException - if empty.

getFirst

abstract java.lang.Object getFirst(LRStruct owner)
Returns the first data object of the referencing LRStruct.

Parameters:
owner - the LRStruct referencing this ANode.
Returns:
the rest LRStruct of owner.
Throws:
java.util.NoSuchElementException - if empty.

setRest

abstract LRStruct setRest(LRStruct tail,
                          LRStruct owner)
Sets a new rest for the referencing LRStruct.

Parameters:
tail - the new rest for the owner LRStruct.
owner - the LRS referencing this ANode.
Returns:
LRStruct owner
Throws:
java.util.NoSuchElementException - if empty.

setFirst

abstract LRStruct setFirst(java.lang.Object dat,
                           LRStruct owner)
Sets a new first data object for the referencing LRStruct.

Parameters:
dat - the new data object for this ANode.
owner - the LRS referencing this ANode.
Returns:
LRStruct owner
Throws:
java.util.NoSuchElementException - if empty.

insertFront

abstract LRStruct insertFront(java.lang.Object dat,
                              LRStruct owner)
Inserts a data object at the front of the LRStruct owner.

Parameters:
dat - the object to be inserted at the front.
owner - the LRS referencing this ANode.
Returns:
LRStruct owner

removeFront

abstract java.lang.Object removeFront(LRStruct owner)
Removes and returns the first data object for the referencing LRStruct.

Parameters:
owner - the LRS referencing this ANode.
Returns:
the front data of the LRStruct owner.

execute

abstract java.lang.Object execute(IAlgo algo,
                                  java.lang.Object inp,
                                  LRStruct owner)
Executes a visitor algorithm and returns the output.

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