JSci.awt
Class DefaultCategoryGraph2DModel

java.lang.Object
  extended by JSci.awt.AbstractGraphModel
      extended by JSci.awt.DefaultCategoryGraph2DModel
All Implemented Interfaces:
java.util.EventListener, javax.swing.event.TableModelListener, CategoryGraph2DModel

public final class DefaultCategoryGraph2DModel
extends AbstractGraphModel
implements CategoryGraph2DModel, javax.swing.event.TableModelListener

The DefaultCategoryGraph2DModel class provides a default implementation of the CategoryGraph2DModel interface.


Nested Class Summary
static class DefaultCategoryGraph2DModel.DataSeries
          The DataSeries class encapsulates a data series for a graph.
 
Constructor Summary
DefaultCategoryGraph2DModel()
           
 
Method Summary
 void addSeries(DefaultCategoryGraph2DModel.DataSeries newSeries)
          Adds a data series.
 void addSeries(double[] newSeries)
          Adds a data series using the default values for the x-axis.
 void addSeries(float[] newSeries)
          Adds a data series using the default values for the x-axis.
 void addSeries(java.lang.Object[] newXAxis, double[] newSeries)
          Adds a data series.
 void addSeries(java.lang.Object[] newXAxis, float[] newSeries)
          Adds a data series.
 void changeSeries(int i, DefaultCategoryGraph2DModel.DataSeries newSeries)
          Changes a data series.
 void changeSeries(int i, double[] newSeries)
          Changes a data series.
 void changeSeries(int i, float[] newSeries)
          Changes a data series.
 void firstSeries()
          Selects the first data series.
 java.lang.String getCategory(int i)
          Returns the ith category.
 DefaultCategoryGraph2DModel.DataSeries getSeries(int i)
           
 float getValue(int i)
          Returns the value for the ith category.
 boolean nextSeries()
          Selects the next data series.
 void removeSeries(int i)
          Remove a data series.
 int seriesLength()
          Returns the number of data points in the current series.
 void setCategories(java.lang.Object[] cat)
          Sets the default x-axis values.
 void setSeriesVisible(int i, boolean flag)
          Convenience method.
 void tableChanged(javax.swing.event.TableModelEvent evt)
          Implementation of TabelModelListener.
 
Methods inherited from class JSci.awt.AbstractGraphModel
addGraphDataListener, fireGraphChanged, fireGraphDataChanged, fireGraphSeriesUpdated, removeGraphDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface JSci.awt.CategoryGraph2DModel
addGraphDataListener, removeGraphDataListener
 

Constructor Detail

DefaultCategoryGraph2DModel

public DefaultCategoryGraph2DModel()
Method Detail

setCategories

public void setCategories(java.lang.Object[] cat)
Sets the default x-axis values. A copy of the values is made. This method does not change the x-axis values of any data series and so does not fire any events.


addSeries

public void addSeries(float[] newSeries)
Adds a data series using the default values for the x-axis. Be sure to call setCategories first.


addSeries

public void addSeries(double[] newSeries)
Adds a data series using the default values for the x-axis. Be sure to call setCategories first.


addSeries

public void addSeries(DefaultCategoryGraph2DModel.DataSeries newSeries)
Adds a data series.


addSeries

public void addSeries(java.lang.Object[] newXAxis,
                      float[] newSeries)
Adds a data series. Convenience method.


addSeries

public void addSeries(java.lang.Object[] newXAxis,
                      double[] newSeries)
Adds a data series. Convenience method.


changeSeries

public void changeSeries(int i,
                         DefaultCategoryGraph2DModel.DataSeries newSeries)
Changes a data series.


changeSeries

public void changeSeries(int i,
                         float[] newSeries)
Changes a data series. Convenience method.


changeSeries

public void changeSeries(int i,
                         double[] newSeries)
Changes a data series. Convenience method.


removeSeries

public void removeSeries(int i)
Remove a data series.


getSeries

public DefaultCategoryGraph2DModel.DataSeries getSeries(int i)

setSeriesVisible

public void setSeriesVisible(int i,
                             boolean flag)
Convenience method.


tableChanged

public void tableChanged(javax.swing.event.TableModelEvent evt)
Implementation of TabelModelListener. Application code will not use this method explicitly, it is used internally.

Specified by:
tableChanged in interface javax.swing.event.TableModelListener

getCategory

public java.lang.String getCategory(int i)
Description copied from interface: CategoryGraph2DModel
Returns the ith category.

Specified by:
getCategory in interface CategoryGraph2DModel

getValue

public float getValue(int i)
Description copied from interface: CategoryGraph2DModel
Returns the value for the ith category.

Specified by:
getValue in interface CategoryGraph2DModel

seriesLength

public int seriesLength()
Description copied from interface: CategoryGraph2DModel
Returns the number of data points in the current series.

Specified by:
seriesLength in interface CategoryGraph2DModel

firstSeries

public void firstSeries()
Description copied from interface: CategoryGraph2DModel
Selects the first data series.

Specified by:
firstSeries in interface CategoryGraph2DModel

nextSeries

public boolean nextSeries()
Description copied from interface: CategoryGraph2DModel
Selects the next data series. Returns false if there is no next series.

Specified by:
nextSeries in interface CategoryGraph2DModel