Class lrs.ANode


abstract class ANode
extends 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.

Author:
Dung X. Nguyen Copyright 2001 - All rights reserved.

Method Index

 o execute (LRStruct, IAlgo, Object[])
Executes a visitor algorithm and returns the output
 o getFirst (LRStruct)
Returns the first data object of the referencing LRStruct
 o getRest (LRStruct)
Returns the tail LRStruct of the referencing LRStruct
 o insertFront (LRStruct, Object)
Inserts a data object at the front of the LRStruct owner
 o removeFront (LRStruct)
Removes and returns the first data object for the referencing LRStruct
 o setFirst (LRStruct, Object)
Sets a new first data object for the referencing LRStruct
 o setRest (LRStruct, LRStruct)
Sets a new tail for the referencing LRStruct
 o toString (LRStruct)
Uses anonymous visitor class to compute a String representation

Methods

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

 o getRest
abstract LRStruct getRest(LRStruct owner)
Returns the tail LRStruct of the referencing LRStruct.

Parameters:
owner - the LRStruct referencing this ANode.
Returns:
the tail LRStruct of owner.
 o getFirst
abstract Object getFirst(LRStruct owner)
Returns the first data object of the referencing LRStruct.

Parameters:
owner - the LRStruct referencing this ANode.
Returns:
the tail LRStruct of owner.
 o setRest
abstract LRStruct setRest(LRStruct owner, LRStruct tail)
Sets a new tail for the referencing LRStruct.

Parameters:
owner - the LRS referencing this ANode.
tail - the new tail for the owner LRStruct.
Returns:
LRStruct owner
 o setFirst
abstract LRStruct setFirst(LRStruct owner, Object dat)
Sets a new first data object for the referencing LRStruct.

Parameters:
owner - the LRS referencing this ANode.
first - the new data object for this ANode.
Returns:
LRStruct owner
 o insertFront
abstract LRStruct insertFront(LRStruct owner, Object dat)
Inserts a data object at the front of the LRStruct owner.

Parameters:
owner - the LRS referencing this ANode.
dat - the object to be inserted at the front.
Returns:
LRStruct owner
 o removeFront
abstract 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.
 o execute
abstract Object execute(LRStruct owner, IAlgo algo, Object[] inp)
Executes a visitor algorithm and returns the output.

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