Package org.biojavax
Class SimpleDocRef
java.lang.Object
org.biojava.utils.AbstractChangeable
org.biojavax.SimpleDocRef
- All Implemented Interfaces:
Comparable
,Changeable
,DocRef
A basic DocRef implementation.
- Since:
- 1.5
- Author:
- Richard Holland, Mark Schreiber, George Waldon
-
Field Summary
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SimpleDocRef
(String authors, String location) Creates a new document reference from the given immutable authors and location and title.SimpleDocRef
(String authors, String location, String title) Creates a new document reference from the given immutable authors and location and title.SimpleDocRef
(String authors, String location, String title, String crossRefKey, String crossRefValue, Integer crossRefVersion) Construct a doc ref with populated cross ref.SimpleDocRef
(List<DocRefAuthor> authors, String location) Creates a new document reference from the given immutable authors and location and title.SimpleDocRef
(List<DocRefAuthor> authors, String location, String title) Creates a new document reference from the given immutable authors and location and title.SimpleDocRef
(List authors, String location, String title, String crossRefKey, String crossRefValue, Integer crossRefVersion) Construct a doc ref with populated cross ref. -
Method Summary
Modifier and TypeMethodDescriptionint
Document references are compared first by author, then by location, then by title.boolean
Document references are equal if they have the same author and location and title.Returns the authors of the document reference as a set of DocRefAuthor implementation instances.Returns the authors of the document reference.getCRC()
Returns a CRC64 checksum of this document reference, allowing for easy comparisons with other document references.The document reference may refer to an object in another database.getId()
Gets the Hibernate ID.Returns a textual description of the document reference.If remarks have been made about this document reference, this method will return them.getTitle()
Returns the title of the document reference.int
hashCode()
void
setCrossref
(CrossRef crossref) The document reference may refer to an object in another database.void
Sets the Hibernate ID.void
Set the remarks for this document reference using this method.toString()
Form: "authors; location"Methods 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
-
SimpleDocRef
Creates a new document reference from the given immutable authors and location and title. Will throw exceptions if either authors or location are null, but a null title is allowable.- Parameters:
authors
- The authors of the referenced document, as a set of DocRefAuthor instances.location
- The location of the document, e.g. the journal name and page range.
-
SimpleDocRef
Creates a new document reference from the given immutable authors and location and title. Will throw exceptions if either authors or location are null, but a null title is allowable.- Parameters:
authors
- The authors of the referenced document, as a string to be parsed withDocRefAuthor.Tools.parseAuthorString(String)
.location
- The location of the document, eg. the journal name and page range.
-
SimpleDocRef
Creates a new document reference from the given immutable authors and location and title. Will throw exceptions if either authors or location are null, but a null title is allowable.- Parameters:
authors
- The authors of the referenced document, as a string to be parsed withDocRefAuthor.Tools.parseAuthorString(String)
.location
- The location of the document, e.g. the journal name and page range.title
- The title of the document.
-
SimpleDocRef
Creates a new document reference from the given immutable authors and location and title. Will throw exceptions if either authors or location are null, but a null title is allowable.- Parameters:
authors
- The authors of the referenced document, as a set of DocRefAuthor instances.location
- The location of the document, e.g. the journal name and page range.title
- The title of the document.
-
SimpleDocRef
public SimpleDocRef(String authors, String location, String title, String crossRefKey, String crossRefValue, Integer crossRefVersion) Construct a doc ref with populated cross ref.- Parameters:
authors
-location
-title
-crossRefKey
-crossRefValue
-crossRefVersion
-
-
SimpleDocRef
public SimpleDocRef(List authors, String location, String title, String crossRefKey, String crossRefValue, Integer crossRefVersion) Construct a doc ref with populated cross ref.- Parameters:
authors
-location
-title
-crossRefKey
-crossRefValue
-crossRefVersion
-
-
SimpleDocRef
protected SimpleDocRef()
-
-
Method Details
-
setRemark
Set the remarks for this document reference using this method. Remarks can be anything, it is derived from the equivalent field in the GenBank format.- Specified by:
setRemark
in interfaceDocRef
- Parameters:
remark
- New value of property Remark.- Throws:
ChangeVetoException
- in case of objections.
-
setCrossref
The document reference may refer to an object in another database. Use this method to set that reference. Null will unset it.- Specified by:
setCrossref
in interfaceDocRef
- Parameters:
crossref
- New value of property crossref.- Throws:
ChangeVetoException
- in case of objections.
-
getAuthors
Returns the authors of the document reference. It will usually be in the form "Jones H., Bloggs J et al" or similar - a human-readable text value. Editors will have (ed.) appended, consortiums will have (consortium) appended.- Specified by:
getAuthors
in interfaceDocRef
- Returns:
- Value of property authors.
-
getAuthorList
Returns the authors of the document reference as a set of DocRefAuthor implementation instances. This field is immutable so should be set using the constructor of the implementing class.- Specified by:
getAuthorList
in interfaceDocRef
- Returns:
- The set of authors.
-
getCRC
Returns a CRC64 checksum of this document reference, allowing for easy comparisons with other document references. The string to be checksummed is constructed by concatenating the authors, title, and location in that order, with no space between. If any values are null they are substituted with the text "<undef>". -
getRemark
If remarks have been made about this document reference, this method will return them. -
getCrossref
The document reference may refer to an object in another database. If so, this method will return that reference.- Specified by:
getCrossref
in interfaceDocRef
- Returns:
- Value of property crossref.
-
getLocation
Returns a textual description of the document reference. This field is immutable so should be set using the constructor of the implementing class.- Specified by:
getLocation
in interfaceDocRef
- Returns:
- Value of property location.
-
getTitle
Returns the title of the document reference. -
compareTo
Document references are compared first by author, then by location, then by title. If Author and location are equal and this title is null, and theirs isn't, then this will return -1. For symmetry if our title is not null and theirs is then we return 1. If both are null then we return 0.- Specified by:
compareTo
in interfaceComparable
-
equals
Document references are equal if they have the same author and location and title. -
hashCode
-
toString
Form: "authors; location" -
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.
-