gate.yam.translate
Class AbstractTranslator

java.lang.Object
  extended by gate.yam.translate.AbstractTranslator
All Implemented Interfaces:
TranslationConstants
Direct Known Subclasses:
HtmlTranslator, LaTeXTranslator, PrettyTranslator, TreeTranslator

public abstract class AbstractTranslator
extends Object
implements TranslationConstants

This class provides a model for YAM translators. It is intended to be extended by all translators.

Author:
Hamish Cunningham

Field Summary
static String translatorType
          Type of the translator - "Html", for example.
 
Fields inherited from interface gate.yam.translate.TranslationConstants
CONSTANTEND, CONSTANTNAME, CONSTANTSTART
 
Constructor Summary
AbstractTranslator()
           
 
Method Summary
 void addToFooter(String footerAddition)
          Material to insert at the end of the translation.
 String getConstantEnd(String name)
          Get the markup end element of a constant from the constants map.
 String getConstantStart(String name)
          Get the markup start element of a constant from the constants map.
 void makeContents()
          Collect contents and set heading bodies.
 void makePreamble()
          Deal with the preamble material (and title if it exists).
 void printEndNotes()
          Print end notes.
 void printTree(SimpleNode node)
          Traverse (and translate) a subtree.
 void printTree(SimpleNode node, boolean inContents)
          Traverse (and translate) a subtree.
 void printTree(SimpleNode node, boolean inContents, SimpleNode nextNode)
          Traverse (and translate) a subtree.
abstract  void processURLs(SimpleNode node)
          Process URLs and Anchors.
 void setIOHandler(IOHandler ioh)
          Set the translator's IOHandler.
 void setParseTree(YamParseTree parseTree)
          Set the tree holding the results of a YAM parse.
 void setWriter(Writer writer)
          Set the Writer for translation results.
 Writer translate()
          Translation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gate.yam.translate.TranslationConstants
getConstantsTable, getPreamblePath, getPredicatesTable
 

Field Detail

translatorType

public static String translatorType
Type of the translator - "Html", for example.

Constructor Detail

AbstractTranslator

public AbstractTranslator()
Method Detail

setParseTree

public void setParseTree(YamParseTree parseTree)
Set the tree holding the results of a YAM parse.


getConstantStart

public String getConstantStart(String name)
Get the markup start element of a constant from the constants map.

Parameters:
name - The name of the constant.

getConstantEnd

public String getConstantEnd(String name)
Get the markup end element of a constant from the constants map.

Parameters:
name - The name of the constant.

translate

public Writer translate()
                 throws gate.util.GateException
Translation. Results are written to the Writer.

Throws:
gate.util.GateException

printTree

public void printTree(SimpleNode node)
               throws gate.util.GateException
Traverse (and translate) a subtree.

Throws:
gate.util.GateException

printTree

public void printTree(SimpleNode node,
                      boolean inContents)
               throws gate.util.GateException
Traverse (and translate) a subtree.

Throws:
gate.util.GateException

printTree

public void printTree(SimpleNode node,
                      boolean inContents,
                      SimpleNode nextNode)
               throws gate.util.GateException
Traverse (and translate) a subtree.

Throws:
gate.util.GateException

processURLs

public abstract void processURLs(SimpleNode node)
                          throws gate.util.GateException
Process URLs and Anchors.

Throws:
gate.util.GateException

printEndNotes

public void printEndNotes()
                   throws gate.util.GateException
Print end notes.

Throws:
gate.util.GateException

addToFooter

public void addToFooter(String footerAddition)
Material to insert at the end of the translation.


makeContents

public void makeContents()
                  throws gate.util.GateException
Collect contents and set heading bodies.

Throws:
gate.util.GateException

makePreamble

public void makePreamble()
                  throws gate.util.GateException
Deal with the preamble material (and title if it exists).

Throws:
gate.util.GateException

setWriter

public void setWriter(Writer writer)
Set the Writer for translation results.


setIOHandler

public void setIOHandler(IOHandler ioh)
Set the translator's IOHandler.