## org.biojava.utils
Class AbstractChangeable

    java.lang.Object
      org.biojava.utils.AbstractChangeable

All Implemented Interfaces:
  Changeable

Direct Known Subclasses:
  AbiTraceRenderer, AbstractAlphabet, AbstractAnnotation, AbstractBeadRenderer, AbstractBioEntryDB, AbstractCrossOverFunction, AbstractDistribution, AbstractFeatureHolder, AbstractGeneticAlgorithm, AbstractMutationFunction, AbstractOrganism, AbstractOrthologueSet, AbstractOrthoPairSet, AbstractPopulation, AbstractSequenceDB, AbstractSymbol, AbstractSymbolList, AbstractTaxon, AbstractTerm, BasicFeatureRenderer, BioSQLSequenceDB, CrosshairRenderer, DAS, DASSequence, DummySequence, FeatureBlockSequenceRenderer, FeatureLabelRenderer, FeatureTypes.RepositoryImpl, GFF3Record.Impl, IndexedCount, LabelledSequenceRenderer, LazyFeatureHolder, MergeAnnotation, MultiLineRenderer, NewSimpleAssembly, OffsetRulerRenderer, Ontology.Impl, OntologyTerm.Impl, OverlayAnnotation, OverlayRendererWrapper, PairDistribution, PairwiseDiagonalRenderer, PairwiseFilteringRenderer, PairwiseOverlayRenderer, SequenceDBSearchHit, SequenceDBSearchResult, SequenceDBSearchSubHit, SequenceRendererWrapper, SimpleAssembly, SimpleBioEntry, SimpleBioEntryRelationship, SimpleCodonPref, SimpleComment, SimpleComparableOntology, SimpleComparableTerm, SimpleComparableTriple, SimpleDocRef, SimpleEmissionState, SimpleFeature, SimpleHomology, SimpleLabelRenderer, SimpleMarkovModel, SimpleNamespace, SimpleNCBITaxon, SimpleNote, SimpleRankedCrossRef, SimpleRankedDocRef, SimpleRichAnnotation, SimpleRichFeature, SimpleRichFeatureRelationship, SimpleRichLocation, SimpleSeqSimilaritySearchHit, SimpleSeqSimilaritySearchResult, SimpleSeqSimilaritySearchSubHit, SimpleSequence, SixFrameRenderer, SixFrameZiggyRenderer, StackedFeatureRenderer, TickFeatureRenderer, TranslatedDistribution, WebSequenceDB, WMAsMM, ZiggyFeatureRenderer

    public abstract class AbstractChangeable

extends Object
implements Changeable

Useful base-class for objects implementing Changeable

Author:
  Matthew Pocock, Thomas Down

Constructor Summary
`AbstractChangeable()`

Method Summary
`void` `addChangeListener(ChangeListener cl)` Add a listener that will be informed of all changes.
`void` `addChangeListener(ChangeListener cl, ChangeType ct)` Add a listener that will be informed of changes of a given type.
`protected ChangeSupport` `generateChangeSupport()` Called the first time a ChangeSupport object is needed.
`protected ChangeSupport` `getChangeSupport(ChangeType ct)` Called to retrieve the ChangeSupport for this object.
`protected boolean` `hasListeners()` Deprecated. use hasListeners(ChangeType) if at all possible
`protected boolean` `hasListeners(ChangeType ct)` Discover if we have listeners registered for a particular change type.
`boolean` `isUnchanging(ChangeType ct)` A particular ChangeType can never be raised by this Changeable.
`void` `removeChangeListener(ChangeListener cl)` Remove a listener that was interested in all types of changes.
`void` `removeChangeListener(ChangeListener cl, ChangeType ct)` Remove a listener that was interested in a specific types of changes.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractChangeable

    public AbstractChangeable()

Method Detail

### hasListeners

    protected boolean hasListeners()

  Deprecated. use hasListeners(ChangeType) if at all possible

  Discover if we have any listeners registered.

  Returns:
    true if there is at least one listener

### hasListeners

    protected boolean hasListeners(ChangeType ct)

  Discover if we have listeners registered for a particular change type.

  Parameters:
    `ct` - the ChangeType we are interested in
  Returns:
    true if there is at least one listener

### generateChangeSupport

    protected ChangeSupport generateChangeSupport()

  Called the first time a ChangeSupport object is needed. Override this if you want to set the Unchanging set on the ChangeSupport, or if you want to install listeners on other objects when the change system is initialized.

  Since:
    1.3

### getChangeSupport

    protected ChangeSupport getChangeSupport(ChangeType ct)

  Called to retrieve the ChangeSupport for this object.

  Your implementation of this method should have the following structure: ``

       ChangeSupport cs = super.getChangeSupport(ct);

       if(someForwarder == null && ct.isMatching(SomeInterface.SomeChangeType)) {
         someForwarder = new ChangeForwarder(...

         this.stateVariable.addChangeListener(someForwarder, VariableInterface.AChange);
       }

       return cs;

  It is usual for the forwarding listeners (someForwarder in this example) to be transient and lazily instantiated. Be sure to register & unregister the forwarder in the code that does the ChangeEvent handling in setter methods.

### addChangeListener

    public final void addChangeListener(ChangeListener cl)

  Description copied from interface: `Changeable`
  Add a listener that will be informed of all changes.

  Specified by:
    `addChangeListener` in interface `Changeable`
  Parameters:
    `cl` - the ChangeListener to add

### addChangeListener

    public final void addChangeListener(ChangeListener cl,
                                        ChangeType ct)

  Description copied from interface: `Changeable`
  Add a listener that will be informed of changes of a given type.

  Specified by:
    `addChangeListener` in interface `Changeable`
  Parameters:
    `cl` - the ChangeListener
    `ct` - the ChangeType it is to be informed of

### removeChangeListener

    public final void removeChangeListener(ChangeListener cl)

  Description copied from interface: `Changeable`
  Remove a listener that was interested in all types of changes.

  Specified by:
    `removeChangeListener` in interface `Changeable`
  Parameters:
    `cl` - a ChangeListener to remove

### removeChangeListener

    public final void removeChangeListener(ChangeListener cl,
                                           ChangeType ct)

  Description copied from interface: `Changeable`
  Remove a listener that was interested in a specific types of changes.

  Specified by:
    `removeChangeListener` in interface `Changeable`
  Parameters:
    `cl` - a ChangeListener to remove
    `ct` - the ChangeType that it was interested in

### isUnchanging

    public final boolean isUnchanging(ChangeType ct)

  Description copied from interface: `Changeable`

  A particular ChangeType can never be raised by this Changeable.

  If this returns true, then it is guaranteed that change events of this type (and all child types) can never under any circumstances be fired by this Changeable instance. If it returns false, that does not mean that this type of event will or even can be raised, but that it is worth registering listeners incase.

  Specified by:
    `isUnchanging` in interface `Changeable`
  Parameters:
    `ct` - the ChangeType to check
  Returns:
    true if ChangeEvents of this type are guaranteed to never be fired