|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface TreeFactory
A TreeFactory acts as a factory for creating objects of
class Tree, or some descendent class.
Methods implementing this interface may assume that the List
of children passed to them is a list that actually contains trees, but
this can't be enforced in Java without polymorphic types.
The methods with a String argument do not guarantee
that the tree label() will be a String -- the TreeFactory may
convert it into some other type.
| Method Summary | |
|---|---|
Tree |
newLeaf(Label label)
Create a new tree leaf node, with the given label. |
Tree |
newLeaf(String word)
Create a new tree leaf node, where the label is formed from the String passed in. |
Tree |
newTreeNode(Label label,
List children)
Create a new tree nonleaf node, with the given label. |
Tree |
newTreeNode(String parent,
List children)
Create a new tree nonleaf node, where the label is formed from the String passed in. |
| Method Detail |
|---|
Tree newLeaf(String word)
String passed in.
word - The word that will go into the tree label.
Tree newTreeNode(String parent,
List children)
String passed in.
parent - The string that will go into the parent tree label.children - The list of daughters of this tree. The children
may be a (possibly empty) List of children or
null
Tree newLeaf(Label label)
label - The label for the leaf node
Tree newTreeNode(Label label,
List children)
label - The label for the parent tree node.children - The list of daughters of this tree. The children
may be a (possibly empty) List of children or
null
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||