Interface BStream

All Superinterfaces:
BooleanSupplier
All Known Implementing Classes:
FilteredBStream, PollingBStream, SmartBoolean

public interface BStream extends BooleanSupplier
A BStream is similar to an IStream, but instead of a stream of doubles, it represents a stream of booleans.
  • Method Summary

    Modifier and Type
    Method
    Description
    default BStream
    and(BStream other)
    Combine two BStreams by and'ing their results together
    static BStream
    create(BStream stream)
    Create a BStream from another BStream.
    static BStream
    create(edu.wpi.first.wpilibj.DigitalInput input)
    Create a BStream from a digital source.
    filtered(BFilter... filters)
    Create a new FilteredBStream from the current stream
    boolean
    get()
     
    default boolean
     
    default BStream
    not()
    Create a BStream that returns the opposite result as the original
    default BStream
    or(BStream other)
    Combine two BStreams by or'ing their results together
    polling(double dt)
    Create a new PollingBStream from the current stream
    default edu.wpi.first.wpilibj2.command.button.Trigger
     
    default BStream
    xor(BStream other)
    Combine two BStreams by xor'ing their results together
  • Method Details

    • create

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

      static BStream create(edu.wpi.first.wpilibj.DigitalInput input)
      Create a BStream from a digital source. This can helpful for processing a digital stream, like negating the value when used for switches.
      Parameters:
      input - digital input object
      Returns:
      the resulting BStream
    • get

      boolean get()
      Returns:
      next value in the stream
    • getAsBoolean

      default boolean getAsBoolean()
      Specified by:
      getAsBoolean in interface BooleanSupplier
      Returns:
      get BStream as a Boolean
    • filtered

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

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

      default BStream and(BStream other)
      Combine two BStreams by and'ing their results together
      Parameters:
      other - other BStream to and with this one
      Returns:
      the resulting BStream after the and
    • or

      default BStream or(BStream other)
      Combine two BStreams by or'ing their results together
      Parameters:
      other - other BStream to or with this one
      Returns:
      the resulting BStream after the or
    • xor

      default BStream xor(BStream other)
      Combine two BStreams by xor'ing their results together
      Parameters:
      other - other BStream to xor with this one
      Returns:
      the resulting BStream after the xor
    • not

      default BStream not()
      Create a BStream that returns the opposite result as the original
      Returns:
      the resulting BStream after the not operation
    • toButton

      default edu.wpi.first.wpilibj2.command.button.Trigger toButton()
      Returns:
      a WPILib Trigger that is pressed when this class is true