Modifier and Type | Method and Description |
---|---|
int |
getLevel()
Returns the current level.
|
StateBool |
makeStateBool(boolean initValue)
Creates a Stateful boolean (restorable)
|
StateInt |
makeStateInt(int initValue)
Creates a Stateful integer (restorable)
|
StateMap |
makeStateMap()
Creates a Stateful map (restorable)
|
void |
onRestore(Procedure listener)
Add a listener that is notified each time the
restoreState()
is called. |
void |
restoreAllState()
Restores the state as it was at level 0 (first saveState)
The level is now -1.
|
void |
restoreState()
Restores state as it was at getLevel()-1
Decrease the level by 1
|
void |
restoreStateUntil(int level)
Restores the state up the the given level.
|
void |
saveState()
Stores the current state
such that it can be recovered using restoreState()
Increase the level by 1
|
void |
withNewState(Procedure body)
Higher-order function that preserves the state prior to calling body and restores it after.
|
void saveState()
void restoreState()
void restoreAllState()
void restoreStateUntil(int level)
level
- the level, a non negative number between 0 and getLevel()
void onRestore(Procedure listener)
restoreState()
is called.listener
- the listener to be notifiedint getLevel()
saveState()
and decreased at each restoreState()
.
It is initially equal to -1.StateInt makeStateInt(int initValue)
initValue
- the initial setValueStateBool makeStateBool(boolean initValue)
initValue
- the initial setValueStateMap makeStateMap()
void withNewState(Procedure body)
body
- the first-order function to execute.Copyright © 2018 Laurent Michel, Pierre Schaus, Pascal Van Hentenryck. All rights reserved.