|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object flattree.tree.AbstractLeaf
public abstract class AbstractLeaf
Base class handling common functionality of leaves.
throwOnRead(String, ReadLine)
,
read(ReadLine, State)
,
write(WriteLine, State)
Field Summary |
---|
Fields inherited from interface flattree.tree.Leaf |
---|
REQUIRED |
Constructor Summary | |
---|---|
AbstractLeaf()
|
Method Summary | |
---|---|
boolean |
getThrowOnRead()
|
boolean |
read(ReadLine line,
State state)
Delegates to readImpl(ReadLine, State) and sets the read range
on the State . |
protected abstract boolean |
readImpl(ReadLine line,
State state)
Do the actual reading. |
void |
setThrowOnRead(boolean throwOnRead)
Should the inability to read from a ReadLine fail by throwing a
TreeException or just return false instead. |
AbstractLeaf |
throwOnRead()
Convenience mutator supporting method chaining. |
protected void |
throwOnRead(String message,
ReadLine line)
Throw a TreeException because of a read failure if so configured. |
void |
write(WriteLine line,
State state)
Delegates to writeImpl(WriteLine, State) and sets the written
range on the State . |
protected abstract void |
writeImpl(WriteLine line,
State state)
Do the actual writing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractLeaf()
Method Detail |
---|
public void setThrowOnRead(boolean throwOnRead)
ReadLine
fail by throwing a
TreeException
or just return false
instead.
throwOnRead
- throwOnRead(String, ReadLine)
,
Leaf.read(ReadLine, State)
,
Node.read(ReadLine, State)
public boolean getThrowOnRead()
setThrowOnRead(boolean)
public AbstractLeaf throwOnRead()
setThrowOnRead(boolean)
protected void throwOnRead(String message, ReadLine line) throws TreeException
TreeException
because of a read failure if so configured.
message
- message of exceptionline
- the failed line
TreeException
- if configured to throw on readsetThrowOnRead(boolean)
public final void write(WriteLine line, State state)
writeImpl(WriteLine, State)
and sets the written
range on the State
.
write
in interface Leaf
line
- line to write tostate
- state to put this leaf's value toState.setRange(Leaf, int, int)
protected abstract void writeImpl(WriteLine line, State state)
public final boolean read(ReadLine line, State state)
readImpl(ReadLine, State)
and sets the read range
on the State
.
read
in interface Leaf
line
- line to read fromstate
- state to get this leaf's value from
true
if leaf could be read or false
otherwiseState.setRange(Leaf, int, int)
,
setThrowOnRead(boolean)
protected abstract boolean readImpl(ReadLine line, State state)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |