Class UndoManager
java.lang.Object
org.aesh.readline.undo.UndoManager
Manages a stack of undo actions for line editing operations.
- Author:
- Ståle W. Pedersen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an undo action to the stack.voidclear()Clears all undo actions from the stack.getNext()Retrieves and removes the next undo action from the stack.booleanisEmpty()Checks if the undo stack is empty.intsize()Returns the number of undo actions in the stack.
-
Constructor Details
-
UndoManager
public UndoManager()Creates a new UndoManager with an empty undo stack.
-
-
Method Details
-
getNext
Retrieves and removes the next undo action from the stack.- Returns:
- the next undo action, or null if the stack is empty
-
addUndo
Adds an undo action to the stack. If the stack exceeds its maximum size, the oldest action is removed.- Parameters:
u- the undo action to add
-
clear
public void clear()Clears all undo actions from the stack. -
isEmpty
public boolean isEmpty()Checks if the undo stack is empty.- Returns:
- true if there are no undo actions, false otherwise
-
size
public int size()Returns the number of undo actions in the stack.- Returns:
- the number of undo actions
-