001    package com.hammurapi.reasoning.impl;
002    
003    import java.util.List;
004    import java.util.Set;
005    
006    /**
007     * Implementations of this interface are used to
008     * manage collections to keep intermediate inference results.
009     * Returned collections which hold resources shall implement Destroyable.
010     * @author Pavel Vlasov
011     *
012     */
013    public interface CollectionManager<B> {
014    
015            /**
016             * Retrieves set with given id from the manager. If set doesn't exist,
017             * it shall be created.
018             * @param <T>
019             * @param id Set id.
020             * @param elementType Element type.
021             * @return
022             */
023            <T extends B> Set<? extends T> getSet(String id, Class<T> elementType);
024            
025            /**
026             * Retrieves list with given id from the manager. If list doesn't exist,
027             * it shall be created.
028             * @param <T>
029             * @param id Set id.
030             * @param elementType Element type.
031             * @return
032             */
033            <T extends B> List<? extends T> getList(String id, Class<T> elementType);
034    }