mauda.undoredo
Class UndoRedoInfo

java.lang.Object
  extended by mauda.undoredo.UndoRedoInfo

public class UndoRedoInfo
extends java.lang.Object

Stores several UndoRedoUnits in an undo/redo-vector. Therefore this class can hold the whole undo/redo-information for specific objects like operations, fibheaps, etc.

Author:
Markus Krebs

Field Summary
 boolean DEBUG
           
 
Constructor Summary
UndoRedoInfo()
          Creates a new UndoRedoInfo.
 
Method Summary
 void addUnit(UndoRedoUnit uru)
          Adds an UndoRedoUnit to the undo/redo-vector
 boolean canRedo()
          Checks if a redo is possible
 boolean canUndo()
          Checks if an undo is possible
 void clear(java.util.Vector fill)
          Clears the object-vector, and adds fill to it.
 void clearFollowing(int p, java.util.Vector v)
          Removes all following objects from the object-vector after the position p
 int getRedoJumpPosition()
          Returns the maximum possible position after a redo
 int getUndoJumpPosition()
          Returns the maximum possible position after an undo.
 UndoRedoUnit redo(java.util.Vector v)
          Redos this unit
 void storeChange(int p, java.util.Vector v, java.lang.Object newObject)
          Performs a change on the vector.
 UndoRedoUnit undo(java.util.Vector v)
          Undos this unit
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public boolean DEBUG
Constructor Detail

UndoRedoInfo

public UndoRedoInfo()
Creates a new UndoRedoInfo.

Method Detail

storeChange

public void storeChange(int p,
                        java.util.Vector v,
                        java.lang.Object newObject)
Performs a change on the vector.

Parameters:
p - The position of the change
v - The vector to perform the change on
newObject - The object to append.

addUnit

public void addUnit(UndoRedoUnit uru)
Adds an UndoRedoUnit to the undo/redo-vector

Parameters:
uru - A UndoRedoUnit

undo

public UndoRedoUnit undo(java.util.Vector v)
Undos this unit

Parameters:
v - The object-vector
Returns:
The performed UndoRedoUnit

redo

public UndoRedoUnit redo(java.util.Vector v)
Redos this unit

Parameters:
v - The object-vector
Returns:
The performed UndoRedoUnit

getUndoJumpPosition

public int getUndoJumpPosition()
Returns the maximum possible position after an undo.

Returns:
maximum possible position

getRedoJumpPosition

public int getRedoJumpPosition()
Returns the maximum possible position after a redo

Returns:
maximum possible position

canUndo

public boolean canUndo()
Checks if an undo is possible

Returns:
true if undo is possible, false otherwise

canRedo

public boolean canRedo()
Checks if a redo is possible

Returns:
true if redo is possible, false otherwise

clear

public void clear(java.util.Vector fill)
Clears the object-vector, and adds fill to it.

Parameters:
fill - the new object-vector

clearFollowing

public void clearFollowing(int p,
                           java.util.Vector v)
Removes all following objects from the object-vector after the position p

Parameters:
p - clear-position
v - the object-vector