Package | com.yworks.support |
Interface | public interface IMementoSupport |
Implementors | NodeMementoMementoSupport |
MementoUndoUnit
to create IUndoUnit
implementations.
This interface uses the memento design pattern to implement undoability.
Method | Defined By | ||
---|---|---|---|
applyState(subject:Object, state:Object):void
Reapplies a previously queried state memento object to a given subject. | IMementoSupport | ||
getState(subject:Object):Object
Retrieves the state of a given subject as a memento. | IMementoSupport | ||
stateEquals(state1:Object, state2:Object):Boolean
Utility method that can determine whether two state memento objects are equal. | IMementoSupport |
applyState | () | method |
public function applyState(subject:Object, state:Object):void
Reapplies a previously queried state memento object to a given subject.
The state object has been created using the getState
method.
Parameters
subject:Object — The subject to modify the state.
| |
state:Object — The state memento object as returned by GetState
|
getState | () | method |
public function getState(subject:Object):Object
Retrieves the state of a given subject as a memento.
The state memento returned can later be reapplied to the subject using the applyState
method.
Parameters
subject:Object — The subject to read the state from.
|
Object — An instance that describes the current state of subject .
|
stateEquals | () | method |
public function stateEquals(state1:Object, state2:Object):Boolean
Utility method that can determine whether two state memento objects are equal.
Conservative implementations my simply return false
. If this method yields
true
the state is considered not to have changed and no undo unit will be created.
Parameters
state1:Object — The first state as obtained from GetState
| |
state2:Object — The second state as obtained from GetState
|
Boolean — If the states equal and thus there is no need to apply state1
to an instance whose state is already state2
|