001    package jigcell.compare;
002    
003    /**
004     * This interface is implemented by classes that wish to provide data to the comparator.
005     *
006     * <p>
007     * This code is licensed under the DARPA BioCOMP Open Source License.  See LICENSE for more details.
008     * </p>
009     *
010     * @author Nicholas Allen
011     */
012    
013    public interface IDataGenerator extends IReadableDataSource {
014    
015       /**
016        * Attribute key for the displayable comment of this generator
017        */
018    
019       String ATTRIBUTE_COMMENT = "IDataGenerator.comment";
020    
021       /**
022        * Attribute key for a global identifier
023        */
024    
025       String ATTRIBUTE_GUID = "IDataGenerator.guid";
026    
027       /**
028        * Property key for notifications that a generator has changed
029        */
030    
031       String PROPERTY_GENERATOR_EDIT = "jigcell_datagenerator_edited";
032    
033       /**
034        * Resource key for the list of available generators
035        */
036    
037       String RESOURCE_GENERATORS = "jigcell_datagenerators";
038    
039       /**
040        * An equivalent copy of this generator.
041        *
042        * @param shallow Whether the copy is shallow
043        */
044    
045       IDataGenerator copy (boolean shallow);
046    
047       /**
048        * A keyed attribute that must be persisted with this generator.
049        *
050        * @param key Attribute key
051        */
052    
053       String getAttribute (String key);
054    
055       /**
056        * A comment suitable for display to the user.
057        */
058    
059       String getComment ();
060    
061       /**
062        * The generator this was copied from or null if this is not a copy.
063        */
064    
065       IDataGenerator getCopiedFrom ();
066    
067       /**
068        * A DataElement corresponding to this object.  This may be a potentially expensive operation if isCached is false.
069        */
070    
071       IDataElement getElement ();
072    
073       /**
074        * Whether a cached value of the corresponding DataElement exists.
075        */
076    
077       boolean isCached ();
078    
079       /**
080        * Whether this generator is a copy of another.
081        */
082    
083       boolean isCopy ();
084    
085       /**
086        * Whether this generator was copied from or to another.
087        */
088    
089       boolean isCopyRelated (IDataGenerator generator);
090    
091       /**
092        * Sets a permanent attribute of this generator.  Returns whether the attribute was changed.
093        *
094        * @param key Attribute name
095        * @param value New attribute value
096        */
097    
098       boolean setAttribute (String key, String value);
099    }