Class PercentChangePeriodRTIndicator

All Implemented Interfaces:
ClockAware, Resettable, RTIndicator

public class PercentChangePeriodRTIndicator extends AbstractDecorableIncrementalRTIndicator
Calculates the percent change over periods tracked by a PeriodCounter indicator.
  • Constructor Details

    • PercentChangePeriodRTIndicator

      public PercentChangePeriodRTIndicator(PeriodCounterRTIndicator periodCounterRTIndicator)
    • PercentChangePeriodRTIndicator

      public <T extends RTIndicator & PeriodCounter> PercentChangePeriodRTIndicator(T indicator)
  • Method Details

    • getPeriodCount

      public long getPeriodCount()
    • getInitialValue

      public double getInitialValue()
    • getPercentChange

      public double getPercentChange()
    • update

      public double update(double newValue)
      Computes the percent change relative to the initial value at the start of the current period sequence. When the period counter resets to zero, captures a new initial value and returns 0. Uses a default baseline of 100 when the initial value is zero to avoid division by zero. The stored value is the fractional change (multiply by 100 for percentage).
      Specified by:
      update in interface RTIndicator
      Overrides:
      update in class AbstractDecorableIncrementalRTIndicator
      Parameters:
      newValue - the new input value
      Returns:
      the fractional change relative to the period's initial value