org.biojava.bio
Class AnnotationChanger

java.lang.Object
  extended by org.biojava.utils.AbstractChangeable
      extended by org.biojava.bio.AbstractAnnotation
          extended by org.biojava.bio.AnnotationChanger
All Implemented Interfaces:
java.io.Serializable, Annotation, Changeable

public class AnnotationChanger
extends AbstractAnnotation

AnnotationChanger remaps the values of an Annotation to new values specified by a ValueChanger. This will modify the values associated with properties, but not the property names.

Since:
1.3
Author:
Matthew Pocock
See Also:
Serialized Form
For advanced users:
For writing light-weigth adaptors to project one type of Annotation to another using a ChangeTable.

Field Summary
 
Fields inherited from interface org.biojava.bio.Annotation
EMPTY_ANNOTATION, PROPERTY
 
Constructor Summary
AnnotationChanger(Annotation wrapped, ChangeTable changer)
          Creates a new AnnotationChanger using the specified ValueChanger to remap its values.
 
Method Summary
 ChangeTable getChanger()
          getMapper returns the ValueChanger being used to remap the Annotation.
 java.util.Map getProperties()
          getProperties returns the mapped contents of the underlying Annotation as a Map.
 Annotation getWrapped()
          getWrapped returns the Annotation being remapped.
 boolean propertiesAllocated()
          propertiesAllocated is a convenience method to see if we have allocated the properties Map.
 
Methods inherited from class org.biojava.bio.AbstractAnnotation
asMap, containsProperty, equals, getProperty, hashCode, keys, removeProperty, setProperty, toString
 
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
 

Constructor Detail

AnnotationChanger

public AnnotationChanger(Annotation wrapped,
                         ChangeTable changer)
Creates a new AnnotationChanger using the specified ValueChanger to remap its values.

Parameters:
wrapped - an Annotation.
changer - a ValueChanger.
Method Detail

getWrapped

public Annotation getWrapped()
getWrapped returns the Annotation being remapped.

Returns:
an Annotation.

getChanger

public ChangeTable getChanger()
getMapper returns the ValueChanger being used to remap the Annotation.

Returns:
a ValueChanger.

getProperties

public java.util.Map getProperties()
getProperties returns the mapped contents of the underlying Annotation as a Map.

Specified by:
getProperties in class AbstractAnnotation
Returns:
a Map.

propertiesAllocated

public boolean propertiesAllocated()
propertiesAllocated is a convenience method to see if we have allocated the properties Map.

Specified by:
propertiesAllocated in class AbstractAnnotation
Returns:
a boolean true if the properties have been allocated, false otherwise.