Package 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
Fields Modifier and Type Field Description static RichAnnotationEMPTY_ANNOTATION-
Fields inherited from interface org.biojava.bio.Annotation
PROPERTY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddNote(Note note)Adds a note to this annotation.voidclear()Removes all notes from this annotation object.booleancontains(Note note)Returns true if the given note exists in this annotation.NotegetNote(Note note)Uses the term and rank to lookup a note in this annotation.Set<Note>getNoteSet()Returns an immutable set of all notes in this annotation.Note[]getProperties(Object key)Find all theNotes with any rank that match the key.voidremoveNote(Note note)Removes a note from this annotation.voidsetNoteSet(Set<Note> 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<Note> getNoteSet()
Returns an immutable set of all notes in this annotation.- Returns:
- a set of notes.
- See Also:
Note
-
setNoteSet
void setNoteSet(Set<Note> 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 theNotes with any rank that match the key.- Parameters:
key- either aStringidentifier of a term from the default ontology or aComparableTerm- Returns:
- an array of matching
Notesin order of rank or an empty array if there are no matches. No implementation should ever return null! - See Also:
Note,ComparableTerm
-
-