Class schemeFW.NEList


public class NEList
extends Object
implements schemeFW.INEList
Represents a non-empty list. Implemented as a composite.

Author:
Dung X. Nguyen, Dung X. Nguyen, Stephen B. Wong
Version:
1.1

Variable Index

 o _first
This NEList's first
 o _rest
This NEList's rest

Constructor Index

 o NEList (Object, IList)
Initializes this NEList to the given first and rest

Method Index

 o execute (IListAlgo, Object)
Calls the nonEmptyCase() method of the supplied IListAlgo
 o getFirst ()
Accessor method for this NEList's first
 o getRest ()
Accessor method for this NEList's rest

Variables

 o _first
private Object _first
This NEList's first.

 o _rest
private IList _rest
This NEList's rest

Constructors

 o NEList
public  NEList(Object dat, IList tail)
Initializes this NEList to the given first and rest.

Parameters:
dat - the first data element of this NEList.
tail - the rest of this AList.

Methods

 o getFirst
public Object getFirst()
Accessor method for this NEList's first.

Returns:
Object the first element of this NEList.
 o getRest
public IList getRest()
Accessor method for this NEList's rest.

Returns:
IList the rest of this NEList.
 o execute
public Object execute(IListAlgo algo, Object inp)
Calls the nonEmptyCase() method of the supplied IListAlgo with the supplied input parameter.

Parameters:
algo - The visitor algorithm to be executed.
inp - input to be handed to algo's nonEmptyCase().
Returns:
Object output of algo's nonEmptyCase().