Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## mauda.undoredo
Class UndoRedo

    java.lang.Object
      mauda.undoredo.UndoRedo

All Implemented Interfaces:
  ExerciseUpdateListener

Direct Known Subclasses:
  AnimatedUndoRedo

    public class UndoRedo

extends java.lang.Object
implements ExerciseUpdateListener

Stores copies of the current data-structure (e.g. FibHeap), so that it is possible to quickly undo/redo operations. If a animated redo needed, please use AnimatedUndoRedo.

Author:
  Markus Krebs

Constructor Summary
`UndoRedo(Exercise exercise)` Creates a UndoRedo-Handler.

Method Summary
`boolean` | `canBack()` Check if a step back is possible
`boolean` | `canForward()` Check if a step forward is possible
`boolean` | `canRedo()` Check if a redo is possible
`boolean` | `canUndo()` Check if an undo is possible
`void` | `clear()` Clears all entries in the undo-redo-queue
`void` | `exerciseUpdate(ExerciseUpdateEvent e)` Invoked when an Event occures
`java.lang.Object` | `getDSObject()` Method for retrieving the current data-structure-object,
`java.lang.Object` | `getEntry(int offset)` Methode for retrieving a specific data-structure-object
`int` | `getRedoJumpDelta()` Returns the new delta-positoin to jump to, when the next action should be a redo.
`int` | `getUndoJumpDelta()` Returns the new delta-position to jump to, when the next action should be an undo.
`void` | `initialSnapshot(java.lang.Object o)` Creates a snapshot for a given operation.
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### UndoRedo

    public UndoRedo(Exercise exercise)

  Creates a UndoRedo-Handler.

  Parameters:
    `exercise` - The Exercise

Method Detail

### exerciseUpdate

    public void exerciseUpdate(ExerciseUpdateEvent e)

  Description copied from interface: `ExerciseUpdateListener`
  Invoked when an Event occures

  Specified by:
    `exerciseUpdate` in interface `ExerciseUpdateListener`
  Parameters:
    `e` - The event

### initialSnapshot

    public void initialSnapshot(java.lang.Object o)

  Creates a snapshot for a given operation.
  In this data-structure (UndoRedo) there must be always one entry at the beginning because if the user jumps to the beginning of the exercise a valid data-structure (e.g. an empty one) is necessary. This method generates this initial data-structure.

  Parameters:
    `o` - generally deliver `null`

### canBack

    public boolean canBack()

  Check if a step back is possible

  Returns:
    Returns true, if possible, false, otherwise

### canForward

    public boolean canForward()

  Check if a step forward is possible

  Returns:
    Returns true, if possible, false, otherwise

### canUndo

    public boolean canUndo()

  Check if an undo is possible

  Returns:
    Returns true, if possible, false, otherwise

### canRedo

    public boolean canRedo()

  Check if a redo is possible

  Returns:
    Returns true, if possible, false, otherwise

### getUndoJumpDelta

    public int getUndoJumpDelta()

  Returns the new delta-position to jump to, when the next action should be an undo.

  Returns:
    relative jump-delta

### getRedoJumpDelta

    public int getRedoJumpDelta()

  Returns the new delta-positoin to jump to, when the next action should be a redo.

  Returns:
    relative jump-delta

### clear

    public void clear()

  Clears all entries in the undo-redo-queue

### getDSObject

    public java.lang.Object getDSObject()

  Method for retrieving the current data-structure-object,

  Returns:
    The data-structure-object, e.g. FibHeap

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### getEntry

    public java.lang.Object getEntry(int offset)

  Methode for retrieving a specific data-structure-object

  Parameters:
    `offset` - The offset inside the undo-redo-queue
  Returns:
    The data-structure-object, e.g. FibHeap

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD