Class ThresholdFilter

  • All Implemented Interfaces:
    Filter

    public class ThresholdFilter
    extends java.lang.Object
    implements Filter
    A filter that completely attentuates any value (infinite impulse) below or above a defined threshold.
    • Constructor Summary

      Constructors 
      Constructor Description
      ThresholdFilter​(double threshold, boolean invert)
      Constructs a ThresholdFilter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double calculate​(double value)
      Adds the value to the window and calculates the current output of the filter
      double getCurrentOutput()
      Returns the current output of the filter without updating with a new value.
      void reset()
      Resets the history of the filter.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ThresholdFilter

        public ThresholdFilter​(double threshold,
                               boolean invert)
        Constructs a ThresholdFilter. By default, filters out values above the threshold, but can be interved to filter out values below the threshold.
        Parameters:
        threshold - The filter will attentuate values above this threshold.
        invert - Whether to attentuate values *below* this threshold instead.
    • Method Detail

      • calculate

        public double calculate​(double value)
        Description copied from interface: Filter
        Adds the value to the window and calculates the current output of the filter
        Specified by:
        calculate in interface Filter
        Parameters:
        value - The value to input to the filter.
        Returns:
        The current output of the filter.
      • reset

        public void reset()
        Description copied from interface: Filter
        Resets the history of the filter.
        Specified by:
        reset in interface Filter
      • getCurrentOutput

        public double getCurrentOutput()
        Description copied from interface: Filter
        Returns the current output of the filter without updating with a new value.
        Specified by:
        getCurrentOutput in interface Filter
        Returns:
        The current output of the filter (0 if no values have been given to calculate()).