001    /*
002     * Copyright (c) 1998-2014 ChemAxon Ltd. All Rights Reserved.
003     *
004     * This software is the confidential and proprietary information of
005     * ChemAxon. You shall not disclose such Confidential Information
006     * and shall use it only in accordance with the terms of the agreements
007     * you entered into with ChemAxon.
008     *
009     */
010    package com.chemaxon.overlap.io;
011    
012    import com.google.common.base.Optional;
013    
014    /**
015     * Master structure storage represents the molecules from a repository.
016     *
017     * <p>
018     * Typically retrieval of individual structures can be slow (in ms range) compared to descriptor comparison/screening
019     * speed requirements. Intended usage is provide visual display of structures in a user interface.</p>
020     *
021     * <p>
022     * It is possible that certain structures are not retrievable; clients must be prepared for the handling of missing
023     * structures.</p>
024     *
025     * @param <T> Type of structures
026     *
027     * @author Gabor Imre
028     */
029    public interface MasterStorage<T> {
030    
031        /**
032         * Number of structures in the storage.
033         *
034         * @return Number of structures in the storage
035         */
036        int size();
037    
038        /**
039         * Number of absent structures.
040         *
041         * @return Number of absent structures.
042         */
043        int getAbsentCount();
044    
045        /**
046         * Get given structure identified with an index.
047         *
048         * @param index Structure index
049         * @return Structure if present
050         */
051        Optional<T> get(int index);
052    }