com.g11ntoolkit.parser.java
Class LTVisitor

java.lang.Object
  |
  +--com.g11ntoolkit.parser.java.LTTreeWalker
        |
        +--com.g11ntoolkit.parser.java.LTVisitor
All Implemented Interfaces:
JavaParserVisitor, LTParserVisitor

public class LTVisitor
extends LTTreeWalker

Traverse the parse tree from the first token in the tree to the last token.

This class was adapted from the LTVisitor found in the VTransformer sample in the JavaCC 3.2 package.

Version:
2005/06/20
Author:
Bill Rich, Wilandra Consulting LLC
Copyright © 2004-2005, Wilandra Consulting LLC. All rights reserved.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

See License Agreement.


Field Summary
private static java.util.logging.Logger log
          The log used for all messages from this class.
 
Fields inherited from class com.g11ntoolkit.parser.java.LTTreeWalker
arrayLevel, contentsId, expression, gcm, gotKey, gotValue, inContents, inMethod, key, needCN, openForKVPair, out, ret, retnew, retobj, strfile, targetLocale, theContextFileName, token, tokfile, value, valueEndCol, valueEndRow, valueStartCol, valueStartRow, xliffrb
 
Constructor Summary
LTVisitor()
          Establishes an instance of the class.
LTVisitor(java.io.PrintStream o)
          Establishes an instance of the class and sets the PrintStream object in the parent class.
 
Method Summary
 void setContextFileName(java.lang.String tc)
          Sets the Context File Name to be used by the Tree Walker.
 void setStrFile(StrFile sf)
          Sets the StrFile to be used by the Tree Walker
 void setTargetLocale(java.util.Locale tl)
          Sets the target locale to be used by the Tree Walker.
 void setTokenObject(Token tk)
          Sets the com.g11ntoolkit.token.Token object to be used by the Tree Walker.
 void setTokFile(TokFile tf)
          Sets the TokFile to be used by the Tree Walker.
 java.lang.Object visit(LTClassBodyDeclaration node, java.lang.Object data)
          Traverse each node in the tree to get each one printed.
 java.lang.Object visit(LTCompilationUnit node, java.lang.Object data)
          Traverse each node in the tree to get each one printed.
 void writeXLIFF(java.io.OutputStreamWriter osw)
          Writes the tree walker results to an XLIFF format file.
 
Methods inherited from class com.g11ntoolkit.parser.java.LTTreeWalker
print, removeConcat, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, walk
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static java.util.logging.Logger log
The log used for all messages from this class.

Constructor Detail

LTVisitor

public LTVisitor(java.io.PrintStream o)
Establishes an instance of the class and sets the PrintStream object in the parent class.

Parameters:
o - a PrintStream specifying the print stream object to use for output.

LTVisitor

public LTVisitor()
Establishes an instance of the class.

Method Detail

visit

public java.lang.Object visit(LTClassBodyDeclaration node,
                              java.lang.Object data)
Traverse each node in the tree to get each one printed.

Specified by:
visit in interface JavaParserVisitor
Overrides:
visit in class LTTreeWalker
Parameters:
node - a LTClassBodyDeclaration specifying the first node in the tree
data - an Object specifying ???
Returns:
an Object representing ???

visit

public java.lang.Object visit(LTCompilationUnit node,
                              java.lang.Object data)
Traverse each node in the tree to get each one printed.

Specified by:
visit in interface JavaParserVisitor
Overrides:
visit in class LTTreeWalker
Parameters:
node - a LTCompilationUnit specifying the first node in the tree
data - an Object specifying ???
Returns:
an Object representing ???

setStrFile

public void setStrFile(StrFile sf)
Sets the StrFile to be used by the Tree Walker

Specified by:
setStrFile in interface LTParserVisitor
Overrides:
setStrFile in class LTTreeWalker
Parameters:
sf - a StrFile specifying the StrFile object to be used

setTokFile

public void setTokFile(TokFile tf)
Sets the TokFile to be used by the Tree Walker.

Specified by:
setTokFile in interface LTParserVisitor
Overrides:
setTokFile in class LTTreeWalker
Parameters:
tf - a TokFile specifying the TokFile object to be used

setContextFileName

public void setContextFileName(java.lang.String tc)
Sets the Context File Name to be used by the Tree Walker.

Specified by:
setContextFileName in interface LTParserVisitor
Overrides:
setContextFileName in class LTTreeWalker
Parameters:
tc - a String specifying the file name to be used for the context of each extracted string

setTargetLocale

public void setTargetLocale(java.util.Locale tl)
Sets the target locale to be used by the Tree Walker.

Specified by:
setTargetLocale in interface LTParserVisitor
Overrides:
setTargetLocale in class LTTreeWalker
Parameters:
tl - a Locale object specifying the target locale to be used for each extracted string

setTokenObject

public void setTokenObject(Token tk)
Sets the com.g11ntoolkit.token.Token object to be used by the Tree Walker.

Specified by:
setTokenObject in interface LTParserVisitor
Overrides:
setTokenObject in class LTTreeWalker
Parameters:
tk - a com.g11ntoolkit.token.Token object specifying the token object to be used to generate the tokens for each extracted string

writeXLIFF

public void writeXLIFF(java.io.OutputStreamWriter osw)
Writes the tree walker results to an XLIFF format file.

Specified by:
writeXLIFF in interface LTParserVisitor
Overrides:
writeXLIFF in class LTTreeWalker
Parameters:
osw - a OutputStreamWriter specifying the output stream writer to use