edu.mssm.crover.representation
Class Annotations

java.lang.Object
  |
  +--edu.mssm.crover.representation.Annotations
All Implemented Interfaces:
BiologicalAnnotations, RootObject, java.io.Serializable

public class Annotations
extends java.lang.Object
implements BiologicalAnnotations, java.io.Serializable

Default implementation of BiologicalAnnotations. Stores the annotations attached to a sequence.

Author:
Fabien Campagne
See Also:
Serialized Form

Constructor Summary
Annotations()
           
 
Method Summary
 void addAnnotation(BiologicalAnnotation a)
          Adds an annotation to this list.
 java.lang.Object findAnnotation(java.lang.Class annotation_class)
          Finds and return an annotation according to its class.
 java.lang.Object findAnnotation(java.lang.Class annotation_class, int seq_pos)
          Finds and return an annotation about a residue, according to its class.
 BiologicalAnnotation[] getAnnotations()
          Returns these annotations as an array of BiologicalAnnotation.
 java.net.URL getResidueURL(int position)
          Returns the URL anchored to the residue at the index position.
static void main(java.lang.String[] args)
          Tests various features of this class.
 boolean removeAnnotation(BiologicalAnnotation a)
          Removes an annotation from this list.
 java.lang.String toString()
          Prints the content of this annotation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Annotations

public Annotations()
Method Detail

addAnnotation

public void addAnnotation(BiologicalAnnotation a)
Adds an annotation to this list. The annotation is added at the end of the list. The semantic of the order of annotation is not clearly defined at the moment.

Specified by:
addAnnotation in interface BiologicalAnnotations

removeAnnotation

public boolean removeAnnotation(BiologicalAnnotation a)
Removes an annotation from this list.

Specified by:
removeAnnotation in interface BiologicalAnnotations

getAnnotations

public BiologicalAnnotation[] getAnnotations()
Returns these annotations as an array of BiologicalAnnotation. Do not modify the elements of the array unless you want to change the annotations: the elements are referenced, not cloned.

Specified by:
getAnnotations in interface BiologicalAnnotations

getResidueURL

public java.net.URL getResidueURL(int position)
Returns the URL anchored to the residue at the index position. The index is relative to the sequence these annotations are attached to. Returns null if no such URL_Annotation is described in the list.

Specified by:
getResidueURL in interface BiologicalAnnotations

findAnnotation

public java.lang.Object findAnnotation(java.lang.Class annotation_class)
Finds and return an annotation according to its class.

Specified by:
findAnnotation in interface BiologicalAnnotations
Returns:
The annotation that supports the interface required or null if none was found.

findAnnotation

public java.lang.Object findAnnotation(java.lang.Class annotation_class,
                                       int seq_pos)
Finds and return an annotation about a residue, according to its class.

Parameters:
annotation_class - The class of the annotation to search for.
seq_pos - The position on the sequence that an annotation must describe to be returned.
Returns:
The annotation that supports the interface required or null if none was found.

toString

public java.lang.String toString()
Prints the content of this annotation. The output is a default, every bit printed, text form.

Specified by:
toString in interface BiologicalAnnotations
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)
Tests various features of this class.



Copyright @ 2003 Mount Sinai School of Medicine. All Rights Reserved.