org.biojava.bio.seq.projection
Class ProjectionEngine

java.lang.Object
  extended by org.biojava.bio.seq.projection.ProjectionEngine

public class ProjectionEngine
extends java.lang.Object

Factory for proxy objects which project BioJava features into alternate coordinate systems. This class binds together a feature and a ProjectionContext object, and returns the resulting projected feature. New feature-projection wrapper classes are generated automatically as they are required.

Since:
1.2
Author:
Thomas Down
For general use:
Don't use this class directly. This class contains deep voodoo code. Run away while you still can.
For advanced users:
You may find that for some bizaare reason you need to manually project a feature through a ProjectionContext. You should be using @link ProjectionContext.projectFeature(). If this is not practical for some reason, use this class. However, this probably indicates that you are doing something mad.

Projected feature classes will be named as org.biojava.bio.seq.projection.{$ctxt}.{$feat} where $ctxt and $feat are the full class names of the context and feature respectively with each "." character replaced with "_".
For developers:
Delegate into this from your ProjectionContext to do the dirty work of actually projecting features from the underlying data. This factory generate a new class that is unique to the combination of your projection context and the Feature interface that the projected feature implements. Then, it will instantiate that class with your context and the underlying feature. The returned feature will currently be an implementation of the package-private class org.biojava.bio.seq.projection.ProjectedFeature, but this is implementation detail and should not be relied upon.

Nested Class Summary
static interface ProjectionEngine.Instantiator
          Internal helper class.
static interface ProjectionEngine.TemplateProjector
          This is an interface for things that project feature templates.
 
Field Summary
static ProjectionEngine DEFAULT
          The standard projection engine object.
 
Method Summary
 Feature projectFeature(Feature f, ProjectionContext ctx)
          Return a projection of Feature f into the system defined by a given ProjectionContext.
 Feature.Template revertTemplate(Feature.Template templ, ProjectionContext ctxt)
          Revert a template so that it can be used on the original feature-space.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static final ProjectionEngine DEFAULT
The standard projection engine object.

Method Detail

projectFeature

public Feature projectFeature(Feature f,
                              ProjectionContext ctx)
Return a projection of Feature f into the system defined by a given ProjectionContext. The returned object will implement the same Feature interface (sub-interface of Feature as the underlying feature, and will also implement the Projection interface.


revertTemplate

public Feature.Template revertTemplate(Feature.Template templ,
                                       ProjectionContext ctxt)
Revert a template so that it can be used on the original feature-space.

This will use the revertFoo methods defined in the context to revert all of the transformed properties.

Parameters:
templ - the template to revert
ctxt - the context defining the reversion
Returns:
a new template of the same type as templ, with reverted fields