001    package rac;
002    
003    import listFW.*;
004    
005    /**
006     * Defines the interface for a restricted access container.
007     * @author Mathias Ricken - Copyright 2008 - All rights reserved.
008     */
009    public interface IRAContainer<T> {
010        /**
011         * Empty the container.
012         * NOTE: This implies a state change.
013         * This behavior can be achieved by repeatedly removing elements from this IRAContainer.
014         * It is specified here as a convenience to the client.
015         */
016        public abstract void clear();
017    
018    
019        /**
020         * Return TRUE if the container is full; otherwise, return
021         * FALSE. 
022         */
023        public abstract boolean isFull();
024    
025        /**
026         * Return an immutable list of all elements in the container.
027         * @param fact for manufacturing an IList.
028         */
029        public abstract IList<T> elements(IListFactory<T> fact);
030    
031        /**
032         * Remove the next item from the container and return it.
033         * NOTE: This implies a state change.
034         * @throw an Exception if this IRAContainer is empty.
035         */
036        public abstract T get();
037    
038        /**
039         * Add an item to the container.
040         * NOTE: This implies a state change.
041         * @param input the Object to be added to this IRAContainer.
042         * @throw an Exception if this IRAContainer is full.
043         */
044        public abstract void put(T input);
045        
046        /**
047         * Return the next element in this IRAContainer withour removing it.
048         * @throw an Exception if this IRAContainer is empty.
049         */
050        public abstract T peek();
051        
052            /**
053         * Extensibility hook to accept a visitor algorithm.
054         * @param v  The visitor to execute
055         * @param param An arbitrary input parameter for the visitor
056         * @return The return value of the calculation performed by the visitor.
057         */
058    
059        public abstract <R,P> R execute(IRACVisitor<T,R,P> v, P... inp); 
060    }