36 lines
852 B
Java
36 lines
852 B
Java
package dev.kske.undoredo.core;
|
|
|
|
/**
|
|
* Base interface for changes to be registered in a change 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();
|
|
|
|
/**
|
|
* @apiNote If this method returns {@code true} when adding this change to a change manager, it
|
|
* will be discarded immediately and therefore can be garbage collected.
|
|
* @return whether the application of this change would result in an identical state
|
|
* @since 0.0.1
|
|
*/
|
|
boolean isIdentity();
|
|
}
|