]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - src/tim/prune/function/charts/ChartSeries.java
Moved source into separate src directory due to popular request
[GpsPrune.git] / src / tim / prune / function / charts / ChartSeries.java
diff --git a/src/tim/prune/function/charts/ChartSeries.java b/src/tim/prune/function/charts/ChartSeries.java
new file mode 100644 (file)
index 0000000..ea6128f
--- /dev/null
@@ -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;
+       }
+}