net.clackrouter.chart
Class ClackOccData

java.lang.Object
  extended by AbstractSeriesDataset
      extended by net.clackrouter.chart.ClackOccData
All Implemented Interfaces:
java.io.Serializable

public class ClackOccData
extends AbstractSeriesDataset
implements java.io.Serializable

Represents a collection of (x,y) values that contain instanteneuous and average queue size. This collection should be constantly updated by a box and it is used by a chart to read the (x,y) values and display them. When a new (x,y) value is added to the dataset, it fires an event that informs a chart to update itself.


Field Summary
static java.awt.Color[] colors
           
static int MIN_DRAW_INTERVAL
           
 
Constructor Summary
ClackOccData()
          Constructs queue size dataset.
 
Method Summary
 void addXYValue(java.lang.String key, java.lang.Number x, java.lang.Number y)
          Adds the supplied (x,y) tuple to the instantaneous series, calculates the running average and adds (x, average) tuple to the average series.
 DomainOrder getDomainOrder()
           
 int getItemCount(int series)
          Returns the number of items in the specified series.
 int getSeriesCount()
          Returns the number of series in the data source.
 java.lang.String getSeriesKey(int series)
          Returns the name of the series.
 java.lang.Number getX(int series_int, int item)
          Returns the x value for the specified series and item.
 double getXValue(int series, int item)
           
 java.lang.Number getY(int series_int, int item)
          Returns the y value for the specified series and item.
 double getYValue(int series, int item)
           
 void remove_all_with_x_lessthan(java.lang.String key, double x_thresh)
          Useful for timing out values older than a certain x value
 void removeEverySeries()
           
 void removeSeries(java.lang.String key)
           
 void setRenderer(StandardXYItemRenderer r)
           
 void updateRealtime(boolean updateRealtime)
          Specifies if the dataset should notify listeners of changes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

colors

public static java.awt.Color[] colors

MIN_DRAW_INTERVAL

public static int MIN_DRAW_INTERVAL
Constructor Detail

ClackOccData

public ClackOccData()
Constructs queue size dataset.

Method Detail

removeSeries

public void removeSeries(java.lang.String key)

setRenderer

public void setRenderer(StandardXYItemRenderer r)

getDomainOrder

public DomainOrder getDomainOrder()

addXYValue

public void addXYValue(java.lang.String key,
                       java.lang.Number x,
                       java.lang.Number y)
Adds the supplied (x,y) tuple to the instantaneous series, calculates the running average and adds (x, average) tuple to the average series.

Parameters:
x - Domain value, can be absolute or relative time
y - Number of packets in the queue

remove_all_with_x_lessthan

public void remove_all_with_x_lessthan(java.lang.String key,
                                       double x_thresh)
Useful for timing out values older than a certain x value

Parameters:
key -
x_thresh -

getX

public java.lang.Number getX(int series_int,
                             int item)
Returns the x value for the specified series and item. Series are numbered 0, 1, ...

Parameters:
series - The index (zero-based) of the series
item - The index (zero-based) of the required item
Returns:
The x value for the specified series and item

getXValue

public double getXValue(int series,
                        int item)

getY

public java.lang.Number getY(int series_int,
                             int item)
Returns the y value for the specified series and item. Series are numbered 0, 1, ...

Parameters:
series - The index (zero-based) of the series
item - The index (zero-based) of the required item
Returns:
The y value for the specified series and item

getYValue

public double getYValue(int series,
                        int item)

getSeriesCount

public int getSeriesCount()
Returns the number of series in the data source.

Returns:
The number of series in the data source.

getSeriesKey

public java.lang.String getSeriesKey(int series)
Returns the name of the series.

Parameters:
series - The index (zero-based) of the series
Returns:
The name of the series

getItemCount

public int getItemCount(int series)
Returns the number of items in the specified series.

Parameters:
series - The index (zero-based) of the series
Returns:
The number of items in the specified series

updateRealtime

public void updateRealtime(boolean updateRealtime)
Specifies if the dataset should notify listeners of changes. This method should be called with updateRealtime = true when the corresponding chart is displayed to the user. Otherwise updateRealtime should be reset to false to reduce processing.

Parameters:
updateRealtime - True if changes should be immediately reflected in the dataset

removeEverySeries

public void removeEverySeries()