Package org.biojavax
Class EmptyRichAnnotation
java.lang.Object
org.biojava.utils.Unchangeable
org.biojavax.EmptyRichAnnotation
- All Implemented Interfaces:
Serializable,Annotation,Changeable,RichAnnotation
A place holder for a RichAnnotation that prevents null having to be used
- Since:
- 1.5
- Author:
- Mark Schreiber, Richard Holland
- See Also:
-
Field Summary
Fields inherited from interface org.biojava.bio.Annotation
PROPERTYFields inherited from interface org.biojavax.RichAnnotation
EMPTY_ANNOTATION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a note to this annotation.asMap()Return a map that contains the same key/values as this Annotation.voidclear()Removes all notes from this annotation object.booleanReturns true if the given note exists in this annotation.booleancontainsProperty(Object key) Returns whether there the property is defined.booleanUses the term and rank to lookup a note in this annotation.Returns an immutable set of all notes in this annotation.Note[]getProperties(Object key) Find all theNotes with any rank that match the key.getProperty(Object key) Retrieve the value of a property by key.inthashCode()keys()Get a set of key objects.voidremoveNote(Note note) Removes a note from this annotation.voidremoveProperty(Object key) Delete a property.voidsetNoteSet(Set notes) Clears the notes from this annotation and replaces them with those from the given set.voidsetProperty(Object key, Object value) Set the value of a property.Methods inherited from class org.biojava.utils.Unchangeable
addChangeListener, addChangeListener, addForwarder, getForwarders, getListeners, isUnchanging, removeChangeListener, removeChangeListener, removeForwarderMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
Constructor Details
-
EmptyRichAnnotation
public EmptyRichAnnotation()
-
-
Method Details
-
getProperty
Retrieve the value of a property by key.
Unlike the Map collections, it will complain if the key does not exist. It will only return null if the key is defined and has value null.
Normal raw access to the property. For cleverer access, use methods in AnnotationType. There are no properties in the Empty RichAnnotation object. Calling this will return null.- Specified by:
getPropertyin interfaceAnnotation- Parameters:
key- the key of the property to retrieve- Returns:
- the object associated with that key
- Throws:
NoSuchElementException- if there is no property with the key
-
getProperties
Find all theNotes with any rank that match the key. There are no properties in the Empty RichAnnotation object. Calling this will return an empty array.- Specified by:
getPropertiesin interfaceRichAnnotation- 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:
-
getNote
Uses the term and rank to lookup a note in this annotation. There are no notes in the Empty RichAnnotation object. Calling this will return null.- Specified by:
getNotein interfaceRichAnnotation- Parameters:
note- note to lookup, using term and rank.- Returns:
- the matching note.
-
setProperty
Set the value of a property.
This method throws an exception if either properties can not be added to this object, or that this particular property is immutable or illegal within the implementation.
Normal raw access to the property. For cleverer access, use methods in AnnotationType. You can not add properties to the Empty RichAnnotation object- Specified by:
setPropertyin interfaceAnnotation- Parameters:
key- the key objectvalue- the new value for this key- Throws:
ChangeVetoException- whenever you call this method.
-
setNoteSet
Clears the notes from this annotation and replaces them with those from the given set. The set cannot be null. You can not add Notes to the Empty RichAnnotation object.- Specified by:
setNoteSetin interfaceRichAnnotation- Parameters:
notes- a set of Note objects to use from now on.- Throws:
ChangeVetoException- whenever you call this method.- See Also:
-
addNote
Adds a note to this annotation. Must not be null. If the note is already in the annotation, nothing happens. You can not add Notes to the Empty RichAnnotation object.- Specified by:
addNotein interfaceRichAnnotation- Parameters:
note- note to add- Throws:
ChangeVetoException- whenever you call this method.
-
clear
Removes all notes from this annotation object. Does nothing as it contains nothing.- Specified by:
clearin interfaceRichAnnotation- Throws:
ChangeVetoException- if it couldn't do it.
-
removeProperty
Delete a property. Normal raw access to the property. For cleverer access, use methods in AnnotationType. You cannot remove properties from the Empty RichAnnotation- Specified by:
removePropertyin interfaceAnnotation- Parameters:
key- the key object- Throws:
ChangeVetoException- whenever you call this method.
-
removeNote
Removes a note from this annotation. Must not be null. If the note wasn't in the annotation, nothing happens. You cannot remove notes from the Empty RichAnnotation- Specified by:
removeNotein interfaceRichAnnotation- Parameters:
note- note to remove- Throws:
ChangeVetoException- whenever you call this method.
-
containsProperty
Returns whether there the property is defined. Normal raw access to the property. For cleverer access, use methods in AnnotationType.- Specified by:
containsPropertyin interfaceAnnotation- Parameters:
key- the key Object to search for- Returns:
- always false as there are no properties
-
contains
Returns true if the given note exists in this annotation. The lookup is done using the term and rank of the note.- Specified by:
containsin interfaceRichAnnotation- Parameters:
note- note to lookup- Returns:
- always false as there are no notes
-
keys
Get a set of key objects.- Specified by:
keysin interfaceAnnotation- Returns:
- an empty set
-
getNoteSet
Returns an immutable set of all notes in this annotation.- Specified by:
getNoteSetin interfaceRichAnnotation- Returns:
- an empty set
- See Also:
-
asMap
Return a map that contains the same key/values as this Annotation.If the annotation changes, the map may not reflect this. The Map may be unmodifiable.
- Specified by:
asMapin interfaceAnnotation- Returns:
- an new Map with no entries
-
hashCode
-
equals
-