Class AbstractReportReader<T extends Report>

    • Field Detail

      • m_Stopped

        protected boolean m_Stopped
        whether the reader got stopped.
    • Constructor Detail

      • AbstractReportReader

        public AbstractReportReader()
    • 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(s) (without the dot!)
      • reset

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

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

        public List<T> read()
        Performs checks and (always) reads the data.
        Specified by:
        read in interface ReportReader<T extends Report>
        Returns:
        the report loaded 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.
      • readData

        protected abstract List<T> readData()
        Performs the actual reading.
        Returns:
        the reports that were read
      • postRead

        protected void postRead​(List<T> data)
        Post-processing after reading the data.
        Parameters:
        data - the reports to post-process
      • stopExecution

        public void stopExecution()
        Stops the execution.
        Specified by:
        stopExecution in interface Stoppable
      • isStopped

        public boolean isStopped()
        Whether the execution has been stopped.
        Specified by:
        isStopped in interface StoppableWithFeedback
        Returns:
        true if stopped
      • determineParentID

        protected abstract int determineParentID​(Report report)
        Tries to determine the parent ID for the current report.
        Parameters:
        report - the report to determine the ID for
        Returns:
        the parent database ID, -1 if it cannot be determined
      • 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()
      • newInstance

        public abstract T newInstance()
        Returns a new instance of the report class in use.
        Returns:
        the new (empty) report
      • 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 AbstractReportReader 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
      • getReaders

        public static String[] getReaders()
        Returns a list with classnames of readers.
        Returns:
        the reader classnames
      • forName

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

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