Class AbstractReportWriter<T extends Report>

    • Constructor Detail

      • AbstractReportWriter

        public AbstractReportWriter()
    • 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 of the format.
        Specified by:
        getFormatExtensions in interface FileFormatHandler
        Returns:
        the extension (without the dot!)
      • reset

        protected void reset()
        Resets the writer (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
      • setOutput

        public void setOutput​(PlaceholderFile value)
        Sets the file/directory to write to.
        Specified by:
        setOutput in interface ReportWriter<T extends Report>
        Parameters:
        value - the file/directory to write to
      • outputTipText

        public String outputTipText()
        Returns the tip text for this property.
        Specified by:
        outputTipText in interface ReportWriter<T extends Report>
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • write

        public boolean write​(T data)
        Performs checks and writes the data.
        Specified by:
        write in interface ReportWriter<T extends Report>
        Parameters:
        data - the data to write
        Returns:
        true if successfully written
      • checkData

        protected void checkData​(T data)
        The default implementation only checks whether the provided file is an actual file and whether it exists (if m_OutputIsFile is TRUE). Otherwise the directory has to exist.
        Parameters:
        data - the data to write
      • writeData

        protected abstract boolean writeData​(T data)
        Performs the actual writing.
        Parameters:
        data - the data to write
        Returns:
        true if successfully written
      • cleanUp

        public void cleanUp()
        Can be used to free up memory. Default implementation just calls reset() and sets the chromatogram to null. 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 Report>
        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
      • shallowCopy

        public AbstractReportWriter shallowCopy​(boolean expand)
        Returns a shallow copy of itself, i.e., based on the commandline options.
        Specified by:
        shallowCopy in interface ShallowCopySupporter<T extends Report>
        Parameters:
        expand - whether to expand variables to their current values
        Returns:
        the shallow copy
      • getWriters

        public static String[] getWriters()
        Returns a list with classnames of writers.
        Returns:
        the writer classnames
      • forName

        public static AbstractReportWriter forName​(String classname,
                                                   String[] options)
        Instantiates the chromatogram writer with the given options.
        Parameters:
        classname - the classname of the writer to instantiate
        options - the options for the writer
        Returns:
        the instantiated writer or null if an error occurred
      • forCommandLine

        public static AbstractReportWriter forCommandLine​(String cmdline)
        Instantiates the chromatogram writer from the given commandline (i.e., classname and optional options).
        Parameters:
        cmdline - the classname (and optional options) of the writer to instantiate
        Returns:
        the instantiated writer or null if an error occurred