Package org.biojavax.bio
Class SimpleBioEntry
java.lang.Object
org.biojava.utils.AbstractChangeable
org.biojavax.bio.SimpleBioEntry
- All Implemented Interfaces:
Comparable
,Annotatable
,Changeable
,BioEntry
,RankedCrossRefable
,RichAnnotatable
- Direct Known Subclasses:
ThinRichSequence
Reference implementation of a BioEntry object which has no features or sequence.
Equality is the combination of namespace, name, accession and version.
- Since:
- 1.5
- Author:
- Richard Holland, Mark Schreiber, George Waldon
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.biojava.bio.Annotatable
Annotatable.AnnotationForwarder
-
Field Summary
Fields inherited from interface org.biojava.bio.Annotatable
ANNOTATION
Fields inherited from interface org.biojavax.bio.BioEntry
COMMENT, DESCRIPTION, DIVISION, IDENTIFIER, RANKEDCROSSREF, RANKEDDOCREF, RELATIONS, SEQVERSION, TAXON
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SimpleBioEntry
(Namespace ns, String name, String accession, int version) Creates a new bioentry representing the sequence in the given namespace with the given name, accession and version. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addComment
(Comment comment) Adds a comment instance to this bioentry.void
addRankedCrossRef
(RankedCrossRef crossref) Adds a ranked cross reference to the existing set.void
addRankedDocRef
(RankedDocRef docref) Adds a ranked docref instance to this bioentry.void
addRelationship
(BioEntryRelationship relation) Adds a relation instance to this bioentry.int
Bioentries are ordered first by namespace, then name, accession, and finally version.boolean
Two bioentries are equal if they share the same namespace, name, accession and version.Returns the accession of this bioentry.Should return the associated annotation object.Returns a set of all comments associated with this bioentry.Returns a description of this sequence.Returns the division of this bioentry.getId()
Gets the Hibernate ID.Returns the identifier of this bioentry.getName()
Returns the name of this bioentry.Returns the namespace of this bioentry.Returns the set of notes associated with this object.Returns the set of all ranked cross references associated with an object.Returns a set of all bioentrydocrefs associated with this bioentry.Returns a set of all relationships associated with this bioentry.Return the associated annotation object.getTaxon()
Gets the taxon associated with this bioentry.int
Gets the version of this bioentry.int
hashCode()
void
removeComment
(Comment comment) Removes a comment instance from this bioentry.void
removeRankedCrossRef
(RankedCrossRef crossref) Removes a ranked cross reference from the existing set.void
removeRankedDocRef
(RankedDocRef docref) Removes a ranked docref instance from this bioentry.void
removeRelationship
(BioEntryRelationship relation) Removes a relation instance from this bioentry.void
setDescription
(String description) Sets the description for this bioentry.void
setDivision
(String division) Sets the division of this bioentry.void
Sets the Hibernate ID.void
setIdentifier
(String identifier) Sets the identifier of this bioentry.void
setNoteSet
(Set<Note> notes) Clears the notes associated with this object and replaces them with the contents of this set.void
setRankedCrossRefs
(Set<RankedCrossRef> rankedcrossrefs) Sets the ranked cross references associated with an object.void
Sets the taxon for this bioentry.toString()
Form: namespace:name/accession.versionMethods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
Constructor Details
-
SimpleBioEntry
Creates a new bioentry representing the sequence in the given namespace with the given name, accession and version. These properties are all immutable and non-nullable.- Parameters:
ns
- The namespace for this new bioentry (not null).name
- The name for this new bioentry (not null).accession
- The accession for this new bioentry (not null).version
- The version for this new bioentry.
-
SimpleBioEntry
protected SimpleBioEntry()
-
-
Method Details
-
getRankedCrossRefs
Returns the set of all ranked cross references associated with an object. Warning this method gives access to the original Collection not a copy. This is required by Hibernate. If you modify the object directly the behaviour may be unpredictable.- Specified by:
getRankedCrossRefs
in interfaceRankedCrossRefable
- Returns:
- a set of RankedCrossRef objects.
-
setTaxon
Sets the taxon for this bioentry. It may be null, in which case the taxon is unset.- Specified by:
setTaxon
in interfaceBioEntry
- Parameters:
taxon
- New value of property taxon.- Throws:
ChangeVetoException
- in case of objections.
-
getAnnotation
Should return the associated annotation object.- Specified by:
getAnnotation
in interfaceAnnotatable
- Returns:
- an Annotation object, never null
-
getRichAnnotation
Return the associated annotation object.- Specified by:
getRichAnnotation
in interfaceRichAnnotatable
- Returns:
- a RichAnnotation object, never null
-
getNoteSet
Returns the set of notes associated with this object. Would normally delegate call to internal RichAnnotation instance. Warning this method gives access to the original Collection not a copy. This is required by Hibernate. If you modify the object directly the behaviour may be unpredictable.- Specified by:
getNoteSet
in interfaceRichAnnotatable
- Returns:
- set a set of Note objects.
- See Also:
-
setNoteSet
Clears the notes associated with this object and replaces them with the contents of this set. Would normally delegate call to internal RichAnnotation instance. Warning this method gives access to the original Collection not a copy. This is required by Hibernate. If you modify the object directly the behaviour may be unpredictable.- Specified by:
setNoteSet
in interfaceRichAnnotatable
- Parameters:
notes
- the set of Note objects to replace the existing ones with.- Throws:
ChangeVetoException
- if the set is null or contains any objects that are not Note objects.- See Also:
-
getComments
Returns a set of all comments associated with this bioentry. This set is not mutable. If no comments are associated, you will get back an empty set. Warning this method gives access to the original Collection not a copy. This is required by Hibernate. If you modify the object directly the behaviour may be unpredictable.- Specified by:
getComments
in interfaceBioEntry
- Returns:
- a set of Comment objects.
- See Also:
-
getRankedDocRefs
Returns a set of all bioentrydocrefs associated with this bioentry. This set is not mutable. If no docrefs are associated, you will get back an empty set. Warning this method gives access to the original Collection not a copy. This is required by Hibernate. If you modify the object directly the behaviour may be unpredictable.- Specified by:
getRankedDocRefs
in interfaceBioEntry
- Returns:
- a set of RankedDocRef objects.
- See Also:
-
getRelationships
Returns a set of all relationships associated with this bioentry. This set is not mutable. If no relationships are associated, you will get back an empty set. Warning this method gives access to the original Collection not a copy. This is required by Hibernate. If you modify the object directly the behaviour may be unpredictable.- Specified by:
getRelationships
in interfaceBioEntry
- Returns:
- a set of BioEntryRelationship objects.
- See Also:
-
setIdentifier
Sets the identifier of this bioentry. Null is allowable.- Specified by:
setIdentifier
in interfaceBioEntry
- Parameters:
identifier
- New value of property identifier.- Throws:
ChangeVetoException
- in case of objections.
-
setDivision
Sets the division of this bioentry. Null is allowable.- Specified by:
setDivision
in interfaceBioEntry
- Parameters:
division
- New value of property division.- Throws:
ChangeVetoException
- in case of objections.
-
setDescription
Sets the description for this bioentry.- Specified by:
setDescription
in interfaceBioEntry
- Parameters:
description
- New value of property description.- Throws:
ChangeVetoException
- in case of objections.
-
getAccession
Returns the accession of this bioentry. The accession is supposed to be an immutable property set by the constructor.- Specified by:
getAccession
in interfaceBioEntry
- Returns:
- Value of property accession.
-
getDescription
Returns a description of this sequence.- Specified by:
getDescription
in interfaceBioEntry
- Returns:
- Value of property description.
-
getDivision
Returns the division of this bioentry. Division relates to a division of the parent namespace.- Specified by:
getDivision
in interfaceBioEntry
- Returns:
- Value of property division.
-
getIdentifier
Returns the identifier of this bioentry.- Specified by:
getIdentifier
in interfaceBioEntry
- Returns:
- Value of property identifier.
-
getName
Returns the name of this bioentry. The name is supposed to be an immutable property set by the constructor. -
getNamespace
Returns the namespace of this bioentry. The namespace is supposed to be an immutable property set by the constructor.- Specified by:
getNamespace
in interfaceBioEntry
- Returns:
- the namespace of this bioentry.
-
getTaxon
Gets the taxon associated with this bioentry. It may be null. -
getVersion
Gets the version of this bioentry. Bioentries with no versions return 0. The version is supposed to be immutable and set only by the constructor.- Specified by:
getVersion
in interfaceBioEntry
- Returns:
- Value of property version.
-
equals
Two bioentries are equal if they share the same namespace, name, accession and version. -
compareTo
Bioentries are ordered first by namespace, then name, accession, and finally version.- Specified by:
compareTo
in interfaceComparable
-
hashCode
-
toString
Form: namespace:name/accession.version -
addRankedCrossRef
Adds a ranked cross reference to the existing set. If already present, this call is ignored. Null values are not acceptable.- Specified by:
addRankedCrossRef
in interfaceRankedCrossRefable
- Parameters:
crossref
- the ranked cross reference to add.- Throws:
ChangeVetoException
- if the parameter is null.
-
removeRankedCrossRef
Removes a ranked cross reference from the existing set. If not present, this call is ignored. Null values are not acceptable.- Specified by:
removeRankedCrossRef
in interfaceRankedCrossRefable
- Parameters:
crossref
- the ranked cross reference to remove.- Throws:
ChangeVetoException
- if the parameter is null.
-
addRankedDocRef
Adds a ranked docref instance to this bioentry. Must not be null.- Specified by:
addRankedDocRef
in interfaceBioEntry
- Parameters:
docref
- the item to add.- Throws:
ChangeVetoException
- if it doesn't want to add it.
-
removeRankedDocRef
Removes a ranked docref instance from this bioentry. If it was not found, nothing happens.- Specified by:
removeRankedDocRef
in interfaceBioEntry
- Parameters:
docref
- the item to remove.- Throws:
ChangeVetoException
- if it doesn't want to remove it.
-
addComment
Adds a comment instance to this bioentry. Must not be null.- Specified by:
addComment
in interfaceBioEntry
- Parameters:
comment
- the item to add.- Throws:
ChangeVetoException
- if it doesn't want to add it.
-
removeComment
Removes a comment instance from this bioentry. If it wasn't present, it nothing will happen.- Specified by:
removeComment
in interfaceBioEntry
- Parameters:
comment
- the item to remove.- Throws:
ChangeVetoException
- if it doesn't want to remove it.
-
addRelationship
Adds a relation instance to this bioentry. It must not be null.- Specified by:
addRelationship
in interfaceBioEntry
- Parameters:
relation
- the item to add.- Throws:
ChangeVetoException
- if it doesn't want to add it.
-
removeRelationship
Removes a relation instance from this bioentry. If it wasn't present, nothing will happen.- Specified by:
removeRelationship
in interfaceBioEntry
- Parameters:
relation
- the item to remove.- Throws:
ChangeVetoException
- if it doesn't want to remove it.
-
setRankedCrossRefs
Description copied from interface:RankedCrossRefable
Sets the ranked cross references associated with an object. Null will throw an exception but the empty set is fine.- Specified by:
setRankedCrossRefs
in interfaceRankedCrossRefable
- Parameters:
rankedcrossrefs
- a set of RankedCrossRef objects.
-
getId
Gets the Hibernate ID. Should be used with caution.- Returns:
- the Hibernate ID, if using Hibernate.
-
setId
Sets the Hibernate ID. Should be used with caution.- Parameters:
id
- the Hibernate ID, if using Hibernate.
-