LiveGraph
data visualisation and analysis framework

org.LiveGraph.dataCache
Class DataSeries

java.lang.Object
  extended by org.LiveGraph.dataCache.DataSeries

public class DataSeries
extends java.lang.Object

Repsesents a data series inside the cache; stores all series specific information and provides convenience methods for accessing that information. A data series usually cossesponds to a data column inside a data file.

LiveGraph (http://www.live-graph.org).

Copyright (c) 2007 by G. Paperin.

File: DataSeries.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
private  class DataSeries.DataValuesIterator
          A read-only iterator over the data values of a series.
 
Field Summary
private  DataCache adminCache
          The cache in which the data of this series is stored.
private  java.lang.String label
          Serien name/label.
private  double maxValue
          Max data value in this series.
private  double minValue
          Min data value in this series.
private  int seriesIndexInCache
          The (0 based) index of this series' data in the cache.
 
Constructor Summary
DataSeries(java.lang.String label, DataCache adminCache, int seriesIndexInCache)
          The constructor.
 
Method Summary
 int countDataSets()
           
 double findDataValue(int dataFileIndex)
           
 DataCache getAdministratingCache()
           
 int getDatasetFileIndex(int cacheIndex)
           
 double getDataValue(int cacheIndex)
           
 java.lang.String getLabel()
           
 double getMaxValue()
           
 double getMinValue()
           
 int getSeriesIndexInCache()
           
(package private)  void includeExtremeValue(double val)
           
 com.softnetConsult.utils.collections.ReadOnlyIterator<java.lang.Double> iterateDataValues()
           
(package private)  void resetExtremeValues()
          Resets the min and max value caches for this series.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

label

private java.lang.String label
Serien name/label.


adminCache

private DataCache adminCache
The cache in which the data of this series is stored.


seriesIndexInCache

private int seriesIndexInCache
The (0 based) index of this series' data in the cache.


minValue

private double minValue
Min data value in this series.


maxValue

private double maxValue
Max data value in this series.

Constructor Detail

DataSeries

DataSeries(java.lang.String label,
           DataCache adminCache,
           int seriesIndexInCache)
The constructor.

Parameters:
label - Series label.
adminCache - The cache adminestering the data.
seriesIndexInCache - The index of this series in the cache.
Method Detail

getLabel

public java.lang.String getLabel()
Returns:
This series' name / label.

getAdministratingCache

public DataCache getAdministratingCache()
Returns:
The cache holding the data of this series.

getSeriesIndexInCache

public int getSeriesIndexInCache()
Returns:
The series' data index in the cache.

countDataSets

public int countDataSets()
Returns:
Number of datasets the cache currently holds for this series.

iterateDataValues

public com.softnetConsult.utils.collections.ReadOnlyIterator<java.lang.Double> iterateDataValues()
Returns:
A read-only iterator over the data values of this series currently held in cache.

getDataValue

public double getDataValue(int cacheIndex)
Parameters:
cacheIndex - A cache index of a dataset.
Returns:
This series' dataset the held at the specified index in the cache.

getDatasetFileIndex

public int getDatasetFileIndex(int cacheIndex)
Parameters:
cacheIndex - A cache index of a dataset.
Returns:
The index in the original file of the dataset at the specified cache index.

findDataValue

public double findDataValue(int dataFileIndex)
Parameters:
dataFileIndex - An data row index of the original data file.
Returns:
The data value of this series' dataset which was located at the specified index in the original data file; if that dataset is not in the cache, this method returns DataSet.returnValueForIllegalIndex.doubleValue().

includeExtremeValue

void includeExtremeValue(double val)
Parameters:
val - Makes sure that min and max value caches of this series include the specified value.

getMinValue

public double getMinValue()
Returns:
The smallest data value of this series or Double.NaN if this series is empty.

getMaxValue

public double getMaxValue()
Returns:
The largest data value of this series or Double.NaN if this series is empty.

resetExtremeValues

void resetExtremeValues()
Resets the min and max value caches for this series.


LiveGraph
data visualisation and analysis framework