NumericSequence
javanpst.data.structures.sequence

Class NumericSequence



  • public class NumericSequenceextends Sequence
    A class representing numerical sequences
    • Constructor Detail

      • NumericSequence

        public NumericSequence()
        Default builder
      • NumericSequence

        public NumericSequence(ArrayList<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 ArrayList<Double> getSequence()
        Returns the contents of the sequence as an array
        Returns:
        contents of the sequence
      • append

        public void append(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(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
      • readXML

        public void readXML(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(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(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(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(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(String file)
        Writes a string sequence to a TXT file
        Specified by:
        writeTXT in class Sequence
        Parameters:
        file - path of the file

SCaVis 1.7 © jWork.org