Package org.biojavax

Class 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 Details

    • 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 with DocRefAuthor.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 with DocRefAuthor.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 Details

    • 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 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 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

      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 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:
    • getRemark

      public 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

      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 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 String getTitle()
      Returns the title of the document reference.
      Specified by:
      getTitle in interface DocRef
      Returns:
      Value of property title.
    • 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 interface Comparable
    • equals

      public boolean equals(Object obj)
      Document references are equal if they have the same author and location and title.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Form: "authors; location"
      Overrides:
      toString in class Object
    • getId

      public Integer getId()
      Gets the Hibernate ID. Should be used with caution.
      Returns:
      the Hibernate ID, if using Hibernate.
    • setId

      public void setId(Integer id)
      Sets the Hibernate ID. Should be used with caution.
      Parameters:
      id - the Hibernate ID, if using Hibernate.