## org.biojava.bio.seq
Interface FeatureHolder

All Known Subinterfaces:
  Feature, RealizingFeatureHolder, Sequence, StrandedFeature

All Known Implementing Classes:
  AbstractFeatureHolder, FeatureHolder.EmptyFeatureHolder

public interface FeatureHolder

The interface for objects that contain features.

Feature holders abstract the containment of a feature from the objects that implements both the real container or the features. FeatureHolders are like sets of features.

Author:
  Matthew Pocock, Thomas Down

Inner Class Summary
`static class` `FeatureHolder.EmptyFeatureHolder`

Field Summary
`static FeatureHolder` `EMPTY_FEATURE_HOLDER`

Method Summary
`int` `countFeatures()` Count how many features are contained.
`Feature` `createFeature(Feature.Template ft)` Create a new Feature, and add it to this FeatureHolder.
`java.util.Iterator` `features()` Iterate over the features in no well defined order.
`FeatureHolder` `filter(FeatureFilter fc, boolean recurse)` Return a new FeatureHolder that contains all of the children of this one that passed the filter fc.
`void` `removeFeature(Feature f)` Remove a feature from this FeatureHolder.

Field Detail

### EMPTY_FEATURE_HOLDER

    public static final FeatureHolder EMPTY_FEATURE_HOLDER

Method Detail

### countFeatures

    public int countFeatures()

  Count how many features are contained.
  Returns:
    a positive integer or zero, equal to the number of features contained

### features

    public java.util.Iterator features()

  Iterate over the features in no well defined order.
  Returns:
    an Iterator

### filter

    public FeatureHolder filter(FeatureFilter fc,
                                boolean recurse)

  Return a new FeatureHolder that contains all of the children of this one that passed the filter fc.
  Parameters:
    `fc` - the FeatureFilter to apply
    `recurse` - 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.

### createFeature

    public Feature createFeature(Feature.Template ft)
                          throws BioException

  Create a new Feature, and add it to this FeatureHolder. This method will generally only work on Sequences, and on some Features which have been attached to Sequences.
  Throws:
    java.lang.UnsupportedOperationException - if this FeatureHolder does not support addition of new features.

### removeFeature

    public void removeFeature(Feature f)

  Remove a feature from this FeatureHolder.
  Throws:
    java.lang.UnsupportedOperationException - if this FeatureHolder does not support feature removal.