ListSeries
edu.rit.numeric

Class ListSeries

    • Constructor Detail

      • ListSeries

        public ListSeries()
        Construct a new zero-length series.
    • Method Detail

      • length

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

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

        public ListSeries clear()
        Clear this series.
        Returns:
        This series.
      • add

        public ListSeries add(double x)
        Add the given data to this series.
        Parameters:
        x - X value.
        Returns:
        This series.
      • add

        public ListSeries add(double[] x)
        Add the given data array to this series. Each element of x is added to this series as though by the add(double) method.
        Parameters:
        x - Array of X values.
        Returns:
        This series.
        Throws:
        NullPointerException - (unchecked exception) Thrown if x is null.
      • add

        public ListSeries add(double[] x,             int off,             int len)
        Add a portion of the given data array to this series. Each element of x from index off through index off+len-1 inclusive is added to this series as though by the add(double) method.
        Parameters:
        x - Array of X values.
        off - Index of first element to add.
        len - Number of elements to add.
        Returns:
        This series.
        Throws:
        NullPointerException - (unchecked exception) Thrown if x is null.
        IndexOutOfBoundsException - (unchecked exception) Thrown if off < 0, len < 0, or off+len > x.length.
      • add

        public ListSeries add(Series theSeries)
        Add the given Series to this series. Each X value in the given series is added to this series as though by the add(double) method.
        Parameters:
        theSeries - Series.
        Returns:
        This series.
        Throws:
        NullPointerException - (unchecked exception) Thrown if theSeries is null.
      • add

        public ListSeries add(Series theSeries,             int off,             int len)
        Add a portion of the given Series to this series. Each X value in the given series from index off through index off+len-1 inclusive is added to this series as though by the add(double) method.
        Parameters:
        theSeries - Series.
        off - Index of first element to add.
        len - Number of elements to add.
        Returns:
        This series.
        Throws:
        NullPointerException - (unchecked exception) Thrown if theSeries is null.
        IndexOutOfBoundsException - (unchecked exception) Thrown if off < 0, len < 0, or off+len > theSeries.length().
      • add

        public ListSeries add(Scanner scanner)
        Add data read from the given scanner to this series. Double values are read from the scanner until there are no more. Each double value is added to this series as though by the add(double) method. The add() method does not close the scanner when finished.

        To read data from a file, pass a scanner constructed on top of the file; to read data from an input stream, pass a scanner constructed on top of the input stream; and so on.

        Parameters:
        scanner - Scanner.
        Returns:
        This series.
        Throws:
        NullPointerException - (unchecked exception) Thrown if scanner is null.

SCaVis 2.0 © jWork.ORG