Home Original page

Unchangeable (biojava-legacy 1.9.5 API)

  • java.lang.Object
    • org.biojava.utils.Unchangeable
  • All Implemented Interfaces:
    Changeable
    Direct Known Subclasses:
    AlternateTokenization, BioFetchSequenceDB, CharacterTokenization, DoubleAlphabet, DoubleAlphabet.DoubleRange, DoubleAlphabet.DoubleSymbol, DoubleAlphabet.SubDoubleAlphabet, EmptyRichAnnotation, EmptyRichLocation, FeatureHolder.EmptyFeatureHolder, FlatSequenceDB, GapDistribution, IntegerAlphabet, IntegerAlphabet.IntegerSymbol, IntegerOntology, IntegerOntology.IntTerm, RelabeledAlignment, SimilarityPairFeature.EmptyPairwiseAlignment, SimpleCrossRef, SimpleDocRefAuthor, SimpleStatePath, SoftMaskedAlphabet, SoftMaskedAlphabet.CaseSensitiveTokenization, Triple.Impl, ViewSequence, WordTokenization

    public class Unchangeable
    extends Object
    implements Changeable

    This is a utility implementation of Changeable that doesn't fire any events or keep references to any listeners. Use this when you have a final immutable class and can't be bothered to fill in all those method stubs.

    Since:
    1.3
    Author:
    Matthew Pocock
    • Constructor Summary

      Constructors 
      Constructor Description
      Unchangeable()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.

      void addForwarder​(ChangeForwarder cf, ChangeType ct)  
      Set getForwarders​(ChangeType ct)  
      Set getListeners​(ChangeType ct)  
      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.

      void removeForwarder​(ChangeForwarder cf, ChangeType ct)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Unchangeable

        public Unchangeable()
    • Method Detail

      • 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
      • getListeners

        public final Set getListeners​(ChangeType ct)
      • 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
      • addForwarder

        public final void addForwarder​(ChangeForwarder cf,
                                       ChangeType ct)
      • removeForwarder

        public final void removeForwarder​(ChangeForwarder cf,
                                          ChangeType ct)
      • getForwarders

        public final Set getForwarders​(ChangeType ct)
      • 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