Package org.graffiti.plugin.algorithm.animation

Contains Gravisto's animation framework; i.e.


Interface Summary
Animation An animated version of an algorithm.
Animation.GraphModificationPolicy Specifies the behaviour of an animation on the event of its underlying graph being modified.
Step One step of an animation.

Class Summary
AbstractAnimation Partial implementation of a forward animation (i.e.
BidirectionalAnimation An animation that supports both steps forward and steps to previous states.
ForwardAnimation An animation that supports only forward steps.

Package org.graffiti.plugin.algorithm.animation Description

Contains Gravisto's animation framework; i.e. interfaces and basic implementations of algorithm animations. An animation is a stepwise execution of a given agorithm a on a given graph g that visualizes these steps appropriately. We call a the underlying algorithm and g the underlying graph of the animation.

We distinguish two basic types of Animations:

  1. Forward animations: i.e. animations that execute a given algorithm step by step but only in forward direction.
  2. Bidirectional animations: i.e. animations that execute a given algorithm step by step and allow stepping back to previous states of the algorithm.
This package provides implementations of both iteration logics. They're called ForwardAnimation and BidirectionalAnimation respectively. Both implemetations use instances of interface Step to implement the behaviour specified by interface Animation .

The recommended way of implementing a forward animation for a given algorithm is to extend AbstractAnimation and implement hasNextStep and nextStep using FowardAnimation as a delegate. A bidirectional animation will subclass AbstractAnimation and implement hasNextStep, nextStep, hasPreviousStep and previousStep using BidirectionalAnimation as a delegate.

In either case you'll have to provide an instance of interface Step to use ForwardAnimation or BidirectionalAnimation. This instance will implement one step of the animation. For a given algorithm of the form

// initialize datastructures etc.
while (loopCondition) {
// output result etc.
a typical instance of Step will look as follows: hasNext will have something to do with the algorithm's loop condition, whereas next will perform one iteration of the loop body (perhaps performing some output or visualization as well).

These guidelines should apply to every instance implementing Step. They will differ however in their implementations of undo and redo. A step used by a forward animation does not have to implement neither undo nor redo. Calls to the animation's previousStep method should never occur, so there is no need to satisfy such requests. However steps used by bidirectional animations must implement their undo and redo methods, as BidirectionalAnimation relies on those implementations to process calls to previousStep and nextStep.

While an animation is being performed modifications to the underlying graph may occur. A graph modification policy specifies the animation's behaviour in case of nodes or edges being added or removed or the underlying graph being cleared. Instances of Animation.GraphModificationPolicy implement the graph modification policy of a given animation.

The default policy implemented by AbstractAnimation is to clear the animation on every modification of the underlying graph. There are however other possibilities. An online algorithm could allow additions and removals of nodes and edges by reacting appropriately to such changes.

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