mauda.undoredo
Class UndoRedoUnit

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

public class UndoRedoUnit
extends java.lang.Object

Stores several UndoRedoElements as one unit. All this elements will be undoed or redoed in one step.

Author:
Markus Krebs

Constructor Summary
UndoRedoUnit()
          Creates an UndoRedoUnit
 
Method Summary
 void addElement(UndoRedoElement ure)
          Adds an UndoRedoElement to this UndoRedoUnit.
 boolean equals(java.lang.Object o)
           
 java.util.Vector getElements()
          Returns all UndoRedoElements of this UndoRedoUnit
 int getMaxAppendPos()
          Returns the maximum position of all APPEND-UndoRedoElements.
 UndoRedoUnit invert()
          Inverts this UndoRedoUnit.
 void perform(java.util.Vector v)
          Performs this unit on the given object-vector
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UndoRedoUnit

public UndoRedoUnit()
Creates an UndoRedoUnit

Method Detail

addElement

public void addElement(UndoRedoElement ure)
Adds an UndoRedoElement to this UndoRedoUnit.

Parameters:
ure - UndoRedoElement to add

getElements

public java.util.Vector getElements()
Returns all UndoRedoElements of this UndoRedoUnit

Returns:
UndoRedoElements.

perform

public void perform(java.util.Vector v)
Performs this unit on the given object-vector

Parameters:
v - object-vector

invert

public UndoRedoUnit invert()
Inverts this UndoRedoUnit. This means that all containing UndoRedoElements are inverted and the order of the UndoRedoElements will be reversed.

Returns:
inverted UndoRedoUnit

getMaxAppendPos

public int getMaxAppendPos()
Returns the maximum position of all APPEND-UndoRedoElements. If this UndoRedoUnit doesnt contain an APPEND-UndoRedoElement, than the minimum position minus 1 of all DELETE-UndoRedoElements will be returned.

Returns:
position

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

toString

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