cgp.translators
Class SimpleGenerator

java.lang.Object
  |
  +--cgp.translators.SimpleGenerator
Direct Known Subclasses:
CGIFGenerator

abstract class SimpleGenerator
extends java.lang.Object
implements notio.Generator

An abstract base class for generators.


Field Summary
(package private)  notio.ConceptTypeHierarchy conceptHierarchy
          The concept type hierarchy from the knowledge base.
private static java.lang.String DEFINING_LABEL_TABLE_NAME
          Name of DefiningLabelTable unit in context.
(package private)  notio.KnowledgeBase knowledgeBase
          A knowledge base.
(package private)  notio.MarkerSet markerSet
          The marker set from the knowledge base.
(package private)  notio.RelationTypeHierarchy relationHierarchy
          The relation type hierarchy from the knowledge base.
(package private)  notio.TranslationContext translationContext
          A translation context.
(package private)  java.io.Writer writer
          The writer to which the writer will write.
 
Constructor Summary
(package private) SimpleGenerator()
           
 
Method Summary
static java.lang.String escapeCharactersInString(java.lang.String in, java.lang.String chars, char escapeSequence)
          Adds escape sequences for specified characters whenever they occur within the specified string.
(package private)  void generate(java.lang.String txt)
          Appends the specified string to the StringBuffer or OutputStream with which the generator was initialized.
 void generateUnit(java.lang.Object unit)
          Generates a graph to the output stream.
(package private)  notio.translators.DefiningLabelTable getDefiningLabelTable(notio.TranslationContext translationContext)
          Returns the DefiningLabelTable currently in used by this parser.
 java.lang.Class getUnitClass()
          Returns a Class object that indicates what class the Unit parse method will return.
private  void initializeGenerator(notio.KnowledgeBase newKnowledgeBase, notio.TranslationContext newTranslationContext)
          Private initialization common to the public initializers.
 void initializeGenerator(java.io.Writer newWriter, notio.KnowledgeBase newKnowledgeBase, notio.TranslationContext newTranslationContext)
          Initializes the generator to write to the specified writer using the specified TranslationContext and KnowledgeBase.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

DEFINING_LABEL_TABLE_NAME

private static final java.lang.String DEFINING_LABEL_TABLE_NAME
Name of DefiningLabelTable unit in context.

writer

java.io.Writer writer
The writer to which the writer will write.

knowledgeBase

notio.KnowledgeBase knowledgeBase
A knowledge base.

translationContext

notio.TranslationContext translationContext
A translation context.

markerSet

notio.MarkerSet markerSet
The marker set from the knowledge base.

conceptHierarchy

notio.ConceptTypeHierarchy conceptHierarchy
The concept type hierarchy from the knowledge base.

relationHierarchy

notio.RelationTypeHierarchy relationHierarchy
The relation type hierarchy from the knowledge base.
Constructor Detail

SimpleGenerator

SimpleGenerator()
Method Detail

initializeGenerator

public void initializeGenerator(java.io.Writer newWriter,
                                notio.KnowledgeBase newKnowledgeBase,
                                notio.TranslationContext newTranslationContext)
                         throws notio.GeneratorException
Initializes the generator to write to the specified writer using the specified TranslationContext and KnowledgeBase.
Specified by:
initializeGenerator in interface notio.Generator
Parameters:
newWriter - the writer to be generated to.
newKnowledgeBase - the knowledge base to be used while generating.
newTranslationContext - the translationContext to be used while generating.

initializeGenerator

private void initializeGenerator(notio.KnowledgeBase newKnowledgeBase,
                                 notio.TranslationContext newTranslationContext)
                          throws notio.GeneratorException
Private initialization common to the public initializers.
Parameters:
newKnowledgeBase - the knowledge base to be used while generating.
newTranslationContext - the translationContext to be used while generating.

getDefiningLabelTable

final notio.translators.DefiningLabelTable getDefiningLabelTable(notio.TranslationContext translationContext)
Returns the DefiningLabelTable currently in used by this parser.
Parameters:
translationContext - the translation context from which to get the table.
Returns:
the DefiningLabelTable currently in used by this parser.

generate

void generate(java.lang.String txt)
        throws notio.GeneratorException
Appends the specified string to the StringBuffer or OutputStream with which the generator was initialized.
Parameters:
txt - the string to be written.

getUnitClass

public java.lang.Class getUnitClass()
Returns a Class object that indicates what class the Unit parse method will return.
Specified by:
getUnitClass in interface notio.Generator
Returns:
a Class object that indicates what class the Unit parse method will return.
See Also:
Generator.generateUnit(java.lang.Object)

generateUnit

public void generateUnit(java.lang.Object unit)
                  throws notio.GeneratorException
Generates a graph to the output stream.
Specified by:
generateUnit in interface notio.Generator
Parameters:
unit - the unit object to be generated.
Throws:
notio.GeneratorException - if an error occurs while generating.

escapeCharactersInString

public static java.lang.String escapeCharactersInString(java.lang.String in,
                                                        java.lang.String chars,
                                                        char escapeSequence)
Adds escape sequences for specified characters whenever they occur within the specified string.
Parameters:
in - the string to be modified.
chars - a string containing all characters that need to be escaped.
escapeSequence - the character that should prefix characters that need escaping (e.g. backslash).
Returns:
the modified string which now includes escape sequences.