]> gitweb.fperrin.net Git - GpsPrune.git/blob - tim/prune/function/charts/ChartSeries.java
ea6128f209722bc47494abc616df4f02a02d6f1f
[GpsPrune.git] / tim / prune / function / charts / ChartSeries.java
1 package tim.prune.function.charts;
2
3 /**
4  * Class to hold a data series for the charts
5  */
6 public class ChartSeries
7 {
8         /** Array of booleans, true for data existing, false otherwise */
9         private boolean[] _hasData = null;
10         /** Array of data */
11         private double[] _data = null;
12
13         /**
14          * Constructor
15          * @param inNumPoints number of points
16          */
17         public ChartSeries(int inNumPoints)
18         {
19                 _hasData = new boolean[inNumPoints];
20                 _data = new double[inNumPoints];
21         }
22
23         /**
24          * @param inIndex index of point
25          * @return true if series has data for this point
26          */
27         public boolean hasData(int inIndex)
28         {
29                 return _hasData[inIndex];
30         }
31
32         /**
33          * @param inIndex index of point
34          * @return data value for this point
35          */
36         public double getData(int inIndex)
37         {
38                 return _data[inIndex];
39         }
40
41         /**
42          * Set the data at the given index
43          * @param inIndex index of point
44          * @param inData data value
45          */
46         public void setData(int inIndex, double inData)
47         {
48                 _hasData[inIndex] = true;
49                 _data[inIndex] = inData;
50         }
51 }