Documentation of 'edu.rit.numeric.ListSeries' Java class
ListSeries
edu.rit.numeric

Class ListSeries

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, java.lang.Iterable<java.lang.Double>


    public class ListSeries
    extends Series
    implements java.io.Externalizable
    Class ListSeries provides a series of real values (type double); the series is variable-length.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      ListSeries()
      Construct a new zero-length series.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      ListSeries add(double x)
      Add the given data to this series.
      ListSeries add(double[] x)
      Add the given data array to this series.
      ListSeries add(double[] x, int off, int len)
      Add a portion of the given data array to this series.
      ListSeries add(java.util.Scanner scanner)
      Add data read from the given scanner to this series.
      ListSeries add(Series theSeries)
      Add the given Series to this series.
      ListSeries add(Series theSeries, int off, int len)
      Add a portion of the given Series to this series.
      ListSeries clear()
      Clear this series.
      int length()
      Returns the number of values in this series.
      void readExternal(java.io.ObjectInput in)
      Read this series from the given object input stream.
      void writeExternal(java.io.ObjectOutput out)
      Write this series to the given object output stream.
      double x(int i)
      Returns the given X value in this series.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • 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:
        java.lang.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:
        java.lang.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:
        java.lang.NullPointerException - (unchecked exception) Thrown if x is null.
        java.lang.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:
        java.lang.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:
        java.lang.NullPointerException - (unchecked exception) Thrown if theSeries is null.
        java.lang.IndexOutOfBoundsException - (unchecked exception) Thrown if off < 0, len < 0, or off+len > theSeries.length().
      • add

        public ListSeries add(java.util.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:
        java.lang.NullPointerException - (unchecked exception) Thrown if scanner is null.
      • writeExternal

        public void writeExternal(java.io.ObjectOutput out)
                           throws java.io.IOException
        Write this series to the given object output stream.
        Specified by:
        writeExternal in interface java.io.Externalizable
        Parameters:
        out - Object output stream.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • readExternal

        public void readExternal(java.io.ObjectInput in)
                          throws java.io.IOException
        Read this series from the given object input stream.
        Specified by:
        readExternal in interface java.io.Externalizable
        Parameters:
        in - Object input stream.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.