Jalopy 1.0b10

de.hunsicker.jalopy.language
Class JavaNodeFactory

java.lang.Object
  |
  +--de.hunsicker.antlr.ASTFactory
        |
        +--de.hunsicker.jalopy.language.JavaNodeFactory

public class JavaNodeFactory
extends ASTFactory

Central facility to create the nodes for Java parse trees.

Version:
$Revision: 1.3 $
Author:
Marco Hunsicker

Fields inherited from class de.hunsicker.antlr.ASTFactory
theASTNodeType, theASTNodeTypeClass
 
Constructor Summary
JavaNodeFactory()
          Creates a new JavaNodeFactory object.
 
Method Summary
 void addASTChild(ASTPair currentAST, AST child)
          Add the given node as a child to the given root.
 AST create()
          Creates a new empty JavaNode node.
 AST create(AST node)
          Creates a new JavaNode node.
 AST create(int type)
          Creates a new JavaNode node.
 AST create(int type, String text)
          Creates a new JavaNode node.
 AST create(Token token)
          Creates a new JavaNode node.
 AST dupList(AST t)
          Duplicate the given tree (including all siblings of root).
 AST dupTree(AST t)
          Duplicate a tree, assuming this is a root node of a tree -- duplicates that node and what's below; ignore siblings of root node.
 void error(String message)
          Logs the given error message.
 AST make(AST[] nodes)
          Makes a tree from a list of nodes.
 void makeASTRoot(ASTPair currentAST, AST root)
          DOCUMENT ME!
 
Methods inherited from class de.hunsicker.antlr.ASTFactory
dup, make, setASTNodeType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaNodeFactory

public JavaNodeFactory()
Creates a new JavaNodeFactory object.
Method Detail

addASTChild

public void addASTChild(ASTPair currentAST,
                        AST child)
Add the given node as a child to the given root.
Overrides:
addASTChild in class ASTFactory
Parameters:
currentAST - root pair.
child - new child to add.

create

public AST create()
Creates a new empty JavaNode node.
Overrides:
create in class ASTFactory
Returns:
newly created Node.

create

public AST create(int type)
Creates a new JavaNode node.
Overrides:
create in class ASTFactory
Parameters:
type - information to setup the node with.
Returns:
newly created Node.

create

public AST create(AST node)
Creates a new JavaNode node.
Overrides:
create in class ASTFactory
Parameters:
node - node to setup the new node with.
Returns:
newly created Node.

create

public AST create(Token token)
Creates a new JavaNode node.
Overrides:
create in class ASTFactory
Parameters:
token - token to setup the new node with.
Returns:
newly created Node.

create

public AST create(int type,
                  String text)
Creates a new JavaNode node.
Overrides:
create in class ASTFactory
Parameters:
type - type information to setup the node with.
text - text to setup the node with.
Returns:
newly created Node.

dupList

public AST dupList(AST t)
Duplicate the given tree (including all siblings of root).
Overrides:
dupList in class ASTFactory
Parameters:
t - the root node of the tree (or tree portion)
Returns:
the copy of the tree.

dupTree

public AST dupTree(AST t)
Duplicate a tree, assuming this is a root node of a tree -- duplicates that node and what's below; ignore siblings of root node.
Overrides:
dupTree in class ASTFactory
Parameters:
t - the root node of the tree (or tree portion)
Returns:
the copy of the tree.

error

public void error(String message)
Logs the given error message.
Overrides:
error in class ASTFactory
Parameters:
message - an error message.

make

public AST make(AST[] nodes)
Makes a tree from a list of nodes. The first element in the array is the root. If the root is null, then the tree is actually a simple list not a tree. Handles null children nodes correctly. For example, build(a, b, null, c) yields tree (a b c). build(null,a,b) yields tree (nil a b).

Sets also the line/column info of the root node.

Overrides:
make in class ASTFactory
Parameters:
nodes - the nodes to create the tree with.
Returns:
the generated tree.

makeASTRoot

public void makeASTRoot(ASTPair currentAST,
                        AST root)
DOCUMENT ME!
Overrides:
makeASTRoot in class ASTFactory
Parameters:
currentAST - DOCUMENT ME!
root - DOCUMENT ME!

Jalopy 1.0b10

Submit a bug or feature.

For further information and documentation, visit the official Jalopy website.
This page generated: November 14 2002