Package org.biojavax
Class SimpleDocRef
- java.lang.Object
-
- org.biojava.utils.AbstractChangeable
-
- org.biojavax.SimpleDocRef
-
- All Implemented Interfaces:
Comparable,Changeable,DocRef
public class SimpleDocRef extends AbstractChangeable implements DocRef
A basic DocRef implementation.- Since:
- 1.5
- Author:
- Richard Holland, Mark Schreiber, George Waldon
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSimpleDocRef()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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Object o)Document references are compared first by author, then by location, then by title.booleanequals(Object obj)Document references are equal if they have the same author and location and title.List<DocRefAuthor>getAuthorList()Returns the authors of the document reference as a set of DocRefAuthor implementation instances.StringgetAuthors()Returns the authors of the document reference.StringgetCRC()Returns a CRC64 checksum of this document reference, allowing for easy comparisons with other document references.CrossRefgetCrossref()The document reference may refer to an object in another database.IntegergetId()Gets the Hibernate ID.StringgetLocation()Returns a textual description of the document reference.StringgetRemark()If remarks have been made about this document reference, this method will return them.StringgetTitle()Returns the title of the document reference.inthashCode()voidsetCrossref(CrossRef crossref)The document reference may refer to an object in another database.voidsetId(Integer id)Sets the Hibernate ID.voidsetRemark(String remark)Set the remarks for this document reference using this method.StringtoString()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 Detail
-
SimpleDocRef
public SimpleDocRef(List<DocRefAuthor> authors, String location)
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
public SimpleDocRef(String authors, String location)
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
public SimpleDocRef(String authors, String location, String title)
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
public SimpleDocRef(List<DocRefAuthor> authors, String location, String title)
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 Detail
-
setRemark
public void setRemark(String remark) throws ChangeVetoException
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:
setRemarkin interfaceDocRef- Parameters:
remark- New value of property Remark.- Throws:
ChangeVetoException- in case of objections.
-
setCrossref
public void setCrossref(CrossRef crossref) throws ChangeVetoException
The document reference may refer to an object in another database. Use this method to set that reference. Null will unset it.- Specified by:
setCrossrefin interfaceDocRef- Parameters:
crossref- New value of property crossref.- Throws:
ChangeVetoException- in case of objections.
-
getAuthors
public String 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:
getAuthorsin interfaceDocRef- Returns:
- Value of property authors.
-
getAuthorList
public List<DocRefAuthor> 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:
getAuthorListin interfaceDocRef- Returns:
- The set of authors.
-
getCRC
public String 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>".- Specified by:
getCRCin interfaceDocRef- Returns:
- Value of property CRC.
- See Also:
CRC64Checksum
-
getRemark
public String getRemark()
If remarks have been made about this document reference, this method will return them.
-
getCrossref
public CrossRef getCrossref()
The document reference may refer to an object in another database. If so, this method will return that reference.- Specified by:
getCrossrefin interfaceDocRef- Returns:
- Value of property crossref.
-
getLocation
public String 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:
getLocationin interfaceDocRef- Returns:
- Value of property location.
-
compareTo
public int compareTo(Object o)
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:
compareToin interfaceComparable
-
equals
public boolean equals(Object obj)
Document references are equal if they have the same author and location and title.
-
getId
public Integer getId()
Gets the Hibernate ID. Should be used with caution.- Returns:
- the Hibernate ID, if using Hibernate.
-
-