org.graffiti.plugin.algorithm.animation
Interface Animation

All Known Implementing Classes:
AbstractAnimation, BidirectionalAnimation, ForwardAnimation

public interface Animation

An animated version of an algorithm. Basically an animation iterates over the sequence of steps as performed by an algorithm.

An animation can support iteration forward and backward by means of the methods nextStep, previousStep and clear. As long as the preconditions of the algorithm underlying this animation are not satisfied, isReady will return false and any attempt to call hasNextStep, hasPreviousStep, nextStep or previousStep will throw IllegalStateException.

Animations can react differently on the event of the underlying graph being modified. This behaviour is specified by the animation's GraphModificationPolicy.

Version:
$Revision$ $Date$
Author:
Harald Frankenberger
See Also:
Animation.GraphModificationPolicy

Nested Class Summary
static interface Animation.GraphModificationPolicy
          Specifies the behaviour of an animation on the event of its underlying graph being modified.
 
Field Summary
static Animation EMPTY_ANIMATION
           
 
Method Summary
 void clear()
          Resets this animation to its initial state.
 Animation.GraphModificationPolicy getGraphModificationPolicy()
          Returns the graph modification policy of this animation.
 String getName()
          Returns the name of this animation.
 boolean hasNextStep()
          Returns true if this animation has a next step.
 boolean hasPreviousStep()
          Returns true if this animation has a previous step.
 boolean isCleared()
          Returns true if this animation is cleared; i.e.
 boolean isReady()
          Returns true if the preconditions of the algorithm underlying this animation are satisfied.
 void nextStep()
          Computes the next state of the underlying algorithm; i.e.
 void previousStep()
          Computes the previous state of the underlying algorithm; i.e.
 boolean supportsClear()
          Returns true if this animation supports clearing; i.e.
 boolean supportsPreviousStep()
          Returns true if this animation supports steps to previous states of the underlying algorithm.
 

Field Detail

EMPTY_ANIMATION

static final Animation EMPTY_ANIMATION
Method Detail

isReady

boolean isReady()
Returns true if the preconditions of the algorithm underlying this animation are satisfied.

Returns:
true if the preconditions of the algoritm underlying this animation are satisfied.

supportsClear

boolean supportsClear()
Returns true if this animation supports clearing; i.e. a call to clear or isCleared will not throw UnsupportedOperationException.

Returns:
true if this animation supports clearing.
See Also:
clear(), isCleared()

isCleared

boolean isCleared()
Returns true if this animation is cleared; i.e. it is newly created or clear has been called and no change of state has occured yet.

Returns:
true if this animation is cleared.
Throws:
UnsupportedOperationException - if this animation does not support clear.
See Also:
supportsClear(), clear()

clear

void clear()
Resets this animation to its initial state. A call to clear is the only means of resetting an animation if steps to previous states are not supported.

On completion of a call to clear, an animation's state is equivalent to its state immediately after constructor invocation. Note that this implies, that all modifications to the animation's data are undone, too; i.e. data structures are cleared, changes to the underlying graph are undone, etc.


hasNextStep

boolean hasNextStep()
Returns true if this animation has a next step.

Returns:
true if this animation has a next step.

hasPreviousStep

boolean hasPreviousStep()
Returns true if this animation has a previous step. Throws UnsupportedOperationException if this animation does not support steps to previous states.

Returns:
true if this animation has a previous step.
Throws:
UnsupportedOperationException - if this animation does not support steps to previous states.
See Also:
previousStep(), supportsPreviousStep()

nextStep

void nextStep()
Computes the next state of the underlying algorithm; i.e. moves the animation one step forward.

Throws:
IllegalStateException - if this animation does not have a next step.
IllegalStateException - if this animation is not ready.
See Also:
hasNextStep(), isReady()

supportsPreviousStep

boolean supportsPreviousStep()
Returns true if this animation supports steps to previous states of the underlying algorithm.

Returns:
true if this animation supports steps to previous states of the underlying algorithm.

previousStep

void previousStep()
Computes the previous state of the underlying algorithm; i.e. moves this animation one step backwards.

Throws:
IllegalStateException - if this animation does not have a previous step or does not support steps to previous states at all.
IllegalStateException - if this animation is not ready.
UnsupportedOperationException - if this animation does not support steps to previous states.
See Also:
supportsPreviousStep(), hasPreviousStep(), isReady()

getName

String getName()
Returns the name of this animation.

Returns:
the name of this animation.

getGraphModificationPolicy

Animation.GraphModificationPolicy getGraphModificationPolicy()
Returns the graph modification policy of this animation.

Returns:
the graph modification policy of this animation.
See Also:
Animation.GraphModificationPolicy


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