|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.gate.yam.translate.AbstractTranslator
class AbstractTranslator
This class provides a model for YAM translators. It is intended to be extended by all translators.
Field Summary | |
---|---|
Map |
constantsMap
Map from constant name to output strings. |
String[][] |
constantsTable
Array mapping node type name to start/end strings. |
Map |
controlsMap
Map from control types to activity status. |
static boolean |
debug
Debug flag. |
StringBuilder |
footerStuff
Material to insert at the end of the translation. |
List |
footnotesList
List of footnotes. |
IOHandler |
ioHandler
The translator's IOHandler. |
static Logger |
log
Logger |
YamParseTree |
parseTree
Tree holding the results of a YAM parse. |
Map |
predicatesMap
Map from predicate names to attributes. |
Object[][] |
predicatesTable
Array mapping predicate type name to attributes. |
static String |
translatorType
Type of the translator - "Html", for example. |
Writer |
writer
Writer for translation results. |
Constructor Summary | |
AbstractTranslator()
|
Method Summary | |
---|---|
void
|
addToFooter(String footerAddition)
Material to insert at the end of the translation. |
String
|
elide(String line)
Elide a string to fit a normal line. |
String[]
|
getConstantArray(String name)
Get the three-element array describing a constant from the map. |
String
|
getConstantEnd(int id)
Get the markup end element of a constant from the constants map. |
String
|
getConstantEnd(String name)
Get the markup end element of a constant from the constants map. |
String
|
getConstantStart(int id)
Get the markup start element of a constant from the constants map. |
String
|
getConstantStart(String name)
Get the markup start element of a constant from the constants map. |
String
|
getHeadingNumber(int[] contentsNumbering, int level)
Derive a heading number string from a numbering array and the level. |
String
|
getIndent(int level)
Get indent spacing for a contents line. |
String
|
getNodeImage(SimpleNode node)
Get a node's image from its tokens (using printTree). |
String
|
getNodeImage(SimpleNode node, boolean inContents)
Get a node's image from its tokens (using printTree). |
void
|
makeContents()
Collect contents and set heading bodies. |
String
|
makeHeader(int[] contentsNumbering, int level, String text, boolean markup, String headingClass)
Construct a header. |
void
|
makePreamble()
Deal with the preamble material (and title if it exists). |
String
|
makePreamble(String title)
Construct the preamble/header for the document. |
void
|
pr(String s)
Write a string. |
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. |
void
|
prln(String s)
Write a string plus a newline. |
void
|
processControl(SimpleNode node)
Process a control node. |
void
|
processPredicate(SimpleNode node)
Process a predicate node. |
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. |
String
|
subNewlines(String s)
Substitute newlines. |
Writer
|
translate()
Translation. |
Methods inherited from class Object | |
---|---|
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll |
Field Detail |
---|
Map constantsMap
String[][] constantsTable
Map controlsMap
static final boolean debug
StringBuilder footerStuff
List footnotesList
IOHandler ioHandler
static Logger log
YamParseTree parseTree
Map predicatesMap
Object[][] predicatesTable
static String translatorType
Writer writer
Constructor Detail |
---|
AbstractTranslator()
Method Detail |
---|
public void addToFooter(String footerAddition)
public String elide(String line)
public String[] getConstantArray(String name)
public String getConstantEnd(int id)
public String getConstantEnd(String name)
public String getConstantStart(int id)
public String getConstantStart(String name)
public String getHeadingNumber(int[] contentsNumbering, int level)
public String getIndent(int level)
public String getNodeImage(SimpleNode node)
public String getNodeImage(SimpleNode node, boolean inContents)
public void makeContents()
public String makeHeader(int[] contentsNumbering, int level, String text, boolean markup, String headingClass)
public void makePreamble()
public String makePreamble(String title)
public void pr(String s)
public void printEndNotes()
public void printTree(SimpleNode node)
public void printTree(SimpleNode node, boolean inContents)
public void printTree(SimpleNode node, boolean inContents, SimpleNode nextNode)
public void prln(String s)
public void processControl(SimpleNode node)
public void processPredicate(SimpleNode node)
public void processURLs(SimpleNode node)
public void setIOHandler(IOHandler ioh)
public void setParseTree(YamParseTree parseTree)
public void setWriter(Writer writer)
public String subNewlines(String s)
public Writer translate()
Groovy Documentation