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 protected
SimpleDocRef()
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 int
compareTo(Object o)
Document references are compared first by author, then by location, then by title.boolean
equals(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.String
getAuthors()
Returns the authors of the document reference.String
getCRC()
Returns a CRC64 checksum of this document reference, allowing for easy comparisons with other document references.CrossRef
getCrossref()
The document reference may refer to an object in another database.Integer
getId()
Gets the Hibernate ID.String
getLocation()
Returns a textual description of the document reference.String
getRemark()
If remarks have been made about this document reference, this method will return them.String
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
setId(Integer id)
Sets the Hibernate ID.void
setRemark(String remark)
Set the remarks for this document reference using this method.String
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 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:
setRemark
in 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:
setCrossref
in 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:
getAuthors
in 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:
getAuthorList
in 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:
getCRC
in 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:
getCrossref
in 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:
getLocation
in 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:
compareTo
in 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.
-
-