package schemeFW;
/**
* Represents a non-empty list.
* Implemented as a composite.
* @author Dung X. Nguyen
* @author Dung X. Nguyen
* @author Stephen B. Wong
* @version 1.1
* @since 09/10/01
* @Custom Copyright 2001 -All rights reserved
*/
public class NEList implements INEList {
/**
* This NEList's first.
*/
private Object _first;
/**
* This NEList's rest
* @SBGen Variable (,,,64)
*/
private IList _rest;
/**
* Initializes this NEList to the given first and rest.
* @param dat the first data element of this NEList.
* @param tail the rest of this AList.
*/
public NEList(Object dat, IList tail) {
_first = dat;
_rest = tail;
}
/**
* Accessor method for this NEList's first.
* @return Object the first element of this NEList.
*/
public Object getFirst() {
return _first;
}
/**
* Accessor method for this NEList's rest.
* @return IList the rest of this NEList.
*/
public IList getRest() {
return _rest;
}
/**
* Calls the nonEmptyCase() method of the supplied IListAlgo
* with the supplied input parameter.
* @param algo The visitor algorithm to be executed.
* @param inp input to be handed to algo's nonEmptyCase().
* @return Object output of algo's nonEmptyCase().
*/
public Object execute(IListAlgo algo, Object inp) {
return algo.nonEmptyCase(this, inp);
}
}