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
ANNOTATIONFields inherited from interface org.biojavax.bio.BioEntry
COMMENT, DESCRIPTION, DIVISION, IDENTIFIER, RANKEDCROSSREF, RANKEDDOCREF, RELATIONS, SEQVERSION, TAXON -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSimpleBioEntry(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 TypeMethodDescriptionvoidaddComment(Comment comment) Adds a comment instance to this bioentry.voidaddRankedCrossRef(RankedCrossRef crossref) Adds a ranked cross reference to the existing set.voidaddRankedDocRef(RankedDocRef docref) Adds a ranked docref instance to this bioentry.voidaddRelationship(BioEntryRelationship relation) Adds a relation instance to this bioentry.intBioentries are ordered first by namespace, then name, accession, and finally version.booleanTwo 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.intGets the version of this bioentry.inthashCode()voidremoveComment(Comment comment) Removes a comment instance from this bioentry.voidremoveRankedCrossRef(RankedCrossRef crossref) Removes a ranked cross reference from the existing set.voidremoveRankedDocRef(RankedDocRef docref) Removes a ranked docref instance from this bioentry.voidremoveRelationship(BioEntryRelationship relation) Removes a relation instance from this bioentry.voidsetDescription(String description) Sets the description for this bioentry.voidsetDivision(String division) Sets the division of this bioentry.voidSets the Hibernate ID.voidsetIdentifier(String identifier) Sets the identifier of this bioentry.voidsetNoteSet(Set<Note> notes) Clears the notes associated with this object and replaces them with the contents of this set.voidsetRankedCrossRefs(Set<RankedCrossRef> rankedcrossrefs) Sets the ranked cross references associated with an object.voidSets 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, removeChangeListenerMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
getRankedCrossRefsin 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:
setTaxonin interfaceBioEntry- Parameters:
taxon- New value of property taxon.- Throws:
ChangeVetoException- in case of objections.
-
getAnnotation
Should return the associated annotation object.- Specified by:
getAnnotationin interfaceAnnotatable- Returns:
- an Annotation object, never null
-
getRichAnnotation
Return the associated annotation object.- Specified by:
getRichAnnotationin 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:
getNoteSetin 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:
setNoteSetin 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:
getCommentsin 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:
getRankedDocRefsin 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:
getRelationshipsin interfaceBioEntry- Returns:
- a set of BioEntryRelationship objects.
- See Also:
-
setIdentifier
Sets the identifier of this bioentry. Null is allowable.- Specified by:
setIdentifierin 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:
setDivisionin interfaceBioEntry- Parameters:
division- New value of property division.- Throws:
ChangeVetoException- in case of objections.
-
setDescription
Sets the description for this bioentry.- Specified by:
setDescriptionin 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:
getAccessionin interfaceBioEntry- Returns:
- Value of property accession.
-
getDescription
Returns a description of this sequence.- Specified by:
getDescriptionin interfaceBioEntry- Returns:
- Value of property description.
-
getDivision
Returns the division of this bioentry. Division relates to a division of the parent namespace.- Specified by:
getDivisionin interfaceBioEntry- Returns:
- Value of property division.
-
getIdentifier
Returns the identifier of this bioentry.- Specified by:
getIdentifierin 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:
getNamespacein 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:
getVersionin 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:
compareToin 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:
addRankedCrossRefin 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:
removeRankedCrossRefin 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:
addRankedDocRefin 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:
removeRankedDocRefin 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:
addCommentin 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:
removeCommentin 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:
addRelationshipin 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:
removeRelationshipin interfaceBioEntry- Parameters:
relation- the item to remove.- Throws:
ChangeVetoException- if it doesn't want to remove it.
-
setRankedCrossRefs
Description copied from interface:RankedCrossRefableSets the ranked cross references associated with an object. Null will throw an exception but the empty set is fine.- Specified by:
setRankedCrossRefsin 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.
-