Interface IStream

All Superinterfaces:
DoubleSupplier
All Known Implementing Classes:
FilteredIStream, NumberStream, PollingIStream, SmartNumber

public interface IStream extends DoubleSupplier
A stream of doubles that is accessed with the get() function

Can be created with lambdas to represent a stream of inputs.

It can be filitered with the available filtering options.

  • Method Details

    • create

      static IStream create(IStream stream)
      Create an IStream from another IStream. This is helpful if you want to use some of the decorator functions with a lambda.
      Parameters:
      stream - stream to create IStream from
      Returns:
      the resulting IStream
    • create

      static IStream create(AStream stream)
      Create an IStream from another AStream. This will convert the angle to a double in radians.
      Parameters:
      stream - stream to create IStream from
      Returns:
      the resulting IStream
    • create

      static IStream create(BStream stream)
      Create a IStream from another BStream. This will check if the amplitude is above a certain threshold.
      Parameters:
      stream - stream to create IStream from
      Returns:
      the resulting IStream
    • get

      double get()
      Returns:
      next value in the stream
    • getAsDouble

      default double getAsDouble()
      Specified by:
      getAsDouble in interface DoubleSupplier
      Returns:
      get IStream as a double
    • filtered

      default FilteredIStream filtered(IFilter... filters)
      Create a new FilteredIStream from the current stream
      Parameters:
      filters - the filters you want to apply to the IStream
      Returns:
      The FilteredIStream
    • polling

      default PollingIStream polling(double dt)
      Create a new PollingIStream from the current stream
      Parameters:
      dt - the time inbetween each poll of the IStream
      Returns:
      The PollingIStream
    • add

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

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

      default NumberStream number()
      Casts an IStream to a Number
      Returns:
      a Number that reads from this stream