mauda.undoredo
Class UndoRedoElement

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

public class UndoRedoElement
extends java.lang.Object

Stores one single elementary undo/redo element

Author:
Markus Krebs

Field Summary
static int APPEND
          ID that indicates that an operation was appended
static int DELETE
          ID that indicates that an operation was deleted
static int UNDEFINED
          ID for defining a undefined element, only for initialisation used.
 
Constructor Summary
UndoRedoElement()
          Creates an UndoRedoElement
UndoRedoElement(int p, java.lang.Object o, int i)
          Creates an UndoRedoElement
 
Method Summary
 int getID()
          Returns the ID of the change
 java.lang.Object getObj()
          Returns the corresponding object
 int getPos()
          Returns the position where the change occured
 UndoRedoElement invert()
          Inverts this element.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDEFINED

public static final int UNDEFINED
ID for defining a undefined element, only for initialisation used. An UndoRedoElement with this state cannot processed!

See Also:
Constant Field Values

DELETE

public static final int DELETE
ID that indicates that an operation was deleted

See Also:
Constant Field Values

APPEND

public static final int APPEND
ID that indicates that an operation was appended

See Also:
Constant Field Values
Constructor Detail

UndoRedoElement

public UndoRedoElement()
Creates an UndoRedoElement


UndoRedoElement

public UndoRedoElement(int p,
                       java.lang.Object o,
                       int i)
Creates an UndoRedoElement

Parameters:
p - The position where the change occures
o - The corresponding object (operation, fibheap, etc.)
i - ID
Method Detail

getPos

public int getPos()
Returns the position where the change occured

Returns:
position

getObj

public java.lang.Object getObj()
Returns the corresponding object

Returns:
object

getID

public int getID()
Returns the ID of the change

Returns:
ID

invert

public UndoRedoElement invert()
Inverts this element. This means that an DELETE is changed to APPEND and vice versa. Used to undo an action.

Returns:
inverted element

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object