StringSequence
javanpst.data.structures.sequence

Class StringSequence



  • public class StringSequenceextends Sequence
    A class representing string sequences
    • Constructor Detail

      • StringSequence

        public StringSequence()
        Default builder
      • StringSequence

        public StringSequence(ArrayList<String> contents)
        Builder. Creates a new string sequence from an ArrayList of elements.
        Parameters:
        contents - array of elements
      • StringSequence

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

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

      • getSequence

        public ArrayList<String> getSequence()
        Returns the contents of the sequence as an array
        Returns:
        contents of the sequence
      • append

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

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

        public String get(int index)
        Get an element of the sequence
        Parameters:
        index - index of the element
        Returns:
        the element. "" if index out of range
      • size

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

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

        public boolean isBinary()
        Checks is the sequence is binary
        Returns:
        True if the sequence is binary.
      • 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 2.2 © jWork.ORG