|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.biojava.bio.seq.projection.ReparentContext
public class ReparentContext
A good base class to implement ProjectionContext from.
ReparentContext takes care of much of the ugliness of implementing ProjectionContext, such as handling listeners and grafting features onto a new parent. It also sets up a framework for mutating feature filters. Think carefully before overriding methods in this class.
| Constructor Summary | |
|---|---|
ReparentContext(FeatureHolder parent,
FeatureHolder wrapped)
|
|
| Method Summary | |
|---|---|
void |
addChangeListener(Feature f,
ChangeListener cl,
ChangeType ct)
Add a ChangeListener to a projected feature. |
Feature |
createFeature(Feature.Template projTempl)
Create a projected feature with properties matching the template. |
Feature |
createFeature(Feature f,
Feature.Template projTempl)
Create a new projected feature. |
FeatureHolder |
getParent()
|
FeatureHolder |
getParent(Feature f)
|
protected FilterUtils.FilterTransformer |
getReverter()
|
FeatureFilter |
getSchema(Feature f)
|
Sequence |
getSequence(Feature f)
Get the sequence for a feature. |
protected FilterUtils.FilterTransformer |
getTransformer()
|
FeatureHolder |
getUnprojectedFeatures()
Get the features before projection. |
FeatureHolder |
projectChildFeatures(Feature f,
FeatureHolder parent)
Project all features that are children of feature so that they become children of parent. |
Feature |
projectFeature(Feature feat)
Create a single projected feature using the rules of this ProjectedFeatureHolder. |
FeatureHolder |
projectFeatures(FeatureHolder fh)
Project all of the features in a FeatureHolder. |
FeatureFilter |
projectFilter(FeatureFilter ff)
Transform a filter on unprojected features so that it applies to projected features. |
void |
removeChangeListener(Feature f,
ChangeListener cl,
ChangeType ct)
Remove a ChangeListener from a projected feature. |
void |
removeFeature(Feature dyingChild)
Remove the dying child. |
void |
removeFeature(Feature f,
Feature f2)
Remove the dying child. |
Feature |
revertFeature(Feature feat)
Unproject a feature. |
FeatureFilter |
revertFilter(FeatureFilter ff)
Transform a filter on projected features so that it applies to unprojected features. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReparentContext(FeatureHolder parent,
FeatureHolder wrapped)
| Method Detail |
|---|
public final FeatureHolder getParent()
public final FeatureHolder getUnprojectedFeatures()
ProjectionContextIf you are projecting all the features in some feature holder, that is what this method should return.
getUnprojectedFeatures in interface ProjectionContextpublic Feature projectFeature(Feature feat)
ProjectedFeatureHolder.
projectFeature in interface ProjectionContextfeat - the Feature to project
public Feature revertFeature(Feature feat)
ProjectionContextThis is the inverse opperation to @link projectFeature().
Note: The result of calling this method for a feature that is not projected through this context is not specified by this API, but it is reasonable to assume that bad things will happen.
revertFeature in interface ProjectionContextfeat - the Feature to un-project
public final FeatureFilter projectFilter(FeatureFilter ff)
ProjectionContext
projectFilter in interface ProjectionContextff - the FeatureFilter to transform
public final FeatureFilter revertFilter(FeatureFilter ff)
ProjectionContext
revertFilter in interface ProjectionContextff - the FeatureFilter to transform
protected FilterUtils.FilterTransformer getTransformer()
protected FilterUtils.FilterTransformer getReverter()
public final FeatureHolder getParent(Feature f)
getParent in interface ProjectionContextpublic final Sequence getSequence(Feature f)
ProjectionContext
This will be the return value of projFeat.getParent().
getSequence in interface ProjectionContextf - the projected Feature
public FeatureHolder projectChildFeatures(Feature f,
FeatureHolder parent)
ProjectionContext
projectChildFeatures in interface ProjectionContextf - the Feature to project all children ofparent - the new parent feature holder
public final Feature createFeature(Feature.Template projTempl)
throws BioException,
ChangeVetoException
ProjectionContextYou will probably implement this by delegating to the unprojected feature holder. It is imperative that the template properties are unprojected first so that when the newly created feature is projected, the properties match up.
Not every projection context has fully reversible semantics. Use your discression and come up with a reasonable plan that causes least supprise to the user.
createFeature in interface ProjectionContextprojTempl - the Feature.Template to instantiate
BioException - if there was a problem instantiating the template
ChangeVetoException - if the feature creation was vetoed
public final void removeFeature(Feature dyingChild)
throws BioException,
ChangeVetoException
ProjectionContext
removeFeature in interface ProjectionContextdyingChild - a projected feature to remove
BioException - if there is an error removing the feature
ChangeVetoException - if the removal of the feature was vetoed
public final Feature createFeature(Feature f,
Feature.Template projTempl)
throws BioException,
ChangeVetoException
ProjectionContextSee the notes for @link createFeature(Feature.Template) for implementation advice.
createFeature in interface ProjectionContextf - the parent for the newly created featureprojTempl - the Feature.Template specifying the new feature
BioException - if there was a problem creating the feature
ChangeVetoException - if the creation of the feature was vetoed
public final void removeFeature(Feature f,
Feature f2)
throws ChangeVetoException,
BioException
ProjectionContext
removeFeature in interface ProjectionContextf - the projected parent Featuref2 - the child Feature to remove
ChangeVetoException - if the removal of the feature was vetoed
BioExceptionpublic final FeatureFilter getSchema(Feature f)
public final void addChangeListener(Feature f,
ChangeListener cl,
ChangeType ct)
ProjectionContext
addChangeListener in interface ProjectionContextf - the projected Feature to add the listener forcl - the ChangeListener to addct - the ChangeType to register it for
public final void removeChangeListener(Feature f,
ChangeListener cl,
ChangeType ct)
ProjectionContext
removeChangeListener in interface ProjectionContextf - the projected Feature to remove the listener forcl - the ChangeListener to removect - the ChangeType it is registered forpublic final FeatureHolder projectFeatures(FeatureHolder fh)
ProjectionContextWarning: The results of calling this method for features that are not in getUnprojectedFeatures() is not specified by this API, but it is reasonable to assume that bad things will happen.
projectFeatures in interface ProjectionContextfh - the FeatureHolder containing the features to project
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||