* Copyright (C) 2010 Robert Futrell
* robert_futrell at users.sourceforge.net
* http://fifesoft.com/rsyntaxtextarea
* This library is distributed under a modified BSD license. See the included
* RSTALanguageSupport.License.txt file for details.
package org.fife.rsta.ac.java.rjc.ast;
import org.fife.rsta.ac.java.rjc.lexer.Offset;
* Base implementation of an AST node.
abstract class AbstractASTNode implements ASTNode {
private Offset startOffs;
protected AbstractASTNode(String name, Offset start) {
protected AbstractASTNode(String name, Offset start, Offset end) {
public String getName() {
public int getNameEndOffset() {
return endOffs!=null ? endOffs.getOffset() : Integer.MAX_VALUE;
public int getNameStartOffset() {
return startOffs!=null ? startOffs.getOffset() : 0;
public void setDeclarationEndOffset(Offset end) {
* Sets the start and end offsets of this node.
* @param start The start offset.
* @param end The end offset.
protected void setDeclarationOffsets(Offset start, Offset end) {
* Returns the name of this node (e.g. the value of {@link #getName()}.
* Subclasses can override this method if appropriate.
* @return A string representation of this node.
public String toString() {