samples.preview_new_graphdraw.iterablelayouts
Class WrappedIterableLayout

java.lang.Object
  extended by samples.preview_new_graphdraw.iter.IterableLayout
      extended by samples.preview_new_graphdraw.iterablelayouts.WrappedIterableLayout
All Implemented Interfaces:
LayoutEmitter

public class WrappedIterableLayout
extends IterableLayout

This class runs one iterable layout until it is finished, then starts on another (for either K iterations or until finished). This allows people like Joshua to do "KKLayout until done, plus just a few iterations of SpringLayout to clean up."

Author:
danyelf

Field Summary
protected  int frames
           
protected  IterableLayout next
           
protected  IterableLayout start
           
protected  int thisFrame
           
 
Fields inherited from class samples.preview_new_graphdraw.iter.IterableLayout
currentLayout, returnableLayout
 
Constructor Summary
WrappedIterableLayout(IterableLayout start, IterableLayout next)
           
WrappedIterableLayout(IterableLayout start, IterableLayout next, int frames)
           
 
Method Summary
 void advance()
          Copies the current layout into the retunrable layout, then moves the visualization one step forward (by calling calculate).
protected  void calculate()
          Transforms currentLayout according to current layout algorithm.
 EmittedLayout emit()
          Creates some sort of layout that has all the same vertex and edge locations.
 void initializeLocationsFromLayout(EmittedLayout inputLayout)
          Starts up this layout based on a previous layout.
 boolean isFinite()
          Says whether this algorthms' iterations will ever end.
 boolean iterationsAreDone()
          Gives the outlining algorithm a sense of how long to run.
 
Methods inherited from class samples.preview_new_graphdraw.iter.IterableLayout
getScreenSize, getVisEdge, getVisVertex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

next

protected IterableLayout next

start

protected IterableLayout start

frames

protected final int frames

thisFrame

protected int thisFrame
Constructor Detail

WrappedIterableLayout

public WrappedIterableLayout(IterableLayout start,
                             IterableLayout next)

WrappedIterableLayout

public WrappedIterableLayout(IterableLayout start,
                             IterableLayout next,
                             int frames)
Method Detail

iterationsAreDone

public boolean iterationsAreDone()
Description copied from class: IterableLayout
Gives the outlining algorithm a sense of how long to run. The algorithm is responsible for setting its own thresholds. Note that this should return a meaningful value (probably "false") even before initialize has been called.

Specified by:
iterationsAreDone in class IterableLayout

isFinite

public boolean isFinite()
Description copied from class: IterableLayout
Says whether this algorthms' iterations will ever end. (If not, there's no real use to waiting.)

Specified by:
isFinite in class IterableLayout

advance

public void advance()
Description copied from class: IterableLayout
Copies the current layout into the retunrable layout, then moves the visualization one step forward (by calling calculate). This method should probably not be overridden in most cases.

Overrides:
advance in class IterableLayout

emit

public EmittedLayout emit()
Description copied from class: IterableLayout
Creates some sort of layout that has all the same vertex and edge locations. This copy can be visualized while the main thread moves forward. [It's not necessary that this use clone!]

Specified by:
emit in interface LayoutEmitter
Overrides:
emit in class IterableLayout

initializeLocationsFromLayout

public void initializeLocationsFromLayout(EmittedLayout inputLayout)
Description copied from class: IterableLayout
Starts up this layout based on a previous layout. It is reasonable to assume that this method will be called only once. After this method is complete, a CURRENT LAYOUT should be defined with the current states of the vertices, and a RETURNABLE LAYOUT should be defined for emit() to return. In general, emit() will just return this copy of the layout stored in returnableLayout, so this method and advance() are both respon sible for advancing correctly.

Overrides:
initializeLocationsFromLayout in class IterableLayout

calculate

protected void calculate()
Description copied from class: IterableLayout
Transforms currentLayout according to current layout algorithm. This may change the state of the currentLayout object.

Specified by:
calculate in class IterableLayout