|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Object | +--TimeGraph
Implements a circular buffer, intended to be used where there is a constant stream of data (such as observations over time).
| Field Summary | |
protected double |
max
The largest data value seen so far. |
protected int |
maxIndex
The index of the largest data value seen so far. |
protected double[] |
observations
The buffer of observations |
protected int |
pos
The current position in the buffer. |
protected int |
skip
The number of observations to ignore before an observation is used. |
protected int |
skipRatio
The number of observations that will be ignored for every one used. |
| Constructor Summary | |
TimeGraph(int obsCount)
Creates a new TimeGraph |
|
| Method Summary | |
void |
addObservation(double value)
Adds a value to the list of observations. |
double |
getCurrentPos(double x0,
double step)
Returns the current "time". |
double[] |
getObservations()
Returns all observations. |
int |
getSkipRatio()
Returns the number of observations that will be ignored for every one used. |
double |
indexToX(int index,
double min,
double max)
Converts an array index to an x coordinate, given the size of the interval into which all coordinates should fall. |
void |
reset()
Clears all observations, and returns the position marker to the start of the buffer. |
void |
setSkipRatio(int i)
Sets the number of observations that will be ignored for every one used. |
void |
solve(double x0,
double step,
double[] vals)
The x0 and step parameters are ignored;
this method will always return the array of observations. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
protected int maxIndex
protected double max
protected int skipRatio
protected int pos
protected int skip
skipRatio when a value is used.protected double[] observations
| Constructor Detail |
public TimeGraph(int obsCount)
obsCount - The size of the "history" of
observations| Method Detail |
public void addObservation(double value)
public void solve(double x0,
double step,
double[] vals)
x0 and step parameters are ignored;
this method will always return the array of observations.
public double getCurrentPos(double x0,
double step)
x0 - The "time" of the first observationstep - The "time" between observationsx0 + step*pospublic void reset()
public double indexToX(int index,
double min,
double max)
index - The array indexmin - The minimum bound of the intervalmax - The maximum bound of the intervalpublic double[] getObservations()
public int getSkipRatio()
public void setSkipRatio(int i)
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||