X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=src%2Ftim%2Fprune%2Ffunction%2Fcharts%2FChartSeries.java;fp=src%2Ftim%2Fprune%2Ffunction%2Fcharts%2FChartSeries.java;h=ea6128f209722bc47494abc616df4f02a02d6f1f;hp=0000000000000000000000000000000000000000;hb=ce6f2161b8596f7018d6a76bff79bc9e571f35fd;hpb=2d8cb72e84d5cc1089ce77baf1e34ea3ea2f8465 diff --git a/src/tim/prune/function/charts/ChartSeries.java b/src/tim/prune/function/charts/ChartSeries.java new file mode 100644 index 0000000..ea6128f --- /dev/null +++ b/src/tim/prune/function/charts/ChartSeries.java @@ -0,0 +1,51 @@ +package tim.prune.function.charts; + +/** + * Class to hold a data series for the charts + */ +public class ChartSeries +{ + /** Array of booleans, true for data existing, false otherwise */ + private boolean[] _hasData = null; + /** Array of data */ + private double[] _data = null; + + /** + * Constructor + * @param inNumPoints number of points + */ + public ChartSeries(int inNumPoints) + { + _hasData = new boolean[inNumPoints]; + _data = new double[inNumPoints]; + } + + /** + * @param inIndex index of point + * @return true if series has data for this point + */ + public boolean hasData(int inIndex) + { + return _hasData[inIndex]; + } + + /** + * @param inIndex index of point + * @return data value for this point + */ + public double getData(int inIndex) + { + return _data[inIndex]; + } + + /** + * Set the data at the given index + * @param inIndex index of point + * @param inData data value + */ + public void setData(int inIndex, double inData) + { + _hasData[inIndex] = true; + _data[inIndex] = inData; + } +}