peakml
Class Annotatable

java.lang.Object
  extended by peakml.Annotatable
Direct Known Subclasses:
FileInfo, Header, IPeak, MeasurementInfo, SampleInfo, ScanInfo

public abstract class Annotatable
extends java.lang.Object

Base-class for all classes that support annotations.


Constructor Summary
Annotatable()
           
 
Method Summary
 void addAnnotation(Annotation annotation)
          Adds the given annotation instance to the hashmap.
 void addAnnotation(java.lang.String label, double value)
          Creates a new annotation with the given label and value, where the valuetype is automatically set to DOUBLE.
 void addAnnotation(java.lang.String label, int value)
          Creates a new annotation with the given label and value, where the valuetype is automatically set to INTEGER.
 void addAnnotation(java.lang.String label, java.lang.String value)
          Creates a new annotation with the given label and value, where the valuetype is automatically set to STRING.
 void addAnnotation(java.lang.String label, java.lang.String value, Annotation.ValueType valuetype)
          Creates a new annotation with the given label, value, and valuetype.
 void addAnnotations(java.util.Collection<Annotation> list)
          Adds the list of annotations to the hashmap.
 Annotation getAnnotation(java.lang.String name)
          Returns the annotation with the given name, stored in this peak.
 java.util.HashMap<java.lang.String,Annotation> getAnnotations()
          Returns the hashmap containing all the annotations.
 void removeAllAnnotations()
          Removes all annotations from the list.
 void removeAnnotation(java.lang.String label)
          Removes annotation with the given label from the list.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Annotatable

public Annotatable()
Method Detail

getAnnotations

public final java.util.HashMap<java.lang.String,Annotation> getAnnotations()
Returns the hashmap containing all the annotations. This is a reference to the hashmap maintained within the class and should not be altered, but only used for access purposes.

Returns:
The hashmap with all the annotations associated to this peak.

getAnnotation

public Annotation getAnnotation(java.lang.String name)
Returns the annotation with the given name, stored in this peak. When a non-existing name is passed the method returns null.

Parameters:
name - The name of the annotation.
Returns:
The annotation with the given name, null when non-existing.

addAnnotation

public void addAnnotation(Annotation annotation)
Adds the given annotation instance to the hashmap. When the label of this annotation is already present in the hashmap, the old annotation is overwritten.

Parameters:
annotation - The new annotation.

addAnnotations

public void addAnnotations(java.util.Collection<Annotation> list)
Adds the list of annotations to the hashmap. Annotations with the same name are overwritten.

Parameters:
list - The list with annotations.

addAnnotation

public void addAnnotation(java.lang.String label,
                          java.lang.String value)
Creates a new annotation with the given label and value, where the valuetype is automatically set to STRING. The new annotation is consequently added to the hashmap with addAnnotation(Annotation annotation).

Parameters:
label - The label of the annotation.
value - The value of the annotation.

addAnnotation

public void addAnnotation(java.lang.String label,
                          int value)
Creates a new annotation with the given label and value, where the valuetype is automatically set to INTEGER. The new annotation is consequently added to the hashmap with addAnnotation(Annotation annotation).

Parameters:
label - The label of the annotation.
value - The value of the annotation.

addAnnotation

public void addAnnotation(java.lang.String label,
                          double value)
Creates a new annotation with the given label and value, where the valuetype is automatically set to DOUBLE. The new annotation is consequently added to the hashmap with addAnnotation(Annotation annotation).

Parameters:
label - The label of the annotation.
value - The value of the annotation.

addAnnotation

public void addAnnotation(java.lang.String label,
                          java.lang.String value,
                          Annotation.ValueType valuetype)
Creates a new annotation with the given label, value, and valuetype. The new annotation is consequently added to the hashmap with addAnnotation(Annotation annotation).

Parameters:
label - The label of the annotation.
value - The value of the annotation.
valuetype - The type of the annotation.

removeAnnotation

public void removeAnnotation(java.lang.String label)
Removes annotation with the given label from the list.

Parameters:
label - The label of the annotation to be removed.

removeAllAnnotations

public void removeAllAnnotations()
Removes all annotations from the list.