Documentation of 'javanpst.data.structures.sequence.NumericSequence' Java class
NumericSequence
javanpst.data.structures.sequence

Class NumericSequence



  • public class NumericSequence
    extends Sequence
    A class representing numerical sequences
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void append(java.lang.Object value)
      Adds an element to the end of the sequence
      void clear()
      Clear the sequence
      double get(int index)
      Get an element of the sequence
      java.util.ArrayList<java.lang.Double> getSequence()
      Returns the contents of the sequence as an array
      void prepend(java.lang.Object value)
      Adds an element to the start of the sequence
      void readCSV(java.lang.String file)
      Loads a string sequence from a CSV file
      void readTXT(java.lang.String file)
      Loads a string sequence from a TXT file
      void readXML(java.lang.String file)
      Loads a string sequence from a XML file
      int size()
      Get the size of the sequence
      void sort()
      Sorts the sequence
      java.lang.String toString()
      To String method
      void writeCSV(java.lang.String file, boolean useComma)
      Writes a string sequence to a CSV file
      void writeTXT(java.lang.String file)
      Writes a string sequence to a TXT file
      void writeXML(java.lang.String file)
      Writes a string sequence to a XML file
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • NumericSequence

        public NumericSequence()
        Default builder
      • NumericSequence

        public NumericSequence(java.util.ArrayList<java.lang.Double> contents)
        Builder. Creates a new numeric sequence from an ArrayList of elements.
        Parameters:
        contents - array of elements
      • NumericSequence

        public NumericSequence(double[] contents)
        Builder. Creates a new numeric sequence from an array of elements.
        Parameters:
        contents - array of elements
      • NumericSequence

        public NumericSequence(NumericSequence copy)
        Copy constructor
        Parameters:
        copy - sequence to copy
    • Method Detail

      • getSequence

        public java.util.ArrayList<java.lang.Double> getSequence()
        Returns the contents of the sequence as an array
        Returns:
        contents of the sequence
      • append

        public void append(java.lang.Object value)
        Adds an element to the end of the sequence
        Specified by:
        append in class Sequence
        Parameters:
        value - value to add
      • prepend

        public void prepend(java.lang.Object value)
        Adds an element to the start of the sequence
        Specified by:
        prepend in class Sequence
        Parameters:
        value - value to add
      • size

        public int size()
        Get the size of the sequence
        Specified by:
        size in class Sequence
        Returns:
        size
      • get

        public double get(int index)
        Get an element of the sequence
        Parameters:
        index - index of the element
        Returns:
        the element. Double.NaN if index out of range
      • clear

        public void clear()
        Clear the sequence
        Specified by:
        clear in class Sequence
      • sort

        public void sort()
        Sorts the sequence
      • toString

        public java.lang.String toString()
        To String method
        Specified by:
        toString in class Sequence
      • readXML

        public void readXML(java.lang.String file)
        Loads a string sequence from a XML file
        Specified by:
        readXML in class Sequence
        Parameters:
        file - path of the file
      • writeXML

        public void writeXML(java.lang.String file)
        Writes a string sequence to a XML file
        Specified by:
        writeXML in class Sequence
        Parameters:
        file - path of the file
      • readCSV

        public void readCSV(java.lang.String file)
        Loads a string sequence from a CSV file
        Specified by:
        readCSV in class Sequence
        Parameters:
        file - path of the file
      • writeCSV

        public void writeCSV(java.lang.String file,
                             boolean useComma)
        Writes a string sequence to a CSV file
        Specified by:
        writeCSV in class Sequence
        Parameters:
        file - path of the file
        useComma - true true if "," is used as separator, false if ";" is used instead
      • readTXT

        public void readTXT(java.lang.String file)
        Loads a string sequence from a TXT file
        Specified by:
        readTXT in class Sequence
        Parameters:
        file - path of the file
      • writeTXT

        public void writeTXT(java.lang.String file)
        Writes a string sequence to a TXT file
        Specified by:
        writeTXT in class Sequence
        Parameters:
        file - path of the file

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.