edu.rit.numeric
Class XYSeries

java.lang.Object
  extended by edu.rit.numeric.XYSeries
Direct Known Subclasses:
AggregateXYSeries, ArrayXYSeries, ListXYSeries, SampledXYSeries, TransformedXYSeries

public abstract class XYSeries
extends Object

Class XYSeries is the abstract base class for a series of (x,y) pairs of real values (type double).


Nested Class Summary
static class XYSeries.Regression
          Class XYSeries.Regression holds the results of a regression on an XYSeries.
 
Constructor Summary
XYSeries()
          Construct a new XY series.
 
Method Summary
 boolean isEmpty()
          Determine if this series is empty.
abstract  int length()
          Returns the number of values in this series.
 XYSeries.Regression linearRegression()
          Returns the linear regression of the (x,y) values in this XY series.
 double maxX()
          Returns the maximum X value in this series.
 double maxY()
          Returns the maximum Y value in this series.
 double minX()
          Returns the minimum X value in this series.
 double minY()
          Returns the minimum Y value in this series.
 void print()
          Print this XY series on the standard output.
 void print(PrintStream theStream)
          Print this XY series on the given print stream.
 void print(PrintWriter theWriter)
          Print this XY series on the given print writer.
abstract  double x(int i)
          Returns the given X value in this series.
 Series xSeries()
          Returns a Series view of the X values in this XY series.
abstract  double y(int i)
          Returns the given Y value in this series.
 Series ySeries()
          Returns a Series view of the Y values in this XY series.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XYSeries

public XYSeries()
Construct a new XY series.

Method Detail

length

public abstract int length()
Returns the number of values in this series.

Returns:
Length.

isEmpty

public boolean isEmpty()
Determine if this series is empty.

Returns:
True if this series is empty (length = 0), false otherwise.

x

public abstract double x(int i)
Returns the given X value in this series.

Parameters:
i - Index.
Returns:
The X value in this series at index i.
Throws:
ArrayIndexOutOfBoundsException - (unchecked exception) Thrown if i is not in the range 0 .. length()-1.

y

public abstract double y(int i)
Returns the given Y value in this series.

Parameters:
i - Index.
Returns:
The Y value in this series at index i.
Throws:
ArrayIndexOutOfBoundsException - (unchecked exception) Thrown if i is not in the range 0 .. length()-1.

minX

public double minX()
Returns the minimum X value in this series.

Returns:
Minimum X value.

maxX

public double maxX()
Returns the maximum X value in this series.

Returns:
Maximum X value.

minY

public double minY()
Returns the minimum Y value in this series.

Returns:
Minimum Y value.

maxY

public double maxY()
Returns the maximum Y value in this series.

Returns:
Maximum Y value.

linearRegression

public XYSeries.Regression linearRegression()
Returns the linear regression of the (x,y) values in this XY series. The linear function y = a + bx is fitted to the data. The return value is a Regression object containing the intercept a, the slope b, and the correlation, respectively.

Note: The returned object contains the regression of a snapshot of this series at the time linearRegression() was called. Changing the data in this series will not change the contents of the returned object.

Returns:
Regression.

xSeries

public Series xSeries()
Returns a Series view of the X values in this XY series.

Note: The returned Series object is backed by this XY series object. Changing the contents of this XY series object will change the contents of the returned Series object.

Returns:
Series of X values.

ySeries

public Series ySeries()
Returns a Series view of the Y values in this XY series.

Note: The returned Series object is backed by this XY series object. Changing the contents of this XY series object will change the contents of the returned Series object.

Returns:
Series of Y values.

print

public void print()
Print this XY series on the standard output. Each line of output consists of the index, the x value, and the y value, separated by tabs.


print

public void print(PrintStream theStream)
Print this XY series on the given print stream. Each line of output consists of the index, the x value, and the y value, separated by tabs.

Parameters:
theStream - Print stream.

print

public void print(PrintWriter theWriter)
Print this XY series on the given print writer. Each line of output consists of the index, the x value, and the y value, separated by tabs.

Parameters:
theWriter - Print writer.


Copyright © 2005-2012 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.