com.jeffpalm.javaparser
Class SimpleNode

java.lang.Object
  extended by com.jeffpalm.javaparser.SimpleNode
All Implemented Interfaces:
Node
Direct Known Subclasses:
AccessNode, ASTActualTypeArgument, ASTAdditiveExpression, ASTAllocationExpression, ASTAndExpression, ASTAnnotation, ASTArgumentList, ASTArguments, ASTArrayDimsAndInits, ASTArrayInitializer, ASTAssertionStatement, ASTBlock, ASTBlockStatement, ASTCastExpression, ASTClassBody, ASTClassBodyDeclaration, ASTCompilationUnit, ASTConditionalAndExpression, ASTConditionalExpression, ASTConditionalOrExpression, ASTDoStatement, ASTEmptyStatement, ASTEqualityExpression, ASTExclusiveOrExpression, ASTExpression, ASTForInit, ASTFormalParameter, ASTFormalParameters, ASTForStatement, ASTForUpdate, ASTIfStatement, ASTImportDeclaration, ASTInclusiveOrExpression, ASTInitializer, ASTInstanceOfExpression, ASTInterfaceBody, ASTInterfaceMemberDeclaration, ASTLocalVariableDeclaration, ASTMemberValue, ASTMemberValueArrayInitializer, ASTMemberValuePair, ASTMemberValuePairs, ASTMultiplicativeExpression, ASTName, ASTNameList, ASTNullLiteral, ASTPackageDeclaration, ASTPreDecrementExpression, ASTPreIncrementExpression, ASTPrimaryExpression, ASTReferenceTypeList, ASTRelationalExpression, ASTResultType, ASTReturnStatement, ASTShiftExpression, ASTStatement, ASTStatementExpressionList, ASTSwitchLabel, ASTSwitchStatement, ASTSynchronizedStatement, ASTThrowStatement, ASTTryStatement, ASTType, ASTTypeArguments, ASTTypeDeclaration, ASTTypeParameterList, ASTTypeParameters, ASTVariableDeclarator, ASTVariableDeclaratorId, ASTVariableInitializer, ASTWhileStatement, NamedNode

public class SimpleNode
extends java.lang.Object
implements Node

This object is the base class for all items in the AST (abstract syntax tree).

Since:
jRefactory 2.9.0, created October 16, 2003
Author:
Mike Atkinson

Field Summary
protected  Node[] children
          Description of the Field
protected  int id
          Description of the Field
protected  Node parent
          Description of the Field
protected  JavaParser parser
          Description of the Field
 java.util.Vector specials
          Description of the Field
 
Constructor Summary
SimpleNode(int i)
          Constructor for the SimpleNode object
SimpleNode(JavaParser parser, int i)
          Constructor for the SimpleNode object
 
Method Summary
 void addSpecial(java.lang.String key, Token value)
          Description of the Method
 java.lang.Object childrenAccept(JavaParserVisitor visitor, java.lang.Object data)
          Accept the visitor.
 void dump(java.lang.String prefix)
          Dump the node data (including the special tokens) to System.err Override this method if you want to customize how the node dumps out its children.
 java.lang.String dumpString(java.lang.String prefix)
          Dump the node data (including the special tokens) to a String.
 java.util.List findChildrenOfType(java.lang.Class targetType)
          Description of the Method
 void findChildrenOfType(java.lang.Class targetType, java.util.List results)
          Description of the Method
 void findChildrenOfType(java.lang.Class targetType, java.util.List results, boolean descendIntoNestedClasses)
          Description of the Method
 int getBeginColumn()
          Gets the beginColumn attribute of the SimpleNode object
 int getBeginLine()
          Gets the beginLine attribute of the SimpleNode object
 int getEndColumn()
          Gets the endColumn attribute of the SimpleNode object
 int getEndLine()
          Gets the endLine attribute of the SimpleNode object
 java.lang.String getImage()
          Gets the image attribute of the SimpleNode object
 java.lang.String getName()
          Gets the name attribute of the SimpleNode object
 Scope getScope()
          Gets the scope attribute of the SimpleNode object
 Token getSpecial(java.lang.String key)
          Gets the special associated with a particular key
 boolean hasAnyChildren()
          Description of the Method
protected  void init()
          Initializes any variables that are not required
 boolean isRequired()
          Is javadoc required?
 java.lang.Object jjtAccept(JavaParserVisitor visitor, java.lang.Object data)
          Accept the visitor.
 void jjtAddChild(Node n, int i)
          Description of the Method
 void jjtAddFirstChild(Node n)
          Description of the Method
 void jjtClose()
          Description of the Method
 void jjtDeleteChild(int i)
          Remove the node numbered i
 Node jjtGetChild(int i)
          Description of the Method
 Node jjtGetFirstChild()
          This method returns a child node.
 int jjtGetID()
          Return the id for this node
 int jjtGetNumChildren()
          Description of the Method
 Node jjtGetParent()
          Description of the Method
 void jjtInsertChild(Node n, int i)
          Insert the node numbered i
 void jjtOpen()
          Description of the Method
 void jjtSetParent(Node n)
          Description of the Method
protected  java.lang.String printModifiers()
          Description of the Method
 void removeSpecial(java.lang.String key)
          Removes a special associated with a key
 void setLineAndColumnInfo(int beginLine, int beginColumn, int endLine, int endColumn)
           
 void setScope(Scope scope)
          Sets the scope attribute of the SimpleNode object
 void testingOnly__setBeginColumn(int i)
          A unit test for JUnit
 void testingOnly__setBeginLine(int i)
          A unit test for JUnit
 java.lang.String toString()
          You can override these two methods in subclasses of SimpleNode to customize the way the node appears when the tree is dumped.
 java.lang.String toString(java.lang.String prefix)
          You can override these two methods in subclasses of SimpleNode to customize the way the node appears when the tree is dumped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parent

protected Node parent
Description of the Field


children

protected Node[] children
Description of the Field


id

protected int id
Description of the Field


parser

protected JavaParser parser
Description of the Field


specials

public java.util.Vector specials
Description of the Field

Constructor Detail

SimpleNode

public SimpleNode(int i)
Constructor for the SimpleNode object

Parameters:
i - Description of Parameter

SimpleNode

public SimpleNode(JavaParser parser,
                  int i)
Constructor for the SimpleNode object

Parameters:
parser - Description of Parameter
i - Description of Parameter
Method Detail

setScope

public void setScope(Scope scope)
Sets the scope attribute of the SimpleNode object

Parameters:
scope - The new scope value

getBeginLine

public int getBeginLine()
Gets the beginLine attribute of the SimpleNode object

Specified by:
getBeginLine in interface Node
Returns:
The beginLine value

getBeginColumn

public int getBeginColumn()
Gets the beginColumn attribute of the SimpleNode object

Specified by:
getBeginColumn in interface Node
Returns:
The beginColumn value

getEndLine

public int getEndLine()
Gets the endLine attribute of the SimpleNode object

Specified by:
getEndLine in interface Node
Returns:
The endLine value

getEndColumn

public int getEndColumn()
Gets the endColumn attribute of the SimpleNode object

Specified by:
getEndColumn in interface Node
Returns:
The endColumn value

getSpecial

public Token getSpecial(java.lang.String key)
Gets the special associated with a particular key

Parameters:
key - the key
Returns:
the value

isRequired

public boolean isRequired()
Is javadoc required?

Returns:
The required value

getScope

public Scope getScope()
Gets the scope attribute of the SimpleNode object

Returns:
The scope value

getName

public java.lang.String getName()
Gets the name attribute of the SimpleNode object

Returns:
The name value

getImage

public java.lang.String getImage()
Gets the image attribute of the SimpleNode object

Returns:
The image value

jjtOpen

public void jjtOpen()
Description of the Method

Specified by:
jjtOpen in interface Node

jjtClose

public void jjtClose()
Description of the Method

Specified by:
jjtClose in interface Node

setLineAndColumnInfo

public void setLineAndColumnInfo(int beginLine,
                                 int beginColumn,
                                 int endLine,
                                 int endColumn)

testingOnly__setBeginLine

public void testingOnly__setBeginLine(int i)
A unit test for JUnit

Parameters:
i - Description of Parameter

testingOnly__setBeginColumn

public void testingOnly__setBeginColumn(int i)
A unit test for JUnit

Parameters:
i - Description of Parameter

jjtGetID

public int jjtGetID()
Return the id for this node

Returns:
the id

jjtSetParent

public void jjtSetParent(Node n)
Description of the Method

Specified by:
jjtSetParent in interface Node
Parameters:
n - Description of Parameter

jjtGetParent

public Node jjtGetParent()
Description of the Method

Specified by:
jjtGetParent in interface Node
Returns:
Description of the Returned Value

jjtAddChild

public void jjtAddChild(Node n,
                        int i)
Description of the Method

Specified by:
jjtAddChild in interface Node
Parameters:
n - Description of Parameter
i - Description of Parameter

jjtAddFirstChild

public void jjtAddFirstChild(Node n)
Description of the Method

Specified by:
jjtAddFirstChild in interface Node
Parameters:
n - Description of Parameter

jjtInsertChild

public void jjtInsertChild(Node n,
                           int i)
Insert the node numbered i

Specified by:
jjtInsertChild in interface Node
Parameters:
n - Description of Parameter
i - The index of the node to remove

jjtGetChild

public Node jjtGetChild(int i)
Description of the Method

Specified by:
jjtGetChild in interface Node
Parameters:
i - Description of Parameter
Returns:
Description of the Returned Value

jjtGetFirstChild

public Node jjtGetFirstChild()
This method returns a child node. The children are numbered from zero, left to right.

Same as jjtGetFirstChild();

Specified by:
jjtGetFirstChild in interface Node
Returns:
Description of the Returned Value

jjtGetNumChildren

public int jjtGetNumChildren()
Description of the Method

Specified by:
jjtGetNumChildren in interface Node
Returns:
Description of the Returned Value

hasAnyChildren

public boolean hasAnyChildren()
Description of the Method

Returns:
Description of the Returned Value

jjtDeleteChild

public void jjtDeleteChild(int i)
Remove the node numbered i

Specified by:
jjtDeleteChild in interface Node
Parameters:
i - The index of the node to remove

addSpecial

public void addSpecial(java.lang.String key,
                       Token value)
Description of the Method

Parameters:
key - Description of Parameter
value - Description of Parameter

removeSpecial

public void removeSpecial(java.lang.String key)
Removes a special associated with a key

Parameters:
key - the special to remove

jjtAccept

public java.lang.Object jjtAccept(JavaParserVisitor visitor,
                                  java.lang.Object data)
Accept the visitor.

Specified by:
jjtAccept in interface Node
Parameters:
visitor - Description of Parameter
data - Description of Parameter
Returns:
Description of the Returned Value

childrenAccept

public java.lang.Object childrenAccept(JavaParserVisitor visitor,
                                       java.lang.Object data)
Accept the visitor.

Parameters:
visitor - Description of Parameter
data - Description of Parameter
Returns:
Description of the Returned Value

toString

public java.lang.String toString()
You can override these two methods in subclasses of SimpleNode to customize the way the node appears when the tree is dumped. If your output uses more than one line you should override toString(String), otherwise overriding toString() is probably all you need to do.

Overrides:
toString in class java.lang.Object
Returns:
Description of the Returned Value

toString

public java.lang.String toString(java.lang.String prefix)
You can override these two methods in subclasses of SimpleNode to customize the way the node appears when the tree is dumped. If your output uses more than one line you should override toString(String), otherwise overriding toString() is probably all you need to do.

Parameters:
prefix - Description of Parameter
Returns:
Description of the Returned Value

dump

public void dump(java.lang.String prefix)
Dump the node data (including the special tokens) to System.err Override this method if you want to customize how the node dumps out its children.

Parameters:
prefix - prefixed to every line of the output

dumpString

public java.lang.String dumpString(java.lang.String prefix)
Dump the node data (including the special tokens) to a String.

Parameters:
prefix - prefixed to every line of the output
Returns:
dump of the Node data.
Since:
JRefactory 2.7.00

findChildrenOfType

public java.util.List findChildrenOfType(java.lang.Class targetType)
Description of the Method

Parameters:
targetType - Description of the Parameter
Returns:
Description of the Return Value

findChildrenOfType

public void findChildrenOfType(java.lang.Class targetType,
                               java.util.List results)
Description of the Method

Parameters:
targetType - Description of the Parameter
results - Description of the Parameter

findChildrenOfType

public void findChildrenOfType(java.lang.Class targetType,
                               java.util.List results,
                               boolean descendIntoNestedClasses)
Description of the Method

Parameters:
targetType - Description of the Parameter
results - Description of the Parameter
descendIntoNestedClasses - Description of the Parameter

printModifiers

protected java.lang.String printModifiers()
Description of the Method

Returns:
Description of the Returned Value

init

protected void init()
Initializes any variables that are not required