de.unidu.is.gnuplot
Class ArrayDataSource

java.lang.Object
  extended byde.unidu.is.gnuplot.Source
      extended byde.unidu.is.gnuplot.FileSource
          extended byde.unidu.is.gnuplot.DataSource
              extended byde.unidu.is.gnuplot.ArrayDataSource
Direct Known Subclasses:
DiscreteDistributionSource

public class ArrayDataSource
extends DataSource

A class which uses two double arrays for storing the (x,y) data pairs.

Since:
2002-04-10
Version:
$Revision: 1.4 $, $Date: 2005/02/21 17:29:18 $
Author:
Henrik Nottelmann

Field Summary
protected  int count
          The counter for to the current position when iterating through the (x,y) data pairs.
protected  double[] x
          The x values of this curve.
protected  double[] y
          The y values of this curve.
 
Fields inherited from class de.unidu.is.gnuplot.FileSource
filename, nosmooth
 
Fields inherited from class de.unidu.is.gnuplot.Source
max, min, title
 
Constructor Summary
ArrayDataSource(java.lang.String title, java.io.File file, double[] x, double[] y)
          Constructs a new instance, sets the specified values, and sets the instance variable count to -1.
ArrayDataSource(java.lang.String title, java.lang.String filename, double[] x, double[] y)
          Constructs a new instance, sets the specified values, and sets the instance variable count to -1.
ArrayDataSource(java.lang.String title, java.lang.String filename, double startx, double[] y)
          Constructs a new instance, sets the specified values, and sets the instance variable count to -1.
 
Method Summary
 double getX()
          Returns the x value of the current (x,y) data pair.
 double getY()
          Returns the y value of the current (x,y) data pair.
 boolean next()
          Switches to the next possible (x,y) data pair if possible.
 
Methods inherited from class de.unidu.is.gnuplot.DataSource
getCommand, write, write
 
Methods inherited from class de.unidu.is.gnuplot.FileSource
getFilename, isSmooth, setFilename, setSmooth
 
Methods inherited from class de.unidu.is.gnuplot.Source
getMax, getMin, getTitle, setMax, setMin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

protected double[] x
The x values of this curve.


y

protected double[] y
The y values of this curve.


count

protected int count
The counter for to the current position when iterating through the (x,y) data pairs.

Constructor Detail

ArrayDataSource

public ArrayDataSource(java.lang.String title,
                       java.io.File file,
                       double[] x,
                       double[] y)
Constructs a new instance, sets the specified values, and sets the instance variable count to -1.

Parameters:
title - title of this curve, or null
file - data output file
x - x values of this curve
y - y values of this curve

ArrayDataSource

public ArrayDataSource(java.lang.String title,
                       java.lang.String filename,
                       double[] x,
                       double[] y)
Constructs a new instance, sets the specified values, and sets the instance variable count to -1.

Parameters:
title - title of this curve, or null
filename - name of the data output file
x - x values of this curve
y - y values of this curve

ArrayDataSource

public ArrayDataSource(java.lang.String title,
                       java.lang.String filename,
                       double startx,
                       double[] y)
Constructs a new instance, sets the specified values, and sets the instance variable count to -1.

The x values are created as startx, startx+1, startx+2, ..., startx+y.length-1.

Parameters:
title - title of this curve, or null
filename - name of the data output file
startx - start values of the x values of this curve
y - y values of this curve
Method Detail

next

public boolean next()
Switches to the next possible (x,y) data pair if possible.

Specified by:
next in class DataSource
Returns:
true iff another data pair is available

getX

public double getX()
Returns the x value of the current (x,y) data pair.

Specified by:
getX in class DataSource
Returns:
x value

getY

public double getY()
Returns the y value of the current (x,y) data pair.

Specified by:
getY in class DataSource
Returns:
y value