All Known Implementing Classes:
Derivative, HighPassFilter, IFilterGroup, LowPassFilter, MotionProfile, RateLimit, TimedMovingAverage

public interface IFilter
This is the Filter interface class that gives a definition for how to implement a filter.

All that a filter does is take in the next double in a series and gives you the filtered value.

  • Method Summary

    Modifier and Type
    Method
    Description
    default IFilter
    add(IFilter other)
    Combine two IFilters by adding their results together
    static IFilter
    create(IFilter... filters)
    Create an IFilter from a list of IFilters.
    double
    get(double next)
    Get next value in Filter based on the next value given
    default IFilter
    Invert an IFilter by subtracting the input from the result of the IFilter.
    default IFilter
    sub(IFilter other)
    Combine two IFilters by subtracting their results together
    default IFilter
    then(IFilter next)
    Combine an IFilter with another IFilter
  • Method Details

    • create

      static IFilter create(IFilter... filters)
      Create an IFilter from a list of IFilters. This will create an IFilter with the least possible overhead for the number of filters provided.
      Parameters:
      filters - list of IFilters to apply
      Returns:
      an IFilter that uses every filter given
    • get

      double get(double next)
      Get next value in Filter based on the next value given
      Parameters:
      next - next input value in the stream
      Returns:
      the output value of the filter
    • then

      default IFilter then(IFilter next)
      Combine an IFilter with another IFilter
      Parameters:
      next - filter to be evaluated after this one
      Returns:
      the combined filter
    • add

      default IFilter add(IFilter other)
      Combine two IFilters by adding their results together
      Parameters:
      other - other IFilter to add to this one
      Returns:
      the resulting IFilter after the sum
    • sub

      default IFilter sub(IFilter other)
      Combine two IFilters by subtracting their results together
      Parameters:
      other - other IFilter to subtract from this one
      Returns:
      the resulting IFilter after the subtraction
    • invert

      default IFilter invert()
      Invert an IFilter by subtracting the input from the result of the IFilter.

      Inverting a LowPassFilter gives you a HighPassFilter and vise versa.

      Inverting something twice gives you the original value.

      Returns:
      the inverted filter