## org.biojava.bio.seq
Class SimpleFeatureRealizer

    java.lang.Object
      |
      +--org.biojava.bio.seq.SimpleFeatureRealizer

public class SimpleFeatureRealizer
extends java.lang.Object
implements FeatureRealizer, java.io.Serializable

FeatureRealizer which uses a lookup table to map template classes to implementations. Optionally, this implementation can fall back on another FeatureRealizer if it fails.

When searching for a Feature implementation to match a specific Feature.Template class, the following search order is used:

1. Mappings added to this SimpleFeatureRealizer, in reverse order of addition.
2. Any mappings known to the fallback realizer, if one is installed.
3. If no mapping can be found, a BioException is thrown.

Author:
  Thomas Down
See Also:
  Serialized Form

Field Summary
`static FeatureRealizer` `DEFAULT` Default implementation of FeatureRealizer, which wraps simple implementations of Feature and StrandedFeature.

Constructor Summary
`SimpleFeatureRealizer()`
`SimpleFeatureRealizer(FeatureRealizer fallBack)`

Method Summary
`void` `addImplementation(java.lang.Class template, java.lang.Class impl)` Install a new mapping from a class of Feature.Template to a class of Feature implementations.
`Feature` `realizeFeature(Sequence seq, FeatureHolder parent, Feature.Template temp)` Install a feature on the specified sequence.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT

    public static final FeatureRealizer DEFAULT

  Default implementation of FeatureRealizer, which wraps simple implementations of Feature and StrandedFeature. This is the default FeatureRealizer used by SimpleSequence and ViewSequence, and may also be used by others. When building new FeatureRealizers, you may wish to use this as a `fallback' realizer, and benefit from the Feature and StrandedFeature implementations.

Constructor Detail

### SimpleFeatureRealizer

    public SimpleFeatureRealizer()

### SimpleFeatureRealizer

    public SimpleFeatureRealizer(FeatureRealizer fallBack)

Method Detail

### addImplementation

    public void addImplementation(java.lang.Class template,
                                  java.lang.Class impl)
                           throws BioException

  Install a new mapping from a class of Feature.Template to a class of Feature implementations. The implementation class MUST have a public constructor of the form (Sequence, FeatureHolder, Feature.Template).

  A newly added implementation takes precendence over any existing implementations if a template can be realized by more than one implementation.

  Parameters:
    `template` - The class of templates to implement.
    `impl` - A class of Feature which can be used to implement these templates.

### realizeFeature

    public Feature realizeFeature(Sequence seq,
                                  FeatureHolder parent,
                                  Feature.Template temp)
                           throws BioException

  Description copied from interface: FeatureRealizer
  Install a feature on the specified sequence.
  Specified by:
    realizeFeature in interface FeatureRealizer
  Tags copied from interface: FeatureRealizer
  Parameters:
    `seq` - The sequence to which the feature will be added.
    `template` - A description of the desired feature.
    `parent` - The FeatureHolder which is to be the Feature's immediate parent.
  Throws:
    BioException - If the feature could not be constructed.