org.generation5.util
Class AutoTimeSeries

java.lang.Object
  extended byorg.generation5.util.TimeSeries
      extended byorg.generation5.util.AutoTimeSeries
All Implemented Interfaces:
Visualizable

public class AutoTimeSeries
extends TimeSeries
implements Visualizable

This class extends TimeSeries by automatically creating a time-series across an interval period, or given at step numbers. For example, if you want to create a time-series image of a CA world every 100 iterations, or perhaps at steps 1, 10, 100, 1000 and 10,000. Note that the steppable object and the visualizable object can be separate, allowing for more complex time-series images.


Field Summary
protected  boolean autoGenerate
          Determies whether the time-series is to be automatically generated when calls to render are called.
protected  Steppable steppable
          The steppable object.
protected  Visualizable visualizable
          The visualizable object.
 
Fields inherited from class org.generation5.util.TimeSeries
ANTIALIAS, backColor, BORDERS, columns, drawFlags, imgArray, INNER_BORDER, innerBorder, NONE, OUTER_BORDER, outerBorder, rows
 
Constructor Summary
AutoTimeSeries()
          Creates a new instance of TimeSeries
 
Method Summary
 void generateSnapshots(int width, int height)
          This method generates the time-series snapshots.
static void main(java.lang.String[] args)
           
 void render(java.awt.Graphics g, int width, int height)
          Render the time-series on a graphics context.
 void reset()
          Reset the time-series options.
 void setAutoGenerate(boolean autoGen)
          Set whether the time-series is auto-generated or not.
 void setSnapshotAt(int iteration)
          Set a snapshot at a particular timestep.
 void setSnapshotInterval(int interval)
          Set an interval at which to take a snapshot.
 void setSteppable(Steppable steppable)
          Set the steppable object.
 void setVisualizable(Visualizable visualizable)
          Set the visualizable object.
 void writeImage(java.lang.String s, int width, int height)
          Write the series to an image.
 
Methods inherited from class org.generation5.util.TimeSeries
addSnapshot, addSnapshot, getSnapshots, setBackgroundColor, setBorderColor, setBorderColors, setDimensions, setFormat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

autoGenerate

protected boolean autoGenerate
Determies whether the time-series is to be automatically generated when calls to render are called. It is set as true by default.


steppable

protected Steppable steppable
The steppable object.


visualizable

protected Visualizable visualizable
The visualizable object.

Constructor Detail

AutoTimeSeries

public AutoTimeSeries()
Creates a new instance of TimeSeries

Method Detail

setVisualizable

public void setVisualizable(Visualizable visualizable)
Set the visualizable object.

Parameters:
visualizable - the visualizable object.

setSteppable

public void setSteppable(Steppable steppable)
Set the steppable object.

Parameters:
steppable - the steppable object.

setSnapshotAt

public void setSnapshotAt(int iteration)
Set a snapshot at a particular timestep. Note that calls to setSnapshotAt should be in ascending order; anything else will cause undefined behaviour. This method cannot be used in conjunction with setSnapshotInterval.

Parameters:
iteration - the step number to take a snapshot at.

setSnapshotInterval

public void setSnapshotInterval(int interval)
Set an interval at which to take a snapshot. This method cannot be used in conjunction with setSnapshotAt.

Parameters:
interval - the snapshot interval.

setAutoGenerate

public void setAutoGenerate(boolean autoGen)
Set whether the time-series is auto-generated or not.

Parameters:
autoGen - set whether the time-series is auto-generated or not.

reset

public void reset()
Reset the time-series options. This resets all traits apart from the visualizable/steppable objects.


generateSnapshots

public void generateSnapshots(int width,
                              int height)
This method generates the time-series snapshots. By default, the class automatically generates the necessary snapshots when render is called. Under some circumstances, you want to generate the snapshots separately to a call to render or writeImage.

Parameters:
width - the overall width.
height - the overall height.
See Also:
setAutoGenerate(boolean)

render

public void render(java.awt.Graphics g,
                   int width,
                   int height)
Render the time-series on a graphics context.

Specified by:
render in interface Visualizable
Overrides:
render in class TimeSeries
Parameters:
g - the graphics context.
width - the width of the context.
height - the height of the context.

writeImage

public void writeImage(java.lang.String s,
                       int width,
                       int height)
Write the series to an image.

Specified by:
writeImage in interface Visualizable
Overrides:
writeImage in class TimeSeries
Parameters:
s - the image filename.
width - the width of the image.
height - the height of the image.

main

public static void main(java.lang.String[] args)
Parameters:
args - the command line arguments

This documentation is part of the Generation5 JDK.