koala.dynamicjava.tree
Class Node

java.lang.Object
  extended bykoala.dynamicjava.tree.Node
Direct Known Subclasses:
ConstructorDeclaration, Expression, FieldDeclaration, FormalParameter, ImportDeclaration, Initializer, MethodDeclaration, PackageDeclaration, Statement, SwitchBlock, Type, TypeDeclaration, VariableDeclaration

public abstract class Node
extends java.lang.Object

This class represents the nodes of the syntax tree


Field Summary
static java.lang.String BEGIN_COLUMN
          The beginColumn property name
static java.lang.String BEGIN_LINE
          The beginLine property name
static java.lang.String END_COLUMN
          The endColumn property name
static java.lang.String END_LINE
          The endLine property name
static java.lang.String FILENAME
          The filename property name
 
Constructor Summary
protected Node(java.lang.String fn, int bl, int bc, int el, int ec)
          Initializes the node
 
Method Summary
abstract  java.lang.Object acceptVisitor(Visitor visitor)
          Allows a visitor to traverse the tree
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list.
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener for a specific property.
protected  void firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)
          Report a bound property update to any registered listeners.
protected  void firePropertyChange(java.lang.String propertyName, int oldValue, int newValue)
          Report a bound property update to any registered listeners.
protected  void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          Report a bound property update to any registered listeners.
 int getBeginColumn()
          Returns the begin column of this node in the begin line
 int getBeginLine()
          Returns the begin line of this node in the source code
 int getEndColumn()
          Returns the end column of this node in the end line
 int getEndLine()
          Returns the end line of this node in the source code
 java.lang.String getFilename()
          Returns the filename.
 java.util.Set getProperties()
          Returns the defined properties for this node.
 java.lang.Object getProperty(java.lang.String name)
          Returns the value of a property
 boolean hasProperty(java.lang.String name)
          Returns true if a property is defined for this node
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener for a specific property.
 void setBeginColumn(int i)
          Sets the begin column
 void setBeginLine(int i)
          Sets the begin line
 void setEndColumn(int i)
          Sets the end column
 void setEndLine(int i)
          Sets the end line
 void setFilename(java.lang.String s)
          Sets the filename
 void setProperty(java.lang.String name, java.lang.Object value)
          Sets the value of a property
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILENAME

public static final java.lang.String FILENAME
The filename property name

See Also:
Constant Field Values

BEGIN_LINE

public static final java.lang.String BEGIN_LINE
The beginLine property name

See Also:
Constant Field Values

END_LINE

public static final java.lang.String END_LINE
The endLine property name

See Also:
Constant Field Values

BEGIN_COLUMN

public static final java.lang.String BEGIN_COLUMN
The beginColumn property name

See Also:
Constant Field Values

END_COLUMN

public static final java.lang.String END_COLUMN
The endColumn property name

See Also:
Constant Field Values
Constructor Detail

Node

protected Node(java.lang.String fn,
               int bl,
               int bc,
               int el,
               int ec)
Initializes the node

Parameters:
fn - the filename
bl - the begin line
bc - the begin column
el - the end line
ec - the end column
Method Detail

getFilename

public java.lang.String getFilename()
Returns the filename. Can be null.


setFilename

public void setFilename(java.lang.String s)
Sets the filename


getBeginLine

public int getBeginLine()
Returns the begin line of this node in the source code


setBeginLine

public void setBeginLine(int i)
Sets the begin line


getBeginColumn

public int getBeginColumn()
Returns the begin column of this node in the begin line


setBeginColumn

public void setBeginColumn(int i)
Sets the begin column


getEndLine

public int getEndLine()
Returns the end line of this node in the source code


setEndLine

public void setEndLine(int i)
Sets the end line


getEndColumn

public int getEndColumn()
Returns the end column of this node in the end line


setEndColumn

public void setEndColumn(int i)
Sets the end column


setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Sets the value of a property

Parameters:
name - the property name
value - the new value to set

getProperty

public java.lang.Object getProperty(java.lang.String name)
Returns the value of a property

Parameters:
name - the property name
Returns:
null if the property was not previously set

getProperties

public java.util.Set getProperties()
Returns the defined properties for this node.

Returns:
a set of string

hasProperty

public boolean hasProperty(java.lang.String name)
Returns true if a property is defined for this node

Parameters:
name - the name of the property

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. The listener is registered for all properties.

Parameters:
listener - The PropertyChangeListener to be added

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Parameters:
listener - The PropertyChangeListener to be removed

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener for a specific property. The listener will be invoked only when a call on firePropertyChange names that specific property.

Parameters:
propertyName - The name of the property to listen on.
listener - The PropertyChangeListener to be added

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener for a specific property.

Parameters:
propertyName - The name of the property that was listened on.
listener - The PropertyChangeListener to be removed

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  boolean oldValue,
                                  boolean newValue)
Report a bound property update to any registered listeners. No event is fired if old and new are equal and non-null.

Parameters:
propertyName - The programmatic name of the property that was changed.
oldValue - The old value of the property.
newValue - The new value of the property.

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  int oldValue,
                                  int newValue)
Report a bound property update to any registered listeners. No event is fired if old and new are equal and non-null.

Parameters:
propertyName - The programmatic name of the property that was changed.
oldValue - The old value of the property.
newValue - The new value of the property.

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)
Report a bound property update to any registered listeners. No event is fired if old and new are equal and non-null.

Parameters:
propertyName - The programmatic name of the property that was changed.
oldValue - The old value of the property.
newValue - The new value of the property.

acceptVisitor

public abstract java.lang.Object acceptVisitor(Visitor visitor)
Allows a visitor to traverse the tree

Parameters:
visitor - the visitor to accept


Copyright © 2001 Stephane Hillion. All Rights Reserved.