Class ParserHelper

    • Field Detail

      • m_Sheet

        protected SpreadSheet m_Sheet
        the underlying spreadsheet.
      • m_AllColumns

        protected boolean m_AllColumns
        whether all columns are retrieved.
      • m_Select

        protected boolean m_Select
        whether to create subset.
      • m_Delete

        protected boolean m_Delete
        whether to delete rows.
      • m_Update

        protected boolean m_Update
        whether to update cells.
      • m_Aggregate

        protected boolean m_Aggregate
        whether to aggregate.
      • m_Columns

        protected List<String> m_Columns
        the columns to retrieve.
      • m_SortColumns

        protected List<String> m_SortColumns
        the columns to sort on.
      • m_UpdateColumns

        protected HashMap<String,​Object> m_UpdateColumns
        the columns to update (column - new value).
      • m_SortAsc

        protected List<Boolean> m_SortAsc
        the columns to sort on.
      • m_RowFinders

        protected List<RowFinder> m_RowFinders
        the row finders to use.
      • m_Subsample

        protected RowFinder m_Subsample
        the rowfinder to use for generating a subsample.
      • m_SubProcess

        protected SubProcess m_SubProcess
        the partial flow for converting the spreadsheet.
      • m_Rows

        protected int[] m_Rows
        the rows to select.
      • m_LimitMax

        protected int m_LimitMax
        the limit.
      • m_LimitOffset

        protected int m_LimitOffset
        the offset for the limit.
      • m_RenamedAggregates

        protected HashMap<String,​String> m_RenamedAggregates
        the new names for the aggregates (old - new).
      • m_GroupByColumns

        protected List<String> m_GroupByColumns
        the group by columns to retrieve.
      • m_DateFormat

        protected DateFormat m_DateFormat
        for formatting dates.
    • Constructor Detail

      • ParserHelper

        public ParserHelper()
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class ParserHelper
      • setSheet

        public void setSheet​(SpreadSheet value)
        Sets the spreadsheet to use.
        Parameters:
        value - the spreadsheet
      • getSheet

        public SpreadSheet getSheet()
        Returns the current spreadsheet in use.
        Returns:
        the spreadsheet
      • getDateFormat

        public DateFormat getDateFormat()
        Returns the date formatter.
        Returns:
        the formatter
      • getDateFormatString

        public DateFormatString getDateFormatString()
        Returns the format string of the current date/time format.
        Returns:
        the format string
        See Also:
        getDateFormat()
      • useAllColumns

        public void useAllColumns()
        Sets to return all columns.
      • addColumn

        public void addColumn​(String col)
        Adds the name of a column to return.
        Parameters:
        col - the column name
      • renameColumn

        public void renameColumn​(String col,
                                 String newCol)
        Adds the name of a column to rename.
        Parameters:
        col - the current column name
        newCol - the new column name
      • addSortColumn

        public void addSortColumn​(String col,
                                  boolean asc)
        Adds the name of a sort column.
        Parameters:
        col - the column name
        asc - whether to sort ascending
      • addUpdateColumn

        public void addUpdateColumn​(String col,
                                    Object value)
        Adds the name of a column to update with a new value.
        Parameters:
        col - the column name
        value - the new value
      • addAggregate

        public void addAggregate​(SpreadSheetAggregate.Aggregate agg,
                                 String col)
        Adds the aggregate to generate from a column.
        Parameters:
        agg - the aggregate
        col - the column name, null if COUNT
      • renameAggregate

        public void renameAggregate​(SpreadSheetAggregate.Aggregate agg,
                                    String col,
                                    String newCol)
        Sets the new column name for the aggregate generated from a column.
        Parameters:
        agg - the aggregate
        col - the column name, null if COUNT
        newCol - the new column name
      • addGroupByColumn

        public void addGroupByColumn​(String col)
        Adds the name of a group by column.
        Parameters:
        col - the column name
      • applyRowFinder

        public int[] applyRowFinder​(RowFinder finder,
                                    String log)
        Applies the row finder.
        Parameters:
        finder - the row finder to apply
        log - a logging message
        Returns:
        the selected rows
      • setSubsampleRowFinder

        public void setSubsampleRowFinder​(RowFinder finder,
                                          String log)
        Sets the row finder to generate a subsample.
        Parameters:
        finder - the row finder to apply
        log - a logging message
      • select

        public void select()
        Sets to create subset.
      • delete

        public void delete()
        Sets to delete rows.
      • update

        public void update()
        Sets to update cells.
      • aggregate

        public void aggregate()
        Sets to create subset from aggregates.
      • combineWithAnd

        public int[] combineWithAnd​(int[] c1,
                                    int[] c2)
        Combines the row finders with logical AND.
        Parameters:
        c1 - the first set of rows
        c2 - the second set of rows
        Returns:
        the combined rows
      • combineWithOr

        public int[] combineWithOr​(int[] c1,
                                   int[] c2)
        Combines the row finders with logical OR.
        Parameters:
        c1 - the first set of rows
        c2 - the second set of rows
        Returns:
        the combined rows
      • invert

        public int[] invert​(int[] c)
        Inverts the row finders.
        Parameters:
        c - the rows to invert
        Returns:
        the inverted rows
      • setLimit

        public void setLimit​(int offset,
                             int max)
        Sets the limit.
        Parameters:
        offset - the offset (0 is offset for first row)
        max - the maximum number of rows (>= 1)
      • setRows

        public void setRows​(int[] value)
        Sets the rows to use.
        Parameters:
        value - the rows
      • getRows

        public int[] getRows()
        Returns the rows to use.
        Returns:
        the rows
      • getSubProcess

        public SubProcess getSubProcess()
        Returns the partial flow that was generated to process the spreadsheet.
        Returns:
        the partial flow, null if none available
      • getResult

        public SpreadSheet getResult()
        Returns the result of the evaluation.
        Returns:
        the result