Basic API Structure #2
@ -3,7 +3,11 @@ package dev.kske.undoredo;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param <C> the change types to store in this change manager
|
* A change manager keeps track of subsequent changes and allows un- and redoing them. A specific
|
||||||
|
* change can be marked using {@link #mark()} to keep track of a saved state in the application that
|
||||||
|
* uses the manager.
|
||||||
|
*
|
||||||
|
* @param <C> the change type to store in this change manager
|
||||||
* @author Maximilian Käfer
|
* @author Maximilian Käfer
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
@ -15,7 +19,7 @@ public final class ChangeManager<C extends Change> {
|
|||||||
private int markedIndex;
|
private int markedIndex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a change to the changes list.
|
* Applies the given change and appends it to the change list.
|
||||||
*
|
*
|
||||||
* @param change the change to add
|
* @param change the change to add
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
@ -26,9 +30,9 @@ public final class ChangeManager<C extends Change> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undoes the change at the current index position.
|
* Undoes the current change.
|
||||||
*
|
*
|
||||||
* @return whether the operation could be executed due to one being currently available
|
* @return whether an action was performed
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
*/
|
*/
|
||||||
public boolean undo() {
|
public boolean undo() {
|
||||||
@ -43,7 +47,7 @@ public final class ChangeManager<C extends Change> {
|
|||||||
/**
|
/**
|
||||||
* Applies the change that was undone before.
|
* Applies the change that was undone before.
|
||||||
*
|
*
|
||||||
* @return whether the operation could be executed due to one being currently available
|
* @return whether an action was performed
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
public boolean redo() {
|
public boolean redo() {
|
||||||
@ -56,7 +60,7 @@ public final class ChangeManager<C extends Change> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks the current index.
|
* Marks the current change.
|
||||||
*
|
*
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
@ -65,7 +69,7 @@ public final class ChangeManager<C extends Change> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return whether the current index was marked
|
* @return whether the current change is marked
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
public boolean isAtMarkedIndex() {
|
public boolean isAtMarkedIndex() {
|
||||||
@ -73,7 +77,7 @@ public final class ChangeManager<C extends Change> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return whether the undo operation is currently available
|
* @return whether a change is present that can be undone
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
public boolean isUndoAvailable() {
|
public boolean isUndoAvailable() {
|
||||||
@ -81,7 +85,7 @@ public final class ChangeManager<C extends Change> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return whether the redo operation is currently available.
|
* @return whether a change is present that can be redone
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
public boolean isRedoAvailable() {
|
public boolean isRedoAvailable() {
|
||||||
|
Reference in New Issue
Block a user