de.hunsicker.jalopy.language.antlr
Class JavaNode

java.lang.Object
  |
  +--antlr.BaseAST
        |
        +--antlr.CommonAST
              |
              +--antlr.CommonASTWithHiddenTokens
                    |
                    +--de.hunsicker.jalopy.language.antlr.Node
                          |
                          +--de.hunsicker.jalopy.language.antlr.JavaNode
All Implemented Interfaces:
antlr.collections.AST, java.lang.Comparable, java.io.Serializable

public abstract class JavaNode
extends Node

A node representing an element in a Java source file.

Version:
$Revision: 1.1.2.1 $
Author:
Marco Hunsicker
See Also:
Serialized Form

Field Summary
 int newColumn
           
 int newLine
           
protected  JavaNode parent
          Parent node.
protected  JavaNode prevSibling
          Previous node.
 
Fields inherited from class de.hunsicker.jalopy.language.antlr.Node
endColumn, endLine, nlAfter, startColumn, startLine, text, type
 
Fields inherited from class antlr.CommonASTWithHiddenTokens
hiddenAfter, hiddenBefore
 
Fields inherited from class antlr.BaseAST
down, right
 
Constructor Summary
JavaNode()
          Creates a new JavaNode object.
 
Method Summary
 void addChild(antlr.collections.AST node)
          Adds a node to the end of the child list for this node.
 void attachAnnotation(Annotation annotation)
          Attaches an annotation to this node.
 void clear()
          Method to prevent references from sticking around
 java.util.List detachAnnotations()
          Detaches and returns all annotations that are attached to this node.
 antlr.CommonHiddenStreamToken getCommentAfter()
          Returns the first comment that appears after this node.
 antlr.CommonHiddenStreamToken getCommentBefore()
          Returns the first comment before this node.
 JavaNode getParent()
          Returns the parent node of this node.
 Position getPosition()
          Gets the tracked position.
 JavaNode getPreviousSibling()
          Returns the previous sibling of this node.
 int getSizeCommentsAfter()
          Returns the number of comments that appear after this node.
 int getSizeCommentsBefore()
          Returns the number of comments that appear before this node.
 boolean hasCommentsAfter()
          Indicates whether comments appear before of this node.
 boolean hasCommentsBefore()
          Indicates whether comments appear after this node.
 boolean hasJavadocComment(boolean includeML)
          Indicates whether this node has a Javadoc comment attached.
 void initialize(antlr.collections.AST node)
          Initializes this node with information from the given node.
 void setParent(JavaNode node)
          Sets the parent to the given node.
 void setPosition(Position position)
          Sets the position that is to be tracked.
 void setPreviousSibling(JavaNode node)
          Sets the previous sibling to the given node.
 java.lang.String toString()
          Returns a string representation of this node.
 void updatePosition(int line, int column)
          Updates the position information of this node (and all annotations), if necessary.
 
Methods inherited from class de.hunsicker.jalopy.language.antlr.Node
compareTo, contains, contains, contains, endsAfter, equals, getEndColumn, getEndLine, getStartColumn, getStartLine, getText, getType, initialize, initialize, isPositionKnown, setEndColumn, setEndLine, setHiddenAfter, setHiddenBefore, setStartColumn, setStartLine, setText, setType, startsBefore
 
Methods inherited from class antlr.CommonASTWithHiddenTokens
getHiddenAfter, getHiddenBefore
 
Methods inherited from class antlr.BaseAST
decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getColumn, getFirstChild, getLine, getNextSibling, getNumberOfChildren, getTokenNames, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parent

protected JavaNode parent
Parent node.


prevSibling

protected JavaNode prevSibling
Previous node.


newLine

public int newLine

newColumn

public int newColumn
Constructor Detail

JavaNode

public JavaNode()
Creates a new JavaNode object.

Method Detail

getCommentAfter

public antlr.CommonHiddenStreamToken getCommentAfter()
Returns the first comment that appears after this node.

Returns:
the first comment that appears after this node. Returns null if no comments appear after this node.
Since:
1.0b9

getCommentBefore

public antlr.CommonHiddenStreamToken getCommentBefore()
Returns the first comment before this node.

Returns:
the first comment before the node. Returns null if this node does not have a comment before.
Since:
1.0b8

setParent

public void setParent(JavaNode node)
Sets the parent to the given node.

Parameters:
node - a node.

getParent

public JavaNode getParent()
Returns the parent node of this node.

Returns:
parent node.

setPosition

public void setPosition(Position position)
Sets the position that is to be tracked. This information can be used by printers to update the position information.

Parameters:
position - position to track.
Since:
1.0b9
See Also:
updatePosition(int, int)

getPosition

public Position getPosition()
Gets the tracked position.

Returns:
the tracked position. Returns null if no position was set.
Since:
1.0b9

setPreviousSibling

public void setPreviousSibling(JavaNode node)
Sets the previous sibling to the given node.

Parameters:
node - a node.

getPreviousSibling

public JavaNode getPreviousSibling()
Returns the previous sibling of this node.

Returns:
previous sibling node.

getSizeCommentsAfter

public int getSizeCommentsAfter()
Returns the number of comments that appear after this node.

Returns:
number of comment after this node.
Since:
1.0b8

getSizeCommentsBefore

public int getSizeCommentsBefore()
Returns the number of comments that appear before this node.

Returns:
number of comment before this node.
Since:
1.0b8

addChild

public void addChild(antlr.collections.AST node)
Adds a node to the end of the child list for this node.

Specified by:
addChild in interface antlr.collections.AST
Overrides:
addChild in class antlr.BaseAST
Parameters:
node - node to add as a new child.

attachAnnotation

public void attachAnnotation(Annotation annotation)
Attaches an annotation to this node.

Parameters:
annotation - annotation.
Since:
1.0b9

detachAnnotations

public java.util.List detachAnnotations()
Detaches and returns all annotations that are attached to this node.

Returns:
list of attached annotations (of type <Annotation>). Returns an empty list in case no annotations were found.
Since:
1.0b9

hasCommentsAfter

public boolean hasCommentsAfter()
Indicates whether comments appear before of this node.

Returns:
true if comments appear before this node.

hasCommentsBefore

public boolean hasCommentsBefore()
Indicates whether comments appear after this node.

Returns:
true if comments follows this node.

hasJavadocComment

public boolean hasJavadocComment(boolean includeML)
Indicates whether this node has a Javadoc comment attached.

Returns:
true if this node has a Javadoc comment attached.

initialize

public void initialize(antlr.collections.AST node)
Initializes this node with information from the given node.

Specified by:
initialize in interface antlr.collections.AST
Overrides:
initialize in class Node
Parameters:
node - node to setup this node with.

toString

public java.lang.String toString()
Returns a string representation of this node.

Specified by:
toString in interface antlr.collections.AST
Overrides:
toString in class Node
Returns:
a string representation of this node.

updatePosition

public void updatePosition(int line,
                           int column)
Updates the position information of this node (and all annotations), if necessary.

Parameters:
line - the new line information.
column - the new column offset information.
Since:
1.0b9
See Also:
setPosition(de.hunsicker.jalopy.language.Position), attachAnnotation(de.hunsicker.jalopy.language.Annotation)

clear

public void clear()
Method to prevent references from sticking around

Overrides:
clear in class Node


Copyright © 1997-2005 Jalopy. All Rights Reserved.