org.biojavax
Interface RichAnnotation

All Superinterfaces:
Annotation, Changeable
All Known Implementing Classes:
EmptyRichAnnotation, SimpleRichAnnotation

public interface RichAnnotation
extends Annotation

An annotation collection which stores annotations as Note objects.

Since:
1.5
Author:
Richard Holland, Mark Schreiber
See Also:
Note, RichAnnotatable

Field Summary
static RichAnnotation EMPTY_ANNOTATION
           
 
Fields inherited from interface org.biojava.bio.Annotation
PROPERTY
 
Method Summary
 void addNote(Note note)
          Adds a note to this annotation.
 void clear()
          Removes all notes from this annotation object.
 boolean contains(Note note)
          Returns true if the given note exists in this annotation.
 Note getNote(Note note)
          Uses the term and rank to lookup a note in this annotation.
 Set getNoteSet()
          Returns an immutable set of all notes in this annotation.
 Note[] getProperties(Object key)
          Find all the Notes with any rank that match the key.
 void removeNote(Note note)
          Removes a note from this annotation.
 void setNoteSet(Set notes)
          Clears the notes from this annotation and replaces them with those from the given set.
 
Methods inherited from interface org.biojava.bio.Annotation
asMap, containsProperty, getProperty, keys, removeProperty, setProperty
 
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
 

Field Detail

EMPTY_ANNOTATION

static final RichAnnotation EMPTY_ANNOTATION
Method Detail

clear

void clear()
           throws ChangeVetoException
Removes all notes from this annotation object.

Throws:
ChangeVetoException - if it couldn't do it.

addNote

void addNote(Note note)
             throws ChangeVetoException
Adds a note to this annotation. Must not be null. If the note is already in the annotation, nothing happens.

Parameters:
note - note to add
Throws:
ChangeVetoException - if it doesn't like this.

removeNote

void removeNote(Note note)
                throws ChangeVetoException
Removes a note from this annotation. Must not be null. If the note wasn't in the annotation, nothing happens.

Parameters:
note - note to remove
Throws:
ChangeVetoException - if it doesn't like this.

getNote

Note getNote(Note note)
             throws NoSuchElementException
Uses the term and rank to lookup a note in this annotation.

Parameters:
note - note to lookup, using term and rank.
Returns:
the matching note.
Throws:
ChangeVetoException - if it doesn't like this.
NoSuchElementException - if it couldn't be found.

contains

boolean contains(Note note)
Returns true if the given note exists in this annotation. The lookup is done using the term and rank of the note.

Parameters:
note - note to lookup
Returns:
true if it is in this annotation, false if not.

getNoteSet

Set getNoteSet()
Returns an immutable set of all notes in this annotation.

Returns:
a set of notes.
See Also:
Note

setNoteSet

void setNoteSet(Set notes)
                throws ChangeVetoException
Clears the notes from this annotation and replaces them with those from the given set. The set cannot be null.

Parameters:
notes - a set of Note objects to use from now on.
Throws:
ChangeVetoException - if it doesn't like any of them.
See Also:
Note

getProperties

Note[] getProperties(Object key)
Find all the Notes with any rank that match the key.

Parameters:
key - either a String identifier of a term from the default onltology or a ComparableTerm
Returns:
an array of matching Notes in order of rank or an empty array if there are no matches. No implementation should ever return null!
See Also:
Note, ComparableTerm