public class SimpleRichFeature extends AbstractChangeable implements RichFeature
RichFeature.Template, RichFeature.ToolsStrandedFeature.StrandFeature.ByLocationComparatorFeatureHolder.EmptyFeatureHolderAnnotatable.AnnotationForwarderCROSSREF, LOCATION, NAME, PARENT, RANK, RELATION, SOURCETERM, TYPETERMNEGATIVE, POSITIVE, STRAND, UNKNOWNbyLocationOrder, PROPERTY_DATA_KEY, SOURCE, TYPEEMPTY_FEATURE_HOLDER, FEATURES, SCHEMAANNOTATION| Modifier | Constructor and Description |
|---|---|
protected |
SimpleRichFeature() |
|
SimpleRichFeature(FeatureHolder parent,
Feature.Template templ)
Creates a new instance of SimpleRichFeature based on a template.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFeatureRelationship(RichFeatureRelationship relationship)
Adds a relationship to this feature holder.
|
void |
addRankedCrossRef(RankedCrossRef crossref)
Adds a ranked cross reference to the existing set.
|
int |
compareTo(Object o)
Features are sorted first by rank, then parent, type, and source.
|
boolean |
containsFeature(Feature f)
Check if the feature is present in this holder.
|
int |
countFeatures()
Count how many features are contained.
|
Feature |
createFeature(Feature.Template ft)
Create a new Feature, and add it to this FeatureHolder.
|
boolean |
equals(Object o)
Features are equal when they have the same rank, parent, type, and source.
|
Iterator |
features()
Iterate over any child features which are held by this
feature.
|
FeatureHolder |
filter(FeatureFilter filter)
Query this set of features using a supplied
FeatureFilter. |
FeatureHolder |
filter(FeatureFilter fc,
boolean recurse)
Return a new FeatureHolder that contains all of the children of this one
that passed the filter fc.
|
Annotation |
getAnnotation()
Should return the associated annotation object.
|
Set<RichFeatureRelationship> |
getFeatureRelationshipSet()
Returns the set of relationships held in this feature holder.
|
Integer |
getId()
Gets the Hibernate ID.
|
Location |
getLocation()
The location of this feature.
|
String |
getName()
Returns the name of this feature.
|
Set |
getNoteSet()
Returns the set of notes associated with this object.
|
FeatureHolder |
getParent()
Return the
FeatureHolder to which this feature has been
attached. |
int |
getRank()
Returns the rank of this feature.
|
Set<RankedCrossRef> |
getRankedCrossRefs()
Returns the set of all ranked cross references associated with an object.
|
RichAnnotation |
getRichAnnotation()
Return the associated annotation object.
|
FeatureFilter |
getSchema()
Return a schema-filter for this
FeatureHolder. |
Sequence |
getSequence()
Return the
Sequence object to which this feature
is (ultimately) attached. |
String |
getSource()
The source of the feature.
|
Term |
getSourceTerm()
An ontology term defining the source of this feature.
|
StrandedFeature.Strand |
getStrand()
Retrieve the strand that this feature lies upon.
|
SymbolList |
getSymbols()
Return a list of symbols that are contained in this feature.
|
String |
getType()
The type of the feature.
|
Term |
getTypeTerm()
An ontology term defining the type of feature.
|
int |
hashCode() |
Feature.Template |
makeTemplate()
Create a new Template that could be used to generate a feature identical
to this one.
|
void |
removeFeature(Feature f)
Remove a feature from this FeatureHolder.
|
void |
removeFeatureRelationship(RichFeatureRelationship relationship)
Removes a relationship from this feature holder.
|
void |
removeRankedCrossRef(RankedCrossRef crossref)
Removes a ranked cross reference from the existing set.
|
void |
setFeatureRelationshipSet(Set<RichFeatureRelationship> relationships)
Clears the relations from this feature holder and replaces them with a new set.
|
void |
setId(Integer id)
Sets the Hibernate ID.
|
void |
setLocation(Location loc)
The new location for this feature.
|
void |
setName(String name)
Sets the name of this feature.
|
void |
setNoteSet(Set notes)
Clears the notes associated with this object and replaces them with
the contents of this set.
|
void |
setParent(FeatureHolder parent)
Sets the parent of this feature.
|
void |
setRank(int rank)
Sets the rank of this feature.
|
void |
setRankedCrossRefs(Set crossrefs)
Sets the ranked cross references associated with an object.
|
void |
setSource(String source)
Change the source of the Feature.
|
void |
setSourceTerm(Term t)
Set the source ontology-term for this feature.
|
void |
setStrand(StrandedFeature.Strand strand)
Set the strand that this feature lies upon.
|
void |
setType(String type)
Change the type of this feature.
|
void |
setTypeTerm(Term t)
Set the type ontology-term for this feature.
|
String |
toString()
Form: "(#rank) parent:type,source(location)"
|
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListenerclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListenerpublic SimpleRichFeature(FeatureHolder parent, Feature.Template templ) throws ChangeVetoException, InvalidTermException
parent - The parent feature holder.templ - The template to construct the feature from.ChangeVetoException - if we don't want to be like the template.InvalidTermException - if any of the template terms are bad.protected SimpleRichFeature()
public Feature.Template makeTemplate()
makeTemplate in interface Featurepublic Annotation getAnnotation()
getAnnotation in interface Annotatablepublic RichAnnotation getRichAnnotation()
getRichAnnotation in interface RichAnnotatablepublic Set getNoteSet()
getNoteSet in interface RichAnnotatableNotepublic void setNoteSet(Set notes) throws ChangeVetoException
setNoteSet in interface RichAnnotatablenotes - the set of Note objects to replace the existing ones with.ChangeVetoException - if the set is null or contains any objects
that are not Note objects.Notepublic void setName(String name) throws ChangeVetoException
setName in interface RichFeaturename - the name the feature should identify itself with.ChangeVetoException - if the new value is unacceptable.public String getName()
getName in interface RichFeaturepublic void setRank(int rank) throws ChangeVetoException
setRank in interface RichFeaturerank - the rank the feature should identify itself with.ChangeVetoException - if the new value is unacceptable.public int getRank()
getRank in interface RichFeaturepublic Sequence getSequence()
Sequence object to which this feature
is (ultimately) attached. For top level features, this will be
equal to the FeatureHolder returned by
getParent.getSequence in interface Featurepublic void setSource(String source) throws ChangeVetoException
setSource in interface Featuresource - the new source StringChangeVetoException - if the source can't be alteredpublic Term getSourceTerm()
OntoTools.ANY
in implementations which aren't ontology aware.getSourceTerm in interface Featurepublic void setSourceTerm(Term t) throws ChangeVetoException, InvalidTermException
setSourceTerm in interface FeatureChangeVetoException - if changes are not allowedInvalidTermException - if the specified term is not an acceptable type
for this feature.public void setType(String type) throws ChangeVetoException
setType in interface Featuretype - new type StringChangeVetoException - if the type can't be alteredpublic Term getTypeTerm()
OntoTools.ANY
in implementations which aren't ontology aware.getTypeTerm in interface Featurepublic void setTypeTerm(Term t) throws ChangeVetoException, InvalidTermException
setTypeTerm in interface FeatureChangeVetoException - if changes are not allowedInvalidTermException - if the specified term is not an acceptable type
for this feature.public SymbolList getSymbols()
The symbols may not be contiguous in the original sequence, but they will be concatenated together in the resulting SymbolList.
The order of the Symbols within the resulting symbol list will be according to the concept of ordering within the location object.
If the feature is on the negative strand then the SymbolList will be reverse-complemented as appropriate.
getSymbols in interface FeaturegetSymbols in interface StrandedFeaturepublic Location getLocation()
The location may be complicated, or simply a range. The annotation is assumed to apply to all the region contained within the location.
getLocation in interface Featurepublic void setLocation(Location loc) throws ChangeVetoException
The location may be complicated or simply a range. The annotation is assumed to apply to the entire region contained within the location. Any values returned from methods that rely on the old location must not be affected.
setLocation in interface Featureloc - the new Location for this featureChangeVetoException - if the location can't be alteredpublic FeatureHolder getParent()
FeatureHolder to which this feature has been
attached. This will be a Sequence object for top level
features, and a Feature object for features further
down the tree.public void setParent(FeatureHolder parent) throws ChangeVetoException
setParent in interface RichFeatureparent - the parent the feature should identify itself with.ChangeVetoException - if the new value is unacceptable.public Set<RankedCrossRef> getRankedCrossRefs()
getRankedCrossRefs in interface RankedCrossRefablepublic void setRankedCrossRefs(Set crossrefs) throws ChangeVetoException
setRankedCrossRefs in interface RankedCrossRefablecrossrefs - a set of RankedCrossRef objects.ChangeVetoException - if the set was null or any of its contents
were not RankedCrossRef objects.public void addRankedCrossRef(RankedCrossRef crossref) throws ChangeVetoException
addRankedCrossRef in interface RankedCrossRefablecrossref - the ranked cross reference to add.ChangeVetoException - if the parameter is null.public void removeRankedCrossRef(RankedCrossRef crossref) throws ChangeVetoException
removeRankedCrossRef in interface RankedCrossRefablecrossref - the ranked cross reference to remove.ChangeVetoException - if the parameter is null.public Set<RichFeatureRelationship> getFeatureRelationshipSet()
getFeatureRelationshipSet in interface RichFeatureRelationshipHolderpublic void setFeatureRelationshipSet(Set<RichFeatureRelationship> relationships) throws ChangeVetoException
setFeatureRelationshipSet in interface RichFeatureRelationshipHolderrelationships - the new set of features this holder should have. The set must
contain only RichFeatureRelationship objects.ChangeVetoException - if the new set could not be installed.public void addFeatureRelationship(RichFeatureRelationship relationship) throws ChangeVetoException
addFeatureRelationship in interface RichFeatureRelationshipHolderrelationship - the relationship to add.ChangeVetoException - if the relationship is unacceptable.public void removeFeatureRelationship(RichFeatureRelationship relationship) throws ChangeVetoException
removeFeatureRelationship in interface RichFeatureRelationshipHolderrelationship - the relationship to remove.ChangeVetoException - if it cannot be removed.public boolean containsFeature(Feature f)
containsFeature in interface FeatureHolderf - the Feature to checkpublic int countFeatures()
countFeatures in interface FeatureHolderpublic Feature createFeature(Feature.Template ft) throws BioException, ChangeVetoException
createFeature in interface FeatureHolderBioException - if something went wrong during creating the featureChangeVetoException - if this FeatureHolder does not support
creation of new features, or if the change was vetoedpublic Iterator features()
features in interface Featurefeatures in interface FeatureHolderpublic FeatureHolder filter(FeatureFilter filter)
FeatureFilter.filter in interface FeatureHolderfilter - the FeatureFilter to apply.filter.public FeatureHolder filter(FeatureFilter fc, boolean recurse)
filter in interface FeatureHolderfc - the FeatureFilter to applyrecurse - true if all features-of-features should be scanned, and a
single flat collection of features returned, or false if
just immediate children should be filtered.public FeatureFilter getSchema()
FeatureHolder. This is a filter
which all Features immediately contained by this FeatureHolder
will match. It need not directly match their child features, but it can (and should!) provide
information about them using FeatureFilter.OnlyChildren filters. In cases where there
is no feature hierarchy, this can be indicated by including FeatureFilter.leaf in
the schema filter.
For the truly non-informative case, it is possible to return FeatureFilter.all. However,
it is almost always possible to provide slightly more information that this. For example, Sequence
objects should, at a minimum, return FeatureFilter.top_level. Feature objects
should, as a minimum, return FeatureFilter.ByParent(new FeatureFilter.ByFeature(this)).
getSchema in interface FeatureHolderpublic void removeFeature(Feature f) throws ChangeVetoException, BioException
removeFeature in interface FeatureHolderChangeVetoException - if this FeatureHolder does not support
feature removal or if the change was vetoedBioException - if there was an error removing the featurepublic void setStrand(StrandedFeature.Strand strand) throws ChangeVetoException
This will be one of StrandedFeature.POSITIVE or NEGATIVE. NOT IMPLEMENTED.
setStrand in interface StrandedFeaturestrand - a Strand.ChangeVetoException - if the strand may not be
changed.public StrandedFeature.Strand getStrand()
This will be one of StrandedFeature.POSITIVE or NEGATIVE.
getStrand in interface StrandedFeaturepublic boolean equals(Object o)
public int compareTo(Object o)
compareTo in interface Comparablepublic Integer getId()
Copyright © 2014 BioJava. All rights reserved.