34 lines
668 B
Java
34 lines
668 B
Java
|
package dev.kske.undoredo;
|
||
|
|
||
|
/**
|
||
|
* Base interface for changes to be registered in an undo manager.
|
||
|
*
|
||
|
* @author Maximilian Käfer
|
||
|
* @since 0.0.1
|
||
|
*/
|
||
|
public interface Change {
|
||
|
|
||
|
/**
|
||
|
* Performs the action implemented by this change.
|
||
|
*
|
||
|
* @since 0.0.1
|
||
|
*/
|
||
|
void apply();
|
||
|
|
||
|
/**
|
||
|
* Inverts this change.
|
||
|
*
|
||
|
* @implSpec This method is not supposed to alter the state of this change, but rather to create
|
||
|
* a new complementary change.
|
||
|
* @return the inverted change
|
||
|
* @since 0.0.1
|
||
|
*/
|
||
|
Change invert();
|
||
|
|
||
|
/**
|
||
|
* @return whether the application of this change would result in an identical state
|
||
|
* @since 0.0.1
|
||
|
*/
|
||
|
boolean isIdentity();
|
||
|
}
|