Class RollingColumn

java.lang.Object
tech.tablesaw.table.RollingColumn
Direct Known Subclasses:
NumberRollingColumn

public class RollingColumn extends Object
Does a calculation on a rolling basis (e.g. mean for last 20 days)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final Column<?>
    The column providing the data for the rolling calculation
    protected final int
    The size of the rolling window
  • Constructor Summary

    Constructors
    Constructor
    Description
    RollingColumn(Column<?> column, int window)
    Constructs a rolling column based on calculations on a sliding window of window rows of data from the given column
  • Method Summary

    Modifier and Type
    Method
    Description
    <INCOL extends Column<?>, OUT>
    Column<?>
    calc(AggregateFunction<INCOL,OUT> function)
    Performs the calculation and returns a new column containing the results
    protected String
    Generates a name for the column based on the name of the original column and the function used in the calculation

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • column

      protected final Column<?> column
      The column providing the data for the rolling calculation
    • window

      protected final int window
      The size of the rolling window
  • Constructor Details

    • RollingColumn

      public RollingColumn(Column<?> column, int window)
      Constructs a rolling column based on calculations on a sliding window of window rows of data from the given column
  • Method Details

    • generateNewColumnName

      protected String generateNewColumnName(AggregateFunction<?,?> function)
      Generates a name for the column based on the name of the original column and the function used in the calculation
    • calc

      public <INCOL extends Column<?>, OUT> Column<?> calc(AggregateFunction<INCOL,OUT> function)
      Performs the calculation and returns a new column containing the results