nice
Class StatementInfo

java.lang.Object
  |
  +--nice.StatementInfo

public abstract class StatementInfo
extends java.lang.Object

A Java source file analyzer.

It breaks a Java source file into individual statements. Statement delimiters are: the semicolon character and the open and close brackets.

Statements are grouped in bracket-delimited blocks. This creates a tree structure, where the root node is the source file itself and the leaves are the statements. The middle nodes are the statement blocks corresponding to :


Constructor Summary
protected StatementInfo(StatementInfo parent)
          Creates a new StatementInfo.
 
Method Summary
static StatementInfo analyze(java.lang.String fileName)
          Analyze a Java source file to create a tree structure which represents the program structure.
protected  void changeLabel(java.lang.String newLabel)
          Modifies the label associated to this StatementInfo.
abstract  StatementInfo childAt(int pos)
          Returns the child StatementInfo at index pos.
abstract  int find(StatementInfo si)
          Returns the index of a StatementInfo within the children of this node.
 java.lang.String label()
          Returns the label associated to this node.
abstract  int numberOfChildren()
          Returns the number of children this StatementInfo contains.
 StatementInfo parent()
          Returns the parent of this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatementInfo

protected StatementInfo(StatementInfo parent)
Creates a new StatementInfo.
Method Detail

analyze

public static StatementInfo analyze(java.lang.String fileName)
Analyze a Java source file to create a tree structure which represents the program structure.
Parameters:
fileName - name of the Java source file to analyze.

label

public java.lang.String label()
Returns the label associated to this node. For leaf nodes the label is the statement itself. For the root node the label is the source file name. And for the middle nodes the label is "{}".

parent

public StatementInfo parent()
Returns the parent of this node.

numberOfChildren

public abstract int numberOfChildren()
Returns the number of children this StatementInfo contains.

childAt

public abstract StatementInfo childAt(int pos)
                               throws java.lang.ArrayIndexOutOfBoundsException
Returns the child StatementInfo at index pos.

find

public abstract int find(StatementInfo si)
Returns the index of a StatementInfo within the children of this node. If this node does not contain the StatementInfo, -1 will be returned.

changeLabel

protected void changeLabel(java.lang.String newLabel)
Modifies the label associated to this StatementInfo.