LiveGraph
data visualisation and analysis framework

org.LiveGraph.dataCache
Class DataSet

java.lang.Object
  extended by org.LiveGraph.dataCache.DataSet
All Implemented Interfaces:
java.lang.Comparable<java.lang.Integer>

public class DataSet
extends java.lang.Object
implements java.lang.Comparable<java.lang.Integer>

This class defines a dataset and encapsulates related data; a dataset holds one data value for each of the data series held in the cache and corresponds to a data row in the underlying data file.

This product includes software developed by the LiveGraph project and its contributors.
(http://www.live-graph.org)
Copyright (c) 2007 G. Paperin.
All rights reserved.

File: DataSet.java

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following terms and conditions are met:

1. Redistributions of source code must retain the above acknowledgement of the LiveGraph project and its web-site, the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above acknowledgement of the LiveGraph project and its web-site, the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software or any derived software must display the following acknowledgement:
This product includes software developed by the LiveGraph project and its contributors.
(http://www.live-graph.org)

4. All advertising materials distributed in form of HTML pages or any other technology permitting active hyper-links that mention features or use of this software or any derived software must display the acknowledgment specified in condition 3 of this agreement, and in addition, include a visible and working hyper-link to the LiveGraph homepage (http://www.live-graph.org).

THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version:
"1.1.1"
Author:
Greg Paperin (http://www.paperin.org)

Nested Class Summary
static class DataSet.DefRetValue
          Possible default return values; a default return value is used when a dataset is queried for a value at an invalid index or when the index was valid, but corresponding value in the underlying data file could not be interpreted as a legal data value.
 
Field Summary
private  int dataFileIndex
          The index of the data row represented by this dataset in the original file.
static DataSet.DefRetValue returnValueForIllegalIndex
          The currently used default rteturn value.
private  java.lang.Double[] values
          Values of this dataset.
 
Constructor Summary
DataSet(double[] values, int dataFileIndex)
          Constructor.
DataSet(java.lang.Double[] values, int dataFileIndex)
          Constructor.
DataSet(java.util.List<java.lang.Double> values, int dataFileIndex)
          Constructor.
 
Method Summary
 int compareTo(java.lang.Integer dataFileIndex)
          Compares this set with an integer on the basis on the set's dataFileIndex.
 int getDataFileIndex()
           
 double getValue(int seriesIndex)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

returnValueForIllegalIndex

public static DataSet.DefRetValue returnValueForIllegalIndex
The currently used default rteturn value. A default return value is used when a dataset is queried for a value at an invalid index or when the index was valid, but corresponding value in the underlying data file could not be interpreted as a legal data value.


values

private java.lang.Double[] values
Values of this dataset.


dataFileIndex

private int dataFileIndex
The index of the data row represented by this dataset in the original file. The file index applies to datasets only. For instance, the first data row in a file will have dataFileIndex = 0, although it will probably not be the very first row in the file because several comment and info rows as well as a column label might preceed it.

Constructor Detail

DataSet

public DataSet(java.util.List<java.lang.Double> values,
               int dataFileIndex)
Constructor.

Parameters:
values - Dava values for this set.
dataFileIndex - The dafa file index of this set.
See Also:
dataFileIndex

DataSet

public DataSet(double[] values,
               int dataFileIndex)
Constructor.

Parameters:
values - Dava values for this set.
dataFileIndex - The dafa file index of this set.
See Also:
dataFileIndex

DataSet

public DataSet(java.lang.Double[] values,
               int dataFileIndex)
Constructor.

Parameters:
values - Dava values for this set.
dataFileIndex - The dafa file index of this set.
See Also:
dataFileIndex
Method Detail

getDataFileIndex

public int getDataFileIndex()
Returns:
The index of the data row represented by this dataset in the original file. (The file index applies to datasets only. For instance, the first data row in a file will have dataFileIndex = 0, although it will probably not be the very first row in the file because several comment and info rows as well as a column label might preceed it.)

compareTo

public int compareTo(java.lang.Integer dataFileIndex)
Compares this set with an integer on the basis on the set's dataFileIndex.

Specified by:
compareTo in interface java.lang.Comparable<java.lang.Integer>
Parameters:
dataFileIndex - An integer representing a potential data file index.
Returns:
A value < 0 if this dataset preceeded the specified index in the data file; a value > 0 if this dataset followed the specified index in the data file; 0 if this dataset was located at specified index in the data file.
See Also:
dataFileIndex

getValue

public double getValue(int seriesIndex)
Parameters:
seriesIndex - A data series index (0 based data column number).
Returns:
The data values at the specified index.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
A string representation if this dataset.

LiveGraph
data visualisation and analysis framework