AList.java
Created with JBuilder
package OOscheme;
/**
 * Represents an abstract Scheme-like list, an  immutable linear recursive
 * structure of data. Has abstract methods to provide its internal data and
 * structure to the client. Since an AList has an internal structure that is
 * isomorphic to itself, it's best to implement it using the composite pattern.
 * @author Dung X. Nguyen
 * @version 2.0
 * @since 01/31/02
 * @Custom Copyright 2002 -All rights reserved
 * @stereotype host
 */
public abstract class AList {
    /**
     * Returns the first element in this AList, if any.
     * The behavior for the empty list is undefined.
     */
    public abstract Object getFirst();

    /**
     * Returns the tail ("rest") of this AList, if any.
     * The behavior for the empty list is undefined.
     */
    public abstract AList getRest();

    /**
     * "Hook" method to execute any IListAlgo visitor.
     * @param algo the algorithm operating on this AList.
     * @param inp the input needed by algo to perform its task.
     * @return the output Object of algo.
     */
    public abstract Object execute(IListAlgo algo, Object inp);
}



AList.java
Created with JBuilder