org.biojava.bio.seq.db
Class SequenceDBWrapper

java.lang.Object
  extended by org.biojava.utils.AbstractChangeable
      extended by org.biojava.bio.seq.db.AbstractSequenceDB
          extended by org.biojava.bio.seq.db.SequenceDBWrapper
All Implemented Interfaces:
java.io.Serializable, SequenceDB, SequenceDBLite, Changeable
Direct Known Subclasses:
CachingSequenceDB, SubSequenceDB, ViewingSequenceDB

public abstract class SequenceDBWrapper
extends AbstractSequenceDB
implements java.io.Serializable

An abstract implementation of SequenceDB that wraps up another database.

Author:
Matthew Pocock
See Also:
Serialized Form

Nested Class Summary
protected  class SequenceDBWrapper.SequencesForwarder
           
 
Field Summary
 
Fields inherited from interface org.biojava.bio.seq.db.SequenceDBLite
SEQUENCES
 
Constructor Summary
SequenceDBWrapper(SequenceDB parent)
           
 
Method Summary
protected  ChangeSupport getChangeSupport(ChangeType ct)
          Called to retrieve the ChangeSupport for this object.
 SequenceDB getParent()
          Return the parent SequenceDB.
 
Methods inherited from class org.biojava.bio.seq.db.AbstractSequenceDB
addSequence, filter, removeSequence, sequenceIterator
 
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.biojava.bio.seq.db.SequenceDB
ids
 
Methods inherited from interface org.biojava.bio.seq.db.SequenceDBLite
getName, getSequence
 
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
 

Constructor Detail

SequenceDBWrapper

public SequenceDBWrapper(SequenceDB parent)
Method Detail

getChangeSupport

protected ChangeSupport getChangeSupport(ChangeType ct)
Description copied from class: AbstractChangeable
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.

Overrides:
getChangeSupport in class AbstractChangeable

getParent

public SequenceDB getParent()
Return the parent SequenceDB.

Returns:
the parent SequenceDB