All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class openjava.ptree.Leaf

java.lang.Object
   |
   +----openjava.ptree.PtreeObject
           |
           +----openjava.ptree.Leaf

public class Leaf
extends PtreeObject
implements Ptree
The Leaf class is a token-node in the parse tree of OpenJava.

See Also:
Ptree, NonLeaf

Variable Index

 o charBegin
charBegin is the number of the character at which this token is.
 o line
line is the number of the line at which this token is.

Constructor Index

 o Leaf(int, String)
Allocates a new leaf(token) with its text.
 o Leaf(int, String, int, int)
Allocates a new leaf(token) with its text and where this is.
 o Leaf(String)
Allocates a new leaf(token) with its text.

Method Index

 o equals(Ptree)
Tests if the specified ptree-node equals to this leaf-node.
 o equals(String)
Tests if the specified string equals to this leaf-node's text.
 o getTokenID()
Returns the identifer-number of this token.
 o makeCopy()
Makes a new copy of this leaf-node.
 o makeRecursiveCopy()
Makes a new copy of this leaf-node.
 o toString()
Overrides to return its text as the string of this instance.
 o writeCode()
Writes the code of this token.

Variables

 o line
 public int line
line is the number of the line at which this token is.

 o charBegin
 public int charBegin
charBegin is the number of the character at which this token is.

Constructors

 o Leaf
 public Leaf(String str)
Allocates a new leaf(token) with its text.

Parameters:
term_num - dummy parameter.
str - its text.
 o Leaf
 public Leaf(int term_num,
             String str)
Allocates a new leaf(token) with its text.

Parameters:
term_num - dummy parameter.
str - its text.
 o Leaf
 public Leaf(int term_num,
             String str,
             int line,
             int charBegin)
Allocates a new leaf(token) with its text and where this is.

Parameters:
term_num - dummy parameter.
str - its text.

Methods

 o toString
 public String toString()
Overrides to return its text as the string of this instance.

Returns:
the text of this token.
Overrides:
toString in class PtreeObject
 o makeRecursiveCopy
 public Ptree makeRecursiveCopy()
Makes a new copy of this leaf-node. This method equals to makeCopy().

Returns:
the copy of this nonleaf-node as a ptree-node.
Overrides:
makeRecursiveCopy in class PtreeObject
 o makeCopy
 public Ptree makeCopy()
Makes a new copy of this leaf-node.

Returns:
the copy of this nonleaf-node as a ptree-node.
Overrides:
makeCopy in class PtreeObject
 o equals
 public boolean equals(Ptree p)
Tests if the specified ptree-node equals to this leaf-node.

Parameters:
p - the ptree-node to be tested.
Returns:
true if p equals to this leaf-node
Overrides:
equals in class PtreeObject
 o equals
 public boolean equals(String str)
Tests if the specified string equals to this leaf-node's text.

Parameters:
p - the ptree-node to be tested.
Returns:
true if p equals to this leaf-node
 o getTokenID
 public int getTokenID()
Returns the identifer-number of this token.

Returns:
the identifer-number of this token.
 o writeCode
 public void writeCode()
Writes the code of this token.

Returns:
always true.
Overrides:
writeCode in class PtreeObject

All Packages  Class Hierarchy  This Package  Previous  Next  Index