|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.biojava.utils.Unchangeable
org.biojavax.EmptyRichAnnotation
public class EmptyRichAnnotation
A place holder for a RichAnnotation that prevents null having to be used
Field Summary |
---|
Fields inherited from interface org.biojavax.RichAnnotation |
---|
EMPTY_ANNOTATION |
Fields inherited from interface org.biojava.bio.Annotation |
---|
PROPERTY |
Constructor Summary | |
---|---|
EmptyRichAnnotation()
|
Method Summary | |
---|---|
void |
addNote(Note note)
Adds a note to this annotation. You can not add Notes to the Empty RichAnnotation object. |
Map |
asMap()
Return a map that contains the same key/values as this Annotation. |
void |
clear()
Removes all notes from this annotation object. Does nothing as it contains nothing. |
boolean |
contains(Note note)
Returns true if the given note exists in this annotation. |
boolean |
containsProperty(Object key)
Returns whether there the property is defined. |
boolean |
equals(Object o)
|
Note |
getNote(Note note)
Uses the term and rank to lookup a note in this annotation. There are no notes in the Empty RichAnnotation object. |
Set |
getNoteSet()
Returns an immutable set of all notes in this annotation. |
Note[] |
getProperties(Object key)
Find all the Note s with any rank that match the key. There are no properties in the Empty RichAnnotation object. |
Object |
getProperty(Object key)
Retrieve the value of a property by key. There are no properties in the Empty RichAnnotation object. |
int |
hashCode()
|
Set |
keys()
Get a set of key objects. |
void |
removeNote(Note note)
Removes a note from this annotation. You cannot remove notes from the Empty RichAnnotation |
void |
removeProperty(Object key)
Delete a property. You cannot remove properties from the Empty RichAnnotation |
void |
setNoteSet(Set notes)
Clears the notes from this annotation and replaces them with those from the given set. You can not add Notes to the Empty RichAnnotation object. |
void |
setProperty(Object key,
Object value)
Set the value of a property. You can not add properties to the Empty RichAnnotation object |
Methods inherited from class org.biojava.utils.Unchangeable |
---|
addChangeListener, addChangeListener, addForwarder, getForwarders, getListeners, isUnchanging, removeChangeListener, removeChangeListener, removeForwarder |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.biojava.utils.Changeable |
---|
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener |
Constructor Detail |
---|
public EmptyRichAnnotation()
Method Detail |
---|
public Object getProperty(Object key) throws NoSuchElementException
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.
getProperty
in interface Annotation
key
- the key of the property to retrieve
NoSuchElementException
- if there is no property with the keypublic Note[] getProperties(Object key)
Note
s with any rank that match the key. There are no properties in the Empty RichAnnotation object.
Calling this will return an empty array.
getProperties
in interface RichAnnotation
key
- either a String
identifier of a term from the
default onltology or a ComparableTerm
Notes
in order of rank or an
empty array if there are no matches. No implementation should ever
return null!Note
,
ComparableTerm
public Note getNote(Note note)
getNote
in interface RichAnnotation
note
- note to lookup, using term and rank.
public void setProperty(Object key, Object value) throws ChangeVetoException
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
setProperty
in interface Annotation
key
- the key objectvalue
- the new value for this key
ChangeVetoException
- whenever you call this method.public void setNoteSet(Set notes) throws ChangeVetoException
setNoteSet
in interface RichAnnotation
notes
- a set of Note objects to use from now on.
ChangeVetoException
- whenever you call this method.Note
public void addNote(Note note) throws ChangeVetoException
addNote
in interface RichAnnotation
note
- note to add
ChangeVetoException
- whenever you call this method.public void clear() throws ChangeVetoException
clear
in interface RichAnnotation
ChangeVetoException
- if it couldn't do it.public void removeProperty(Object key) throws ChangeVetoException
removeProperty
in interface Annotation
key
- the key object
ChangeVetoException
- whenever you call this method.public void removeNote(Note note) throws ChangeVetoException
removeNote
in interface RichAnnotation
note
- note to remove
ChangeVetoException
- whenever you call this method.public boolean containsProperty(Object key)
containsProperty
in interface Annotation
key
- the key Object to search for
public boolean contains(Note note)
contains
in interface RichAnnotation
note
- note to lookup
public Set keys()
keys
in interface Annotation
public Set getNoteSet()
getNoteSet
in interface RichAnnotation
Note
public Map asMap()
If the annotation changes, the map may not reflect this. The Map may be unmodifiable.
asMap
in interface Annotation
public int hashCode()
hashCode
in class Object
public boolean equals(Object o)
equals
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |