at.ofai.music.beatroot
Class EditAction

java.lang.Object
  extended by at.ofai.music.beatroot.EditAction

public class EditAction
extends java.lang.Object

Implements undo and redo for most beat editing actions. EditActions make up a doubly linked list containing the sequence of changes made to the beat list in their order of occurrence.


Field Summary
private static EditAction current
          The EditAction which would be undone by clicking on "Undo".
static boolean debug
          A flag indicating whether debugging information should be printed.
private static BeatTrackDisplay display
          The main panel of BeatRoot's GUI, which is called to perform undo/redo
 double from
          The original position of a beat, before editing took place.
private static EditAction HEAD
          The head of the list of edit actions, marked by a dummy EditAction object
 EditAction next
          The next edit action in order of occurrence
 EditAction prev
          The previous edit action in order of occurrence
 double to
          The new position of a beat, after editing took place.
 
Constructor Summary
private EditAction(double f, double t, EditAction n, EditAction p)
          Constructor:
 
Method Summary
static void add(double from, double to)
          Add a new EditAction to the list
static void clear()
          Clear the list of EditActions
private  void print()
          Prints a single EditAction (for debugging)
private static void printAll()
          Prints the queue of EditActions (for debugging)
static void redo()
          Redo the last EditAction which was just undone
static void setDisplay(BeatTrackDisplay btd)
          Set up a hook to the GUI's data panel for performing undo/redo
static void undo()
          Undo the last EditAction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

from

public double from
The original position of a beat, before editing took place. A negative value indicates the addition of a new beat.


to

public double to
The new position of a beat, after editing took place. A negative value indicates the deletion of a beat.


next

public EditAction next
The next edit action in order of occurrence


prev

public EditAction prev
The previous edit action in order of occurrence


HEAD

private static final EditAction HEAD
The head of the list of edit actions, marked by a dummy EditAction object


current

private static EditAction current
The EditAction which would be undone by clicking on "Undo". Usually this is the tail of the list, unless a series of undos (possibly interspersed with a smaller number of redos) has just taken place.


display

private static BeatTrackDisplay display
The main panel of BeatRoot's GUI, which is called to perform undo/redo


debug

public static boolean debug
A flag indicating whether debugging information should be printed.

Constructor Detail

EditAction

private EditAction(double f,
                   double t,
                   EditAction n,
                   EditAction p)
Constructor:

Parameters:
f - The original beat time
t - The new beat time
n - The next EditAction
p - The previous EditAction
Method Detail

printAll

private static void printAll()
Prints the queue of EditActions (for debugging)


print

private void print()
Prints a single EditAction (for debugging)


setDisplay

public static void setDisplay(BeatTrackDisplay btd)
Set up a hook to the GUI's data panel for performing undo/redo


add

public static void add(double from,
                       double to)
Add a new EditAction to the list


clear

public static void clear()
Clear the list of EditActions


undo

public static void undo()
Undo the last EditAction


redo

public static void redo()
Redo the last EditAction which was just undone