org.graffiti.plugin.algorithm.animation
Interface Step


public interface Step

One step of an animation. This interface is used by step driven implementations of the Animation interface such as ForwardAnimation and BidirectionalAnimation.

Steps that can be used only in forward animations are supposed to throw UnsupportedOperationException on any attempt to call undo or redo.

Bidirectional animations must be able to undo and redo the effects of the last step performed. Therefore steps used in bidirectional animations must implement undo and redo to process such requests.

After next has been called, undo and redo have to be called strictly alternating; i.e. the only valid sequence of calls to undo and redo on a given step s is:

 
  s.next()
  s.undo()
  s.redo()
  s.undo()
  s.redo()
 
     etc.
 
Note that this places no restrictions on calls to next.

Version:
$Revision$ $Date$
Author:
Harald Frankenberger
See Also:
ForwardAnimation, BidirectionalAnimation

Method Summary
 boolean hasNext()
          Returns true if this step has a successor.
 Step next()
          Performs this step and returns its successor.
 void redo()
          Redoes the effects of this step after it has been undone.
 void undo()
          Undoes the effects of this step after it has been performed or redone.
 

Method Detail

hasNext

boolean hasNext()
Returns true if this step has a successor.

Returns:
true if this step has a successor.

next

Step next()
Performs this step and returns its successor.

Returns:
the successor of this step.
Throws:
IllegalStateException - if this step has no successor.

redo

void redo()
Redoes the effects of this step after it has been undone.

Throws:
IllegalStateException - if this step has not been undone.
UnsupportedOperationException - if this step is a singleton step.

undo

void undo()
Undoes the effects of this step after it has been performed or redone.

Throws:
IllegalStateException - if this step has not been performed or redone yet.
UnsupportedOperationException - if this step is a singleton step.


Generated at 2012-05-30 11:00:14 PM CEST