org.biojavax
Class SimpleDocRef

java.lang.Object
  extended by org.biojava.utils.AbstractChangeable
      extended by org.biojavax.SimpleDocRef
All Implemented Interfaces:
java.lang.Comparable, Changeable, DocRef

public class SimpleDocRef
extends AbstractChangeable
implements DocRef

A basic DocRef implementation.

Since:
1.5
Author:
Richard Holland, Mark Schreiber

Field Summary
 
Fields inherited from interface org.biojavax.DocRef
CROSSREF, REMARK
 
Constructor Summary
protected SimpleDocRef()
           
  SimpleDocRef(java.util.List authors, java.lang.String location)
          Creates a new document reference from the given immutable authors and location and title.
  SimpleDocRef(java.util.List authors, java.lang.String location, java.lang.String title)
          Creates a new document reference from the given immutable authors and location and title.
 
Method Summary
 int compareTo(java.lang.Object o)
           Document references are compared first by author, then by location, then by title.
 boolean equals(java.lang.Object obj)
           Document references are equal if they have the same author and location and title.
 java.util.List getAuthorList()
          Returns the authors of the document reference as a set of DocRefAuthor implementation instances.
 java.lang.String getAuthors()
          Returns the authors of the document reference.
 java.lang.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.
 CrossRef getCrossref()
          The document reference may refer to an object in another database.
 java.lang.String getLocation()
          Returns a textual description of the document reference.
 java.lang.String getRemark()
          If remarks have been made about this document reference, this method will return them.
 java.lang.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 setRemark(java.lang.String remark)
          Set the remarks for this document reference using this method.
 java.lang.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(java.util.List authors,
                    java.lang.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, eg. the journal name and page range.

SimpleDocRef

public SimpleDocRef(java.util.List authors,
                    java.lang.String location,
                    java.lang.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, eg. the journal name and page range.
title - The title of the document.

SimpleDocRef

protected SimpleDocRef()
Method Detail

setRemark

public void setRemark(java.lang.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 interface DocRef
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 interface DocRef
Parameters:
crossref - New value of property crossref.
Throws:
ChangeVetoException - in case of objections.

getAuthors

public java.lang.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 interface DocRef
Returns:
Value of property authors.

getAuthorList

public java.util.List 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 interface DocRef
Returns:
The set of authors.

getCRC

public java.lang.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 interface DocRef
Returns:
Value of property CRC.
See Also:
CRC64Checksum

getRemark

public java.lang.String getRemark()
If remarks have been made about this document reference, this method will return them.

Specified by:
getRemark in interface DocRef
Returns:
Value of property Remark.

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 interface DocRef
Returns:
Value of property crossref.

getLocation

public java.lang.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 interface DocRef
Returns:
Value of property location.

getTitle

public java.lang.String getTitle()
Returns the title of the document reference.

Specified by:
getTitle in interface DocRef
Returns:
Value of property title.

compareTo

public int compareTo(java.lang.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 interface java.lang.Comparable

equals

public boolean equals(java.lang.Object obj)
Document references are equal if they have the same author and location and title.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Form: "authors; location"

Overrides:
toString in class java.lang.Object