uk.ac.soton.harvester
Class CitationOutput

java.lang.Object
  |
  +--uk.ac.soton.harvester.CitationOutput
Direct Known Subclasses:
HTMLOutput, TXTOutput, XMLOutput

abstract class CitationOutput
extends java.lang.Object

CitationOutput s the superclass of each class that puts the citation data onto the specified printwriter in the one specific format requested by doTXT, doHTML or doXML. The concrete subclasses are TXTOutput, HTMLOutput and XMLOutput.


Field Summary
(package private)  java.lang.String author
          The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.
(package private)  java.lang.String date
          The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.
(package private)  DeciterState ds
          state of the deciter, including the attribute markers used to define the output strings.
(package private)  java.lang.String iss
          The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.
(package private)  java.lang.String misc
          The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.
(package private)  java.lang.String pages
          The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.
(package private)  java.lang.String place
          The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.
(package private)  java.lang.String pub
          The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.
(package private)  java.lang.String publish
          The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.
(package private)  java.lang.String rest
          The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.
(package private)  java.lang.String tit
          The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.
(package private)  java.lang.String vol
          The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.
(package private)  java.lang.String xxxid
          The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.
 
Constructor Summary
(package private) CitationOutput()
          Empty constructor to make an uninitialised object easily from the dynamic loading code.
(package private) CitationOutput(DeciterState ds)
          Standard constructor that simply stores the deciter state.
 
Method Summary
protected static java.lang.String detag(java.lang.String s)
          detag removes tags from an HTML-style string.
(package private) abstract  java.lang.String output(java.io.PrintWriter out)
          output renders the citation onto an output file according to some format.
(package private)  void post(java.io.PrintWriter out)
          post allows the outputter to emit a footer or postamble for the article citations as a body.
(package private)  void pre(java.io.PrintWriter out)
          pre allows the outputter to emit a header or preamble for the article citations as a body.
(package private)  void prepare()
          prepare is a method used by the subclasses 'output' methods to prepare the attribute strings from the attribute markers in the deciter state.
 void setDeciterState(DeciterState ds)
           
protected static void splitAuthors(java.lang.String a0, DeciterState ds, java.io.PrintWriter Output)
          splitAuthors is one of the most complex methods of the deciter class.
protected  void splitPages(java.lang.String pages, java.io.PrintWriter Output)
          splitPages outputs the identified page range on the given output stream.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

author

java.lang.String author
The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.

date

java.lang.String date
The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.

tit

java.lang.String tit
The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.

pages

java.lang.String pages
The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.

pub

java.lang.String pub
The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.

vol

java.lang.String vol
The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.

iss

java.lang.String iss
The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.

publish

java.lang.String publish
The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.

place

java.lang.String place
The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.

misc

java.lang.String misc
The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.

xxxid

java.lang.String xxxid
The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.

rest

java.lang.String rest
The citation attribute strings are filled in by the prepare method from the data in the attribute markers stored in the deciter state.

ds

DeciterState ds
state of the deciter, including the attribute markers used to define the output strings.
Constructor Detail

CitationOutput

CitationOutput(DeciterState ds)
Standard constructor that simply stores the deciter state. All other processing is on a per-citation basis.
Parameters:
ds - the current deciter state

CitationOutput

CitationOutput()
Empty constructor to make an uninitialised object easily from the dynamic loading code. Must be used in conjunction with the setDeciterState method. It is a logic error to use the empty constructor and then to fail to initialise the CitationOutput object with the setDeciterState method.
Method Detail

setDeciterState

public void setDeciterState(DeciterState ds)

prepare

void prepare()
prepare is a method used by the subclasses 'output' methods to prepare the attribute strings from the attribute markers in the deciter state. It is a logic error to use the empty constructor and then to fail to initialise the CitationOutput object with the setDeciterState method.

output

abstract java.lang.String output(java.io.PrintWriter out)
output renders the citation onto an output file according to some format.
Parameters:
out - PrintWriter destination
Returns:
rest of the line (the remainder after the last output section)

pre

void pre(java.io.PrintWriter out)
pre allows the outputter to emit a header or preamble for the article citations as a body. This default definition does nothing.
Parameters:
out - the PrintWriter output stream

post

void post(java.io.PrintWriter out)
post allows the outputter to emit a footer or postamble for the article citations as a body. This default definition does nothing.
Parameters:
out - the PrintWriter output stream

splitPages

protected void splitPages(java.lang.String pages,
                          java.io.PrintWriter Output)
splitPages outputs the identified page range on the given output stream. e.g. "37--49" may appear as <pages><firstpage>37</firstpage>lastpage>49</lastpage></pages>
Parameters:
pages - the page range substring lifted directly from the citation
Output - the output stream on which to output the data

splitAuthors

protected static void splitAuthors(java.lang.String a0,
                                   DeciterState ds,
                                   java.io.PrintWriter Output)
splitAuthors is one of the most complex methods of the deciter class. It takes a string containing many authors and outputs them as individual authors in canonical form. e.g. "Carr L. A. and J. M. Cook" may be output as "<author surname="Carr" initials="L.A."> <author surname="Cook" initials="J.M.">" . The complexity comes from the need to deal with many different author naming schemes as well as the complexity of names themselves.
Parameters:
a0 - the string containing the original author substring lifted directly from the input line.
ds - the deciter state in which the author splitting occurs. this is required because the method has just been made static so that the XMLOutput object can use it.
Output - the output stream to which the author output is to be written.

detag

protected static java.lang.String detag(java.lang.String s)
detag removes tags from an HTML-style string. These tags are in practise just the font-change tags <b> and <i>. It is used as a final stage filter after all the sections have been recognised in the original string, and just prior to their final output.