Class UndoManager

java.lang.Object
org.aesh.readline.undo.UndoManager

public class UndoManager extends Object
Manages a stack of undo actions for line editing operations.
Author:
Ståle W. Pedersen
  • Constructor Details

    • UndoManager

      public UndoManager()
      Creates a new UndoManager with an empty undo stack.
  • Method Details

    • getNext

      public UndoAction getNext()
      Retrieves and removes the next undo action from the stack.
      Returns:
      the next undo action, or null if the stack is empty
    • addUndo

      public void addUndo(UndoAction u)
      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