Interface GroupingBuilder

All Known Implementing Classes:
AbstractGroupingBuilder

public interface GroupingBuilder
A builder interface used to create grouping tables or maps.
  • Method Details

    • makeNullOnlyGroupingTable

      static <DATA_TYPE> Table makeNullOnlyGroupingTable(com.illumon.dataobjects.ColumnDefinition<DATA_TYPE> columnDefinition, long firstKey, long lastKey)
    • addRegionMutator

      @NotNull GroupingBuilder addRegionMutator(@NotNull Function<Table,Table> mutator)
      Add a method that will process tables per region. If the mutator returns a null or empty table, it will not be passed to the following mutators.
      Parameters:
      mutator - a function to process the input tables.
      Returns:
      this GroupingBuilder
    • clampToIndex

      @NotNull GroupingBuilder clampToIndex(@NotNull ReadOnlyIndex index, boolean strict)
      Clamp the returned table of indices to the specified range. In strict mode, guarantees that the indices returned for each group include ony indices in the specified index.
      Parameters:
      index - the index of interest
      strict - when true, the final table will contain only indices that are part of 'index'
      Returns:
      this GroupingBuilder
    • clampToIndex

      @NotNull @FinalDefault default GroupingBuilder clampToIndex(@NotNull ReadOnlyIndex index)
      Indicate that only groups which intersect the specified index are returned in the final table. Note that this may include indices in specified groups that are outside the index, but allows the implementation to optimize out entire regions which may not be contained in the specified index.

      Users may use clampToIndex(ReadOnlyIndex, boolean) for more control over this behavior.

      Parameters:
      index - the index to constrain with
      Returns:
      this GroupingBuilder
    • sortByFirstKey

      @NotNull GroupingBuilder sortByFirstKey()
      Sort the final grouping table by the first key within each group. This can be useful to maintain visitation order.
      Returns:
      this GroupingBuilder
    • matching

      @NotNull GroupingBuilder matching(boolean matchCase, boolean invert, Object... groupKeys)
      Only include keys in the resultant grouping that match the specified set of grouping keys, optionally ignoring case or inverting the match. The grouping keys must not be empty.
      Parameters:
      matchCase - if matches should consider case
      invert - if the match should be inverted
      groupKeys - the set of keys to match
      Returns:
      this GroupingBuilder
    • positionally

      GroupingBuilder positionally(@NotNull ReadOnlyIndex inverter)
      Construct groupings as positions, as if the source index were flat.
      Returns:
      this GroupingBuilder
    • buildTable

      @Nullable Table buildTable()
      Build a Grouping table based on the current configuration of this builder.
      Returns:
      the data index table.
    • buildGroupingMap

      @Nullable <T> Map<T,ReadOnlyIndex> buildGroupingMap()
      Build a Map of the Grouping values based on the current configuration of this builder. Note that the returned map will respect the table order of the final table.
      Returns:
      a properly ordered Map of key to read only index.
    • estimateGroupingSize

      long estimateGroupingSize()
      Estimate the total size of the resultant grouping table based on the current builder parameters. This method is guaranteed to return a worse-case size, that is, the final grouping may be smaller than reported, but will never be larger.
      Returns:
      the estimated size of the grouping provided current parameters.
    • getIndexColumnName

      @NotNull default String getIndexColumnName()
      Get the name of the column containing the grouping indices.
      Returns:
      the name of the index column
    • getValueColumnName

      @NotNull String getValueColumnName()
      Get the name of the column containing the grouping keys.
      Returns:
      the name of the key column