notio.translators
Class LFGenerator

java.lang.Object
  |
  +--notio.translators.SimpleGenerator
        |
        +--notio.translators.LFGenerator
All Implemented Interfaces:
Generator

public class LFGenerator
extends notio.translators.SimpleGenerator
implements Generator

A LF Generator class.


Constructor Summary
LFGenerator()
           
 
Method Summary
 void Actor(Actor actor)
          Generates an actor to the output stream.
 void ActorComment(java.lang.String comment)
          Generates a actor comment to output stream.
 void ConceptComment(java.lang.String comment)
          Generates a concept comment to output stream.
 void ConceptType(ConceptType conType)
          Generates a concept type to the output stream.
 void decreaseIndent()
          Decreases the current indent level.
 void Designator(Designator designator)
          Generates a designator to the output stream.
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.
 void generateActor(Actor actor)
          Generates the specified actor.
 void generateCGStream(java.util.Vector graphs)
          LFGenerator does not support the CGStream construct.
 void generateConcept(Concept concept)
          Generates a concept to the output stream.
 void generateGraph(Graph graph)
          Generates a graph to the output stream.
 void generateOutermostContext(Graph graph)
          Generates the specified graph which is treated as the outermost context for purposes for scoping.
 void generateRelation(Relation relation)
          Generates a relation to the output stream.
 void generateUnit(java.lang.Object unit)
          Generates a graph to the output stream.
 java.lang.Class getUnitClass()
          Returns a Class object that indicates what class the Unit parse method will return.
 void GraphComment(java.lang.String comment)
          Generates a graph comment to output stream.
 void increaseIndent()
          Increases the current indent level.
 void initializeGenerator(java.io.Writer newWriter, KnowledgeBase newKnowledgeBase, TranslationContext newTranslationContext)
          Initializes the generator to write to the specified writer using the specified TranslationContext and KnowledgeBase.
 void LiteralDesignator(LiteralDesignator designator)
          Generates a literal designator to output stream.
 void MarkerDesignator(MarkerDesignator designator)
          Generates a marker designator to output stream.
 void NameDesignator(NameDesignator designator)
          Generates a name designator to output stream.
 void Quantifier(Macro quantifier)
          Generates a quantifier to the output stream.
 void Referent(Referent referent)
          Generates a referent to the output stream.
 void RelationComment(java.lang.String comment)
          Generates a relation comment to output stream.
 void RelationType(RelationType relType)
          Generates a relation type to the output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface notio.Generator
generateUnit, getUnitClass
 

Constructor Detail

LFGenerator

public LFGenerator()
Method Detail

initializeGenerator

public void initializeGenerator(java.io.Writer newWriter,
                                KnowledgeBase newKnowledgeBase,
                                TranslationContext newTranslationContext)
                         throws GeneratorException
Initializes the generator to write to the specified writer using the specified TranslationContext and KnowledgeBase.
Specified by:
initializeGenerator in interface Generator
Overrides:
initializeGenerator in class notio.translators.SimpleGenerator
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.

generateCGStream

public void generateCGStream(java.util.Vector graphs)
                      throws GeneratorException
LFGenerator does not support the CGStream construct. Calling this method will cause an UnimplementedFeatureException to be thrown.
Specified by:
generateCGStream in interface Generator
Parameters:
graphsa - the vector of graphs to be generated.
Throws:
GeneratorException - if an error occurs while generating.
UnimplementedFeatureException - if this generator does not support this generation method.

generateActor

public void generateActor(Actor actor)
                   throws GeneratorException
Generates the specified actor.
Specified by:
generateActor in interface Generator
Parameters:
actor - the actor to be generated.
Throws:
GeneratorException - if an error occurs while generating.
UnimplementedFeatureException - if this generator does not support this generation method.

generateOutermostContext

public void generateOutermostContext(Graph graph)
                              throws GeneratorException
Generates the specified graph which is treated as the outermost context for purposes for scoping. This method should be used instead of generateGraph() when no translation information is to be used from previous translation sessions and when the generator can safely assume that the graph is "self-contained".
Specified by:
generateOutermostContext in interface Generator
Parameters:
graph - the graph to be generated.
Throws:
GeneratorException - if an error occurs while generating.
UnimplementedFeatureException - if this generator does not support this generation method.

generateGraph

public void generateGraph(Graph graph)
                   throws GeneratorException
Generates a graph to the output stream.
Specified by:
generateGraph in interface Generator
Parameters:
graph - the graph to be generated.
Throws:
GeneratorException - if an error occurs while generating.

GraphComment

public void GraphComment(java.lang.String comment)
                  throws GeneratorException
Generates a graph comment to output stream.
Parameters:
comment - the graph comment to be generated.
Throws:
GeneratorException - if an error occurs while generating.

generateConcept

public void generateConcept(Concept concept)
                     throws GeneratorException
Generates a concept to the output stream.
Specified by:
generateConcept in interface Generator
Parameters:
concept - the concept to be generated.
Throws:
GeneratorException - if an error occurs while generating.

ConceptType

public void ConceptType(ConceptType conType)
                 throws GeneratorException
Generates a concept type to the output stream.
Parameters:
conType - the concept type to be generated.
Throws:
GeneratorException - if an IO error occurs.

Referent

public void Referent(Referent referent)
              throws GeneratorException
Generates a referent to the output stream.
Parameters:
referent - the referent to be generated.
Throws:
GeneratorException - if an IO error occurs.

Quantifier

public void Quantifier(Macro quantifier)
                throws GeneratorException
Generates a quantifier to the output stream.
Parameters:
quantifier - the quantifier to be generated.
Throws:
GeneratorException - if an IO error occurs.

Designator

public void Designator(Designator designator)
                throws GeneratorException
Generates a designator to the output stream.
Parameters:
designator - the designator to be generated.
Throws:
GeneratorException - if an error occurs while generating.

LiteralDesignator

public void LiteralDesignator(LiteralDesignator designator)
                       throws GeneratorException
Generates a literal designator to output stream.
Parameters:
designator - the designator to be generated.
Throws:
GeneratorException - if an error occurs while generating.

MarkerDesignator

public void MarkerDesignator(MarkerDesignator designator)
                      throws GeneratorException
Generates a marker designator to output stream.
Parameters:
designator - the designator to be generated.
Throws:
GeneratorException - if an error occurs while generating.

NameDesignator

public void NameDesignator(NameDesignator designator)
                    throws GeneratorException
Generates a name designator to output stream.
Parameters:
designator - the designator to be generated.
Throws:
GeneratorException - if an error occurs while generating.

ConceptComment

public void ConceptComment(java.lang.String comment)
                    throws GeneratorException
Generates a concept comment to output stream.
Parameters:
comment - the concept comment to be generated.
Throws:
GeneratorException - if an error occurs while generating.

generateRelation

public void generateRelation(Relation relation)
                      throws GeneratorException
Generates a relation to the output stream.
Specified by:
generateRelation in interface Generator
Parameters:
relation - the relation to be generated.
Throws:
GeneratorException - if an error occurs while generating.

RelationType

public void RelationType(RelationType relType)
                  throws GeneratorException
Generates a relation type to the output stream.
Parameters:
relType - the relation type to be generated.
Throws:
GeneratorException - if an IO error occurs.

RelationComment

public void RelationComment(java.lang.String comment)
                     throws GeneratorException
Generates a relation comment to output stream.
Parameters:
comment - the relation comment to be generated.
Throws:
GeneratorException - if an error occurs while generating.

Actor

public void Actor(Actor actor)
           throws GeneratorException
Generates an actor to the output stream.
Parameters:
actor - the actor to be generated.
Throws:
GeneratorException - if an error occurs while generating.

ActorComment

public void ActorComment(java.lang.String comment)
                  throws GeneratorException
Generates a actor comment to output stream.
Parameters:
comment - the actor comment to be generated.
Throws:
GeneratorException - if an error occurs while generating.

increaseIndent

public void increaseIndent()
Increases the current indent level.

decreaseIndent

public void decreaseIndent()
Decreases the current indent level.

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 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 GeneratorException
Generates a graph to the output stream.
Specified by:
generateUnit in interface Generator
Parameters:
unit - the unit object to be generated.
Throws:
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.


Copyright 1998-2001 Finnegan Southey