com.panayotis.gnuplot.dataset
Class GenericDataSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<java.util.ArrayList<java.lang.String>>
              extended by com.panayotis.gnuplot.dataset.GenericDataSet
All Implemented Interfaces:
DataSet, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.util.ArrayList<java.lang.String>>, java.util.Collection<java.util.ArrayList<java.lang.String>>, java.util.List<java.util.ArrayList<java.lang.String>>, java.util.RandomAccess
Direct Known Subclasses:
FileDataSet

public class GenericDataSet
extends java.util.ArrayList<java.util.ArrayList<java.lang.String>>
implements DataSet

Generic data class to store data. This class stores data as a list of Strings, not numbers. Still, the user can check if the data are valid, by using a specific DataParser for this object.

In this dataset one can use any type of data, while in PointDataSet the data are stricted to numerical data only. Thus, data such as dates can be used.

See Also:
DataParser, PointDataSet, Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
GenericDataSet()
          Create a new instance of GenericDataSet, with the default DataParser (DoubleDataParser)
GenericDataSet(boolean first_column_date)
          Create a new instance of GenericDataSet, with the default DataParser (DoubleDataParser), and the information that the first column is in date format.
GenericDataSet(DataParser parser)
          Create a new instance of GenericDataSet, with a given DataParser
 
Method Summary
 boolean add(java.util.ArrayList<java.lang.String> point)
          Add a new point to this DataSet
 void add(int index, java.util.ArrayList<java.lang.String> point)
          Add a new point to this DataSet at a specified position
 boolean addAll(java.util.Collection<? extends java.util.ArrayList<java.lang.String>> pts)
          Add a collection of points to this DataSet
 boolean addAll(int index, java.util.Collection<? extends java.util.ArrayList<java.lang.String>> pts)
          Add a collection of points to this DataSet starting at a specified position if there are data at the specified position, these will be shifted
 int getDimensions()
          Retrieve how many dimensions this dataset refers to.
 java.lang.String getPointValue(int point, int dimension)
          Retrieve data information from a point.
 java.util.ArrayList<java.lang.String> set(int index, java.util.ArrayList<java.lang.String> point)
          Replace the Point at the specified position with the provided one
 
Methods inherited from class java.util.ArrayList
clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.panayotis.gnuplot.dataset.DataSet
size
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

GenericDataSet

public GenericDataSet()
Create a new instance of GenericDataSet, with the default DataParser (DoubleDataParser)

See Also:
DoubleDataParser

GenericDataSet

public GenericDataSet(boolean first_column_date)
Create a new instance of GenericDataSet, with the default DataParser (DoubleDataParser), and the information that the first column is in date format.

Parameters:
first_column_date - Whether the first column is in date format

GenericDataSet

public GenericDataSet(DataParser parser)
Create a new instance of GenericDataSet, with a given DataParser

Parameters:
parser - The DataParser to use
Method Detail

getDimensions

public int getDimensions()
Retrieve how many dimensions this dataset refers to.

Specified by:
getDimensions in interface DataSet
Returns:
the number of dimensions
See Also:
DataSet.getDimensions()

getPointValue

public java.lang.String getPointValue(int point,
                                      int dimension)
Retrieve data information from a point.

Specified by:
getPointValue in interface DataSet
Parameters:
point - The point number
dimension - The point dimension (or "column") to request data from
Returns:
the point data for this dimension
See Also:
DataSet.getPointValue(int,int)

add

public boolean add(java.util.ArrayList<java.lang.String> point)
            throws java.lang.NumberFormatException
Add a new point to this DataSet

Specified by:
add in interface java.util.Collection<java.util.ArrayList<java.lang.String>>
Specified by:
add in interface java.util.List<java.util.ArrayList<java.lang.String>>
Overrides:
add in class java.util.ArrayList<java.util.ArrayList<java.lang.String>>
Parameters:
point - The point to add to this DataSet
Returns:
Whether the collection changed with this call
Throws:
java.lang.NumberFormatException - If the given collection is not in the correct format

add

public void add(int index,
                java.util.ArrayList<java.lang.String> point)
         throws java.lang.NumberFormatException
Add a new point to this DataSet at a specified position

Specified by:
add in interface java.util.List<java.util.ArrayList<java.lang.String>>
Overrides:
add in class java.util.ArrayList<java.util.ArrayList<java.lang.String>>
Parameters:
index - Where to add this point
point - The point to add to this DataSet
Throws:
java.lang.NumberFormatException - If the given collection is not in the correct format

addAll

public boolean addAll(java.util.Collection<? extends java.util.ArrayList<java.lang.String>> pts)
               throws java.lang.NumberFormatException
Add a collection of points to this DataSet

Specified by:
addAll in interface java.util.Collection<java.util.ArrayList<java.lang.String>>
Specified by:
addAll in interface java.util.List<java.util.ArrayList<java.lang.String>>
Overrides:
addAll in class java.util.ArrayList<java.util.ArrayList<java.lang.String>>
Parameters:
pts - The points colelction
Returns:
Whether the collection changed with this call
Throws:
java.lang.NumberFormatException - If the given collection is not in the correct format

addAll

public boolean addAll(int index,
                      java.util.Collection<? extends java.util.ArrayList<java.lang.String>> pts)
               throws java.lang.NumberFormatException
Add a collection of points to this DataSet starting at a specified position if there are data at the specified position, these will be shifted

Specified by:
addAll in interface java.util.List<java.util.ArrayList<java.lang.String>>
Overrides:
addAll in class java.util.ArrayList<java.util.ArrayList<java.lang.String>>
Parameters:
index - Where to start adding point data.
pts - The point collection to add
Returns:
Whether the collection changed with this call
Throws:
java.lang.NumberFormatException - If the given collection is not in the correct format

set

public java.util.ArrayList<java.lang.String> set(int index,
                                                 java.util.ArrayList<java.lang.String> point)
                                          throws java.lang.NumberFormatException,
                                                 java.lang.ArrayIndexOutOfBoundsException
Replace the Point at the specified position with the provided one

Specified by:
set in interface java.util.List<java.util.ArrayList<java.lang.String>>
Overrides:
set in class java.util.ArrayList<java.util.ArrayList<java.lang.String>>
Parameters:
index - The position of the point to be altered
point - The point to use
Returns:
The Point previously found in the specified position
Throws:
java.lang.NumberFormatException - If the given collection is not in the correct format
java.lang.ArrayIndexOutOfBoundsException