Class PeriodCounterRTIndicator

All Implemented Interfaces:
ClockAware, PeriodCounter, Resettable, RTIndicator
Direct Known Subclasses:
GainRTIndicator, LossRTIndicator

public class PeriodCounterRTIndicator extends AbstractDecorableIncrementalRTIndicator implements PeriodCounter
Incremental indicator that counts the number of consecutive periods (updates). Subclasses like GainRTIndicator and LossRTIndicator use this to track how many consecutive periods a condition has held. The counter increments on each nextValue call and can be reset via resetPeriods().
  • Constructor Details

    • PeriodCounterRTIndicator

      public PeriodCounterRTIndicator(RTIndicator indicator)
  • Method Details

    • resetPeriods

      public void resetPeriods()
      Specified by:
      resetPeriods in interface PeriodCounter
    • incPeriods

      protected void incPeriods()
    • nextValue

      protected double nextValue(double prevValue, double newValue)
      Description copied from class: AbstractIncrementalRTIndicator
      Computes the next indicator value from the previous and new input values. This is the core calculation method that subclasses must implement.
      Overrides:
      nextValue in class AbstractDecorableIncrementalRTIndicator
      Parameters:
      prevValue - the previous indicator value (or last update value, depending on override)
      newValue - the new input value
      Returns:
      the computed indicator value
    • getPeriodCount

      public long getPeriodCount()
      Specified by:
      getPeriodCount in interface PeriodCounter