edu.umn.cs.nlp.parser
Class ParseTree

java.lang.Object
  extended by edu.umn.cs.nlp.parser.ParseTree

public class ParseTree
extends Object

Represents a parse tree.

Version:
$LastChangedDate: 2007-08-02 14:59:03 -0500 (Thu, 02 Aug 2007) $
Author:
Lane Schwartz

Field Summary
static ParseTree NULL_PARSE
          Constant used to denote an empty parse tree.
 
Constructor Summary
ParseTree(String root)
          Constructs a parse tree with no children, with logProb of 0.0.
ParseTree(String root, double logProb)
          Constructs a parse tree with no children.
ParseTree(String root, double logProb, ParseTree... children)
          Constructs a parse tree with provided children.
ParseTree(String root, ParseTree... children)
          Constructs a parse tree with provided children, with logProb of 0.0.
 
Method Summary
 void addChild(ParseTree child)
           
 void addChildren(Collection<ParseTree> children)
           
 ParseTree getChild(int index)
           
 double getLogProb()
           
 int getNumberOfChildren()
           
 String getRoot()
           
 boolean isLeaf()
           
 void setLogProb(double logProb)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL_PARSE

public static final ParseTree NULL_PARSE
Constant used to denote an empty parse tree. The logProb for this tree is equal to Double.NEGATIVE_INFINITY.

Constructor Detail

ParseTree

public ParseTree(String root)
Constructs a parse tree with no children, with logProb of 0.0.

Parameters:
root -

ParseTree

public ParseTree(String root,
                 double logProb)
Constructs a parse tree with no children.

Parameters:
root -
logProb -

ParseTree

public ParseTree(String root,
                 ParseTree... children)
Constructs a parse tree with provided children, with logProb of 0.0.

Parameters:
root -
children -

ParseTree

public ParseTree(String root,
                 double logProb,
                 ParseTree... children)
Constructs a parse tree with provided children.

Parameters:
root -
logProb -
children -
Method Detail

getRoot

public String getRoot()
Returns:
the root of the parse tree

getChild

public ParseTree getChild(int index)
Parameters:
index - the index of the child to be retrieved
Returns:
the specified child node of the parse tree

getNumberOfChildren

public int getNumberOfChildren()

addChild

public void addChild(ParseTree child)

addChildren

public void addChildren(Collection<ParseTree> children)

isLeaf

public boolean isLeaf()

toString

public String toString()
Overrides:
toString in class Object

getLogProb

public double getLogProb()
Returns:
the logProb

setLogProb

public void setLogProb(double logProb)
Parameters:
logProb - the logProb to set