Class AbstractDataContainerReader<T extends DataContainer>

    • Field Detail

      • m_CreateDummyReport

        protected boolean m_CreateDummyReport
        whether to create a dumy report if none is present.
      • m_ReadData

        protected List<T extends DataContainer> m_ReadData
        the data containers that have been read.
      • m_Processed

        protected boolean m_Processed
        indicates whether the data has been processed.
      • m_InputIsFile

        protected boolean m_InputIsFile
        indicates whether the input has to be a file (= default) or directory.
    • Constructor Detail

      • AbstractDataContainerReader

        public AbstractDataContainerReader()
    • Method Detail

      • getFormatDescription

        public abstract String getFormatDescription()
        Returns a string describing the format (used in the file chooser).
        Specified by:
        getFormatDescription in interface FileFormatHandler
        Returns:
        a description suitable for displaying in the file chooser
      • getFormatExtensions

        public abstract String[] getFormatExtensions()
        Returns the extension(s) of the format.
        Specified by:
        getFormatExtensions in interface FileFormatHandler
        Returns:
        the extension (without the dot!)
      • reset

        protected void reset()
        Resets the reader (but does not clear the input data!). Derived classes must call this method in set-methods of parameters to assure the invalidation of previously generated data.
        Overrides:
        reset in class AbstractOptionHandler
      • isInputFile

        public boolean isInputFile()
        Returns whether the input needs to be a file or directory.
        Returns:
        true if the input needs to be a file, a directory otherwise
      • setInput

        public void setInput​(PlaceholderFile value)
        Sets the file/directory to read.
        Parameters:
        value - the file/directory to read
      • getInput

        public PlaceholderFile getInput()
        The file/directory to read.
        Returns:
        the file/directory to read
      • inputTipText

        public String inputTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setCreateDummyReport

        public void setCreateDummyReport​(boolean value)
        Sets whether to create a dummy report if none present.
        Parameters:
        value - if true then a dummy report is generated if necessary
      • getCreateDummyReport

        public boolean getCreateDummyReport()
        Returns whether to create a dummy report if none present.
        Returns:
        true if a dummy report is generated if necessary
      • createDummyReportTipText

        public String createDummyReportTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • read

        public List<T> read()
        Returns the spectrums generated from the file. If necessary, performs the parsing (e.g., if not yet read).
        Returns:
        the spectrums generated from the file
      • doRead

        protected List<T> doRead()
        Performs checks and (always) reads the data.
        Returns:
        the spectrums generated from the file
      • checkData

        protected void checkData()
        The default implementation only checks whether the provided file object is an actual file and whether it exists (if m_InputIsFile = true), or if the file object is a directory and whether it exists.
        See Also:
        m_InputIsFile
      • readData

        protected abstract void readData()
        Performs the actual reading.
      • postProcessData

        protected void postProcessData()
        For performing post-processing.

        Default implementation adds dummy reports.
        See Also:
        #createDummyReport()
      • createDummyReport

        protected Report createDummyReport​(T cont)
        Creates a dummy report.

        Default implementation returns null.
        Parameters:
        cont - the data container the dummy is for
        Returns:
        the dummy report or null
        See Also:
        m_CreateDummyReport, postProcessData()
      • cleanUp

        public void cleanUp()
        Can be used to free up memory. Default implementation just calls reset(). Derived classes can add additional code.
        Specified by:
        cleanUp in interface CleanUpHandler
        See Also:
        reset()
      • compareTo

        public int compareTo​(Object o)
        Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

        Only compares the commandlines of the two objects.
        Specified by:
        compareTo in interface Comparable<T extends DataContainer>
        Parameters:
        o - the object to be compared.
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Throws:
        ClassCastException - if the specified object's type prevents it from being compared to this object.
      • equals

        public boolean equals​(Object o)
        Returns whether the two objects are the same.

        Only compares the commandlines of the two objects.
        Overrides:
        equals in class Object
        Parameters:
        o - the object to be compared
        Returns:
        true if the object is the same as this one