org.biojava.bio
Class SmallAnnotation

java.lang.Object
  extended byorg.biojava.utils.AbstractChangeable
      extended byorg.biojava.bio.AbstractAnnotation
          extended byorg.biojava.bio.SmallAnnotation
All Implemented Interfaces:
Annotation, Changeable, java.io.Serializable

public class SmallAnnotation
extends AbstractAnnotation

Annotation that is optimized for memory usage. Access time is linear, so SmallAnnotations are not recommended when the number of entries is large. However, they are fine for small numbers of keys.

Since:
1.2
Author:
Thomas Down, Matthew Pocock
See Also:
Serialized Form
For general use:
A minimal-memory alternative to SimpleAnnotation
For advanced users:
When creating a large number of small Annotation instances, it is worth instantiating SmallAnnotation. Small is anything up to at least 30 properties but will vary with the JavaVM and underlying platform.

Field Summary
 
Fields inherited from interface org.biojava.bio.Annotation
EMPTY_ANNOTATION, PROPERTY
 
Constructor Summary
SmallAnnotation()
           
SmallAnnotation(Annotation ann)
           
SmallAnnotation(java.util.Map map)
           
 
Method Summary
protected  java.util.Map getProperties()
          Implement this to return the Map delegate.
protected  boolean propertiesAllocated()
          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, 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

SmallAnnotation

public SmallAnnotation()

SmallAnnotation

public SmallAnnotation(Annotation ann)
                throws java.lang.IllegalArgumentException

SmallAnnotation

public SmallAnnotation(java.util.Map map)
Method Detail

getProperties

protected final java.util.Map getProperties()
Description copied from class: AbstractAnnotation
Implement this to return the Map delegate. From code in the 1.2 version of AbstractAnnotation

Specified by:
getProperties in class AbstractAnnotation

propertiesAllocated

protected final boolean propertiesAllocated()
Description copied from class: AbstractAnnotation
A convenience method to see if we have allocated the properties Map.

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