|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectflattree.tree.AbstractNode
public abstract class AbstractNode
Base class fhandling common functionality of nodes.
read(ReadLine, State),
write(WriteLine, State)| Constructor Summary | |
|---|---|
AbstractNode()
|
|
AbstractNode(String name)
|
|
| Method Summary | |
|---|---|
AbstractNode |
add(Leaf leaf)
Add a single leaf. |
AbstractNode |
add(Node node)
A a single child node. |
protected ReadLine |
beforeRead(ReadLine line)
Hook method for subclasses to wrap the line to read from. |
protected WriteLine |
beforeWrite(WriteLine line)
Hook method for subclasses to wrap the line to write to. |
List<Leaf> |
getLeaves()
Get all leaves. |
String |
getName()
Name of node. |
List<Node> |
getNodes()
Get all children nodes. |
boolean |
read(ReadLine line,
State state)
Delegates reading to all leaves and sets the range on the State. |
void |
setLeaves(List<Leaf> leaves)
Set the leaves of this node. |
void |
setName(String name)
|
void |
setNodes(List<Node> nodes)
Set the children nodes. |
void |
write(WriteLine line,
State state)
Delegates writing to all leaves and sets the range on the State. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractNode()
public AbstractNode(String name)
| Method Detail |
|---|
public void setName(String name)
public String getName()
Node
getName in interface Nodepublic void setLeaves(List<Leaf> leaves)
leaves - the leavespublic AbstractNode add(Leaf leaf)
leaf - leaf to add
public List<Leaf> getLeaves()
getLeaves in interface NodeCollections.unmodifiableList(List)public void setNodes(List<Node> nodes)
nodes - children nodespublic AbstractNode add(Node node)
node - node to add
public List<Node> getNodes()
getNodes in interface Node
public final boolean read(ReadLine line,
State state)
State.
read in interface Nodeline - line to read fromstate - state to get values for leaves from
false if one of the leaves cannot be readbeforeRead(ReadLine),
Leaf.read(ReadLine, State),
State.setRange(int, int)protected ReadLine beforeRead(ReadLine line)
line - line to wrap before read
public void write(WriteLine line,
State state)
State.
write in interface Nodeline - line to write tostate - state to put values of leaves tobeforeWrite(WriteLine),
Leaf.write(WriteLine, State),
State.setRange(int, int)protected WriteLine beforeWrite(WriteLine line)
line - line to wrap before write
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||