SampledXYSeries
edu.rit.numeric

Class SampledXYSeries



  • public class SampledXYSeriesextends XYSeries
    Class SampledXYSeries provides a series of (x,y) pairs of real values (type double) where the Y values are computed by sampling a Function for a series of X values.

    Class SampledXYSeries is implemented to minimize space rather than time. Each time x() is called, the x value is computed anew. Each time y() is called, the x value is computed anew, then the y value is computed anew by evaluating the function at x.

    • Constructor Detail

      • SampledXYSeries

        public SampledXYSeries(Function theFunction,               double xinit,               double delta,               int len)
        Construct a new sampled series sampling values of the given function. The y values at indexes 0, 1, 2, ... len-1 are computed by evaluating theFunction at the x values xinit, xinit+delta, xinit+2*delta, ... xinit+(len-1)*delta.
        Parameters:
        theFunction - Function to sample.
        xinit - Initial x value.
        delta - Difference between successive x values.
        len - Length (number of (x,y) pairs).
        Throws:
        NullPointerException - (unchecked exception) Thrown if theFunction is null.
        IllegalArgumentException - (unchecked exception) Thrown if len is less than 0.
    • Method Detail

      • length

        public int length()
        Returns the number of values in this series.
        Specified by:
        length in class XYSeries
        Returns:
        Length.
      • x

        public double x(int i)
        Returns the given X value in this series.
        Specified by:
        x in class XYSeries
        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 double y(int i)
        Returns the given Y value in this series.
        Specified by:
        y in class XYSeries
        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.

SCaVis 2.2 © jWork.ORG