Class Visualization

java.lang.Object
  |
  +--Visualization

public class Visualization
extends Object

This class is used to control and show a visualizations by an AnimationPanel. If a visualizatoin is specified when an AnimationPanel is running the normal step method should be altered. The step method should use Visualization to control the data. The current step should not be incremented until the visualization and the visual steps are finished. Here is an example.


Field Summary
protected  boolean circles
          boolean specifying whether the circle visualization is being used
protected  boolean dottedLines
          boolean specifying whether the dotted lines visualization is being used
 
Constructor Summary
Visualization()
          Constructor that creates a new Visualization
 
Method Summary
 void drawCircle(Graphics page, Color c, Rectangle rect, Point p, double finalsize)
          Draws a circle at a certain Point adjusting the size according to the visual step.
 void drawDottedLine(Graphics page, Color c, Rectangle rect, Point start, Point end)
          Draws a dotted line between the two specified points.
 boolean finalVisual()
          Method that returns true if it is time for final visual for the visual steps.
 boolean firstVstep()
          Method that returns true if it is the first visual step.
 int getFinalPause()
          Gets the final pause for visualization.
 int getTotalVsteps()
          gets the total number of visual steps
 int getVstep()
          Gets the visual step.
 boolean InitFinalVisual()
          Method that returns true if it is time to init the final visual.
 void InitVstep()
          Method that initializes each visual step.
 void PickVisualization(String v)
          Picks the specified visualization
 void resetVsteps()
          resets visual steps to the first step
 void setFinalPause(int thepause)
          Sets the final pause for visualization.
 void setTotalVsteps(int steps)
          Sets the total number of visual steps.
 boolean VstepsDone()
          Method that returns true when the visualization is done.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

circles

protected boolean circles
boolean specifying whether the circle visualization is being used

dottedLines

protected boolean dottedLines
boolean specifying whether the dotted lines visualization is being used
Constructor Detail

Visualization

public Visualization()
Constructor that creates a new Visualization
Method Detail

PickVisualization

public void PickVisualization(String v)
Picks the specified visualization
Parameters:
v - A string specifying the visualization to be used. Acceptable values are "None", "Circles", and "Dotted Lines". If v is not an acceptable value the visualization is not changed.

getVstep

public int getVstep()
Gets the visual step.
Returns:
an int representing the visual step
See Also:
firstVstep(), resetVsteps(), InitVstep()

firstVstep

public boolean firstVstep()
Method that returns true if it is the first visual step.
Returns:
a boolean
See Also:
getVstep(), resetVsteps(), InitVstep()

resetVsteps

public void resetVsteps()
resets visual steps to the first step
See Also:
getVstep(), firstVstep(), InitVstep(), VstepsDone()

getTotalVsteps

public int getTotalVsteps()
gets the total number of visual steps
Returns:
an int
See Also:
setTotalVsteps(int)

setTotalVsteps

public void setTotalVsteps(int steps)
Sets the total number of visual steps. Default value is 25.
See Also:
getTotalVsteps()

getFinalPause

public int getFinalPause()
Gets the final pause for visualization. This final pause will pause for the final visual.
Returns:
an int representing visual steps
See Also:
setFinalPause(int), finalVisual(), InitFinalVisual()

setFinalPause

public void setFinalPause(int thepause)
Sets the final pause for visualization. This final pause will pause for the final visual. The default value is 5 visual steps.
See Also:
getFinalPause(), finalVisual(), InitFinalVisual()

finalVisual

public boolean finalVisual()
Method that returns true if it is time for final visual for the visual steps. The final visual is the visual shown during the pause at the end of the visual steps.
Returns:
a boolean
See Also:
InitFinalVisual(), getFinalPause(), setFinalPause(int)

InitFinalVisual

public boolean InitFinalVisual()
Method that returns true if it is time to init the final visual. The user should update any data needed for the final visual. The final visual is the visual shown during the pause at the end of the visual steps.
Returns:
a boolean
See Also:
InitFinalVisual(), getFinalPause(), setFinalPause(int)

InitVstep

public void InitVstep()
Method that initializes each visual step. Should be called at the beginning of every visual step.
See Also:
getVstep(), firstVstep(), resetVsteps()

VstepsDone

public boolean VstepsDone()
Method that returns true when the visualization is done. The current step in the AnimationPanel should be incremented if this is true
See Also:
firstVstep()

drawCircle

public void drawCircle(Graphics page,
                       Color c,
                       Rectangle rect,
                       Point p,
                       double finalsize)
Draws a circle at a certain Point adjusting the size according to the visual step.
Parameters:
page - used to paint on the component
c - color of the circle
rect - a Rectangle that specifies the area that the component spans
p - point that circle is drawn at
finalsize - the final diameter of the circle. The diameter should be scaled to the size of the AnimationPanel.
See Also:
drawDottedLine(java.awt.Graphics, java.awt.Color, java.awt.Rectangle, Point, Point)

drawDottedLine

public void drawDottedLine(Graphics page,
                           Color c,
                           Rectangle rect,
                           Point start,
                           Point end)
Draws a dotted line between the two specified points.
Parameters:
page - used to paint on the component
c - color of the circle
rect - a Rectangle that specifies the area that the component spans
start - point that the dotted line starts at
end - point that the dotted line starts at
See Also:
drawCircle(java.awt.Graphics, java.awt.Color, java.awt.Rectangle, Point, double)


Visualization of Graph Algorithms

Author: Paul Simbi
Started by: Kevin Wayne
2002