Class AbstractRowFinder

    • Constructor Detail

      • AbstractRowFinder

        public AbstractRowFinder()
    • Method Detail

      • getQuickInfo

        public String getQuickInfo()
        Returns a quick info about the object, which can be displayed in the GUI.

        Default implementation returns null.
        Specified by:
        getQuickInfo in interface QuickInfoSupporter
        Returns:
        null if no info available, otherwise short string
      • check

        protected void check​(SpreadSheet data)
        Checks the data.

        Default implementation only checks whether we have any data at all.
        Parameters:
        data - the data to check
      • doFindRows

        protected abstract int[] doFindRows​(SpreadSheet data)
        Returns the rows of interest in the spreadsheet.
        Parameters:
        data - the spreadsheet to inspect
        Returns:
        the rows of interest
      • findRows

        public int[] findRows​(SpreadSheet data)
        Returns the rows of interest in the spreadsheet.
        Specified by:
        findRows in interface RowFinder
        Parameters:
        data - the spreadsheet to inspect
        Returns:
        the rows of interest
      • 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.
        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 RowFinder shallowCopy​(boolean expand)
        Returns a shallow copy of itself, i.e., based on the commandline options.
        Specified by:
        shallowCopy in interface ShallowCopySupporter<RowFinder>
        Parameters:
        expand - whether to expand variables to their current values
        Returns:
        the shallow copy
      • getRowFinders

        public static String[] getRowFinders()
        Returns a list with classnames of row finders.
        Returns:
        the row finder classnames
      • forName

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

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

        public static HashSet<Integer> arrayToHashSet​(int[] indices)
        Turns the array into a hashset.
        Parameters:
        indices - the indices to turn into hashset
        Returns:
        the generated hashset
      • filter

        public static SpreadSheet filter​(SpreadSheet input,
                                         RowFinder finder)
        Filters the rows of the spreadsheet with the specified row finder.
        Parameters:
        input - the spreadsheet to filter
        finder - the row finder to use
        Returns:
        the generated output