This repository has been archived on 2022-02-11. You can view files and clone it, but cannot push or open issues or pull requests.
undo-redo/core/src/main/java/dev/kske/undoredo/Change.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();
}