java.lang.Object
com.stuypulse.stuylib.streams.numbers.filters.RateLimit
All Implemented Interfaces:
IFilter

public class RateLimit extends Object implements IFilter
This class lets you rate limit a stream of inputs

Instead of being based on the rate that update is called, the value you give it is based on how much it should be able to change in one second.

  • Constructor Details

    • RateLimit

      public RateLimit(Number rateLimit)
      Parameters:
      rateLimit - The amount that the value should be able to change in one second.
  • Method Details

    • get

      public double get(double next)
      Description copied from interface: IFilter
      Get next value in Filter based on the next value given
      Specified by:
      get in interface IFilter
      Parameters:
      next - next input value in the stream
      Returns:
      the output value of the filter