|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.wlu.cs.levy.RAAM.Tree
Tree is a class supporting trees of arbitrary arity.
Field Summary | |
edu.wlu.cs.levy.RAAM.Tree[] |
branches
|
java.lang.String |
value
|
Constructor Summary | |
Tree(java.lang.String s)
Creates a tree by parsing a parenthesized expression. |
|
Tree(edu.wlu.cs.levy.RAAM.Tree[] b)
Creates tree from a shallow copy of multiple branches. |
|
Tree(edu.wlu.cs.levy.RAAM.Tree l,
edu.wlu.cs.levy.RAAM.Tree r)
Creates a tree from two branches. |
Method Summary | |
int |
arity()
Returns the arity (number of branches) of the tree. |
int |
depth()
Returns the depth of the tree. |
boolean |
equals(java.lang.Object o)
Overrides Object.equals() method. |
java.lang.String |
frontier()
Returns the frontier of the tree. |
edu.wlu.cs.levy.RAAM.Tree |
getBranch(int n)
Returns a branch of the tree. |
java.lang.String |
getValue()
Returns the string in the value field of the tree. |
int |
hashCode()
Overrides Object.hashCode() method. |
boolean |
isTerminal()
Determines whether tree is terminal (has non-empty value). |
edu.wlu.cs.levy.RAAM.Tree[] |
subtrees()
Returns all subtrees of the tree. |
java.lang.String |
toString()
Overrides Object.toString() method. |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public java.lang.String value
public edu.wlu.cs.levy.RAAM.Tree[] branches
Constructor Detail |
public Tree(java.lang.String s)
s
- the parenthesized expressionpublic Tree(edu.wlu.cs.levy.RAAM.Tree[] b)
b
- the branchespublic Tree(edu.wlu.cs.levy.RAAM.Tree l, edu.wlu.cs.levy.RAAM.Tree r)
l
- the left branchr
- the right branchMethod Detail |
public boolean isTerminal()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String getValue()
public edu.wlu.cs.levy.RAAM.Tree getBranch(int n)
n
- branch index (first = 0)
public int arity()
public int depth()
public java.lang.String frontier()
public edu.wlu.cs.levy.RAAM.Tree[] subtrees()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |