001    package lrs;
002    
003    /**
004     * Represents an abstract algorithm on an LRStruct.  Acts as a visitor to a
005     * LRStruct host.
006     * Since LRStruct is a mutable data structure, we require an exact match for
007     * the data type (LRStruct<T>, not LRStruct<? extends T>).
008     * @author Dung X. Nguyen and Stephen Wong  Copyright 2005 - All rights reserved.
009     * @author Mathias Ricken - Copyright 2008 - All rights reserved.
010     * @since 8/25/05
011     */
012    public interface IAlgo<T,R,P> {
013        /**
014        * Operates on an empty LRStruct host, given an input object.
015        * @param host an empty LRStruct.
016        * @param inp variable input list of objects needed by this IVisitor.
017        * @return an appropriate output object.
018        */
019        public abstract R emptyCase(LRStruct<T> host, P... inp);
020    
021        /**
022        * Operates on a non-empty LRStruct host, given an input object.
023        * @param host a non-empty LRStruct.
024        * @param inp variable input list of objects needed by this IVisitor.
025        * @return an appropriate output object.
026        */
027        public abstract R nonEmptyCase(LRStruct<T> host, P... inp);
028    }
029