japa.parser.ast

## Class Node

- java.lang.Object
- - japa.parser.ast.Node

Direct Known Subclasses:
  BaseParameter, BodyDeclaration, CatchClause, Comment, CompilationUnit, Expression, ImportDeclaration, MemberValuePair, PackageDeclaration, Statement, Type, TypeParameter, VariableDeclarator, VariableDeclaratorId

    public abstract class Node
    extends Object

Abstract class for all nodes of the AST. Each Node can have one associated comment which describe it and a number of "orphan comments" which it contains but are not specifically associated to any element.

Author:
  Julio Vilmar Gesser

### Field Summary

Fields
`static int` `ABSOLUTE_BEGIN_LINE`
`static int` `ABSOLUTE_END_LINE`

### Constructor Summary

Constructors
Constructor and Description
`Node()`
`Node(int beginLine, int beginColumn, int endLine, int endColumn)`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`abstract <R,A> R` `accept(GenericVisitor<R,A> v, A arg)` Accept method for visitor support.
`abstract <A> void` `accept(VoidVisitor<A> v, A arg)` Accept method for visitor support.
`void` `addOrphanComment(Comment comment)`
`boolean` `contains(Node other)`
`boolean` `equals(Object obj)`
`List<Comment>` `getAllContainedComments()` This is the list of Comment which are contained in the Node either because they are properly associated to one of its children or because they are floating around inside the Node.
`int` `getBeginColumn()` Return the begin column of this node.
`int` `getBeginLine()` Return the begin line of this node.
`List<Node>` `getChildrenNodes()`
`Comment` `getComment()` This is a comment associated with this node.
`Object` `getData()` Use this to retrieve additional information associated to this node.
`int` `getEndColumn()` Return the end column of this node.
`int` `getEndLine()` Return the end line of this node.
`List<Comment>` `getOrphanComments()` This is a list of Comment which are inside the node and are not associated with any meaningful AST Node.
`Node` `getParentNode()`
`int` `hashCode()`
`boolean` `isPositionedAfter(int line, int column)`
`boolean` `isPositionedBefore(int line, int column)`
`protected void` `setAsParentNodeOf(List<? extends Node> childNodes)`
`protected void` `setAsParentNodeOf(Node childNode)`
`void` `setBeginColumn(int beginColumn)` Sets the begin column of this node.
`void` `setBeginLine(int beginLine)` Sets the begin line of this node.
`void` `setComment(Comment comment)` Use this to store additional information to this node.
`void` `setData(Object data)` Use this to store additional information to this node.
`void` `setEndColumn(int endColumn)` Sets the end column of this node.
`void` `setEndLine(int endLine)` Sets the end line of this node.
`void` `setParentNode(Node parentNode)`
`String` `toString()` Return the String representation of this node.

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### ABSOLUTE_BEGIN_LINE

    public static final int ABSOLUTE_BEGIN_LINE

See Also:
  Constant Field Values

#### ABSOLUTE_END_LINE

    public static final int ABSOLUTE_END_LINE

See Also:
  Constant Field Values

### Constructor Detail

#### Node

    public Node()

#### Node

    public Node(int beginLine,
                int beginColumn,
                int endLine,
                int endColumn)

### Method Detail

#### accept

    public abstract <R,A> R accept(GenericVisitor<R,A> v,
                                   A arg)

Accept method for visitor support.

Type Parameters:
  `R` - the type the return value of the visitor
  `A` - the type the argument passed to the visitor
Parameters:
  `v` - the visitor implementation
  `arg` - the argument passed to the visitor
Returns:
  the result of the visit

#### accept

    public abstract <A> void accept(VoidVisitor<A> v,
                                    A arg)

Accept method for visitor support.

Type Parameters:
  `A` - the type the argument passed for the visitor
Parameters:
  `v` - the visitor implementation
  `arg` - any value relevant for the visitor

#### getBeginColumn

    public final int getBeginColumn()

Return the begin column of this node.

Returns:
  the begin column of this node

#### getBeginLine

    public final int getBeginLine()

Return the begin line of this node.

Returns:
  the begin line of this node

#### getComment

    public final Comment getComment()

This is a comment associated with this node.

#### getData

    public final Object getData()

Use this to retrieve additional information associated to this node.

#### getEndColumn

    public final int getEndColumn()

Return the end column of this node.

Returns:
  the end column of this node

#### getEndLine

    public final int getEndLine()

Return the end line of this node.

Returns:
  the end line of this node

#### setBeginColumn

    public final void setBeginColumn(int beginColumn)

Sets the begin column of this node.

Parameters:
  `beginColumn` - the begin column of this node

#### setBeginLine

    public final void setBeginLine(int beginLine)

Sets the begin line of this node.

Parameters:
  `beginLine` - the begin line of this node

#### setComment

    public final void setComment(Comment comment)

Use this to store additional information to this node.

#### setData

    public final void setData(Object data)

Use this to store additional information to this node.

#### setEndColumn

    public final void setEndColumn(int endColumn)

Sets the end column of this node.

Parameters:
  `endColumn` - the end column of this node

#### setEndLine

    public final void setEndLine(int endLine)

Sets the end line of this node.

Parameters:
  `endLine` - the end line of this node

#### toString

    public final String toString()

Return the String representation of this node.

Overrides:
  `toString` in class `Object`
Returns:
  the String representation of this node

#### hashCode

    public final int hashCode()

Overrides:
  `hashCode` in class `Object`

#### equals

    public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`

#### getParentNode

    public Node getParentNode()

#### getChildrenNodes

    public List<Node> getChildrenNodes()

#### contains

    public boolean contains(Node other)

#### addOrphanComment

    public void addOrphanComment(Comment comment)

#### getOrphanComments

    public List<Comment> getOrphanComments()

This is a list of Comment which are inside the node and are not associated with any meaningful AST Node. For example, comments at the end of methods (immediately before the parenthesis) or at the end of CompilationUnit are orphan comments. When more than one comments preceed a statement, the one immediately preceeding it it is associated with the statements, while the others are "orphan".

Returns:

#### getAllContainedComments

    public List<Comment> getAllContainedComments()

This is the list of Comment which are contained in the Node either because they are properly associated to one of its children or because they are floating around inside the Node.

Returns:

#### setParentNode

    public void setParentNode(Node parentNode)

#### setAsParentNodeOf

    protected void setAsParentNodeOf(List<? extends Node> childNodes)

#### setAsParentNodeOf

    protected void setAsParentNodeOf(Node childNode)

#### isPositionedAfter

    public boolean isPositionedAfter(int line,
                                     int column)

#### isPositionedBefore

    public boolean isPositionedBefore(int line,
                                      int column)