Interface BStream
- All Superinterfaces:
BooleanSupplier
- All Known Implementing Classes:
FilteredBStream
,PollingBStream
,SmartBoolean
A BStream is similar to an IStream, but instead of a stream of doubles, it represents a stream of
booleans.
-
Method Summary
Modifier and TypeMethodDescriptiondefault BStream
Combine two BStreams by and'ing their results togetherstatic BStream
Create a BStream from another BStream.static BStream
create
(edu.wpi.first.wpilibj.DigitalInput input) Create a BStream from a digital source.default FilteredBStream
Create a new FilteredBStream from the current streamboolean
get()
default boolean
default BStream
not()
Create a BStream that returns the opposite result as the originaldefault BStream
Combine two BStreams by or'ing their results togetherdefault PollingBStream
polling
(double dt) Create a new PollingBStream from the current streamdefault edu.wpi.first.wpilibj2.command.button.Trigger
toButton()
default BStream
Combine two BStreams by xor'ing their results together
-
Method Details
-
create
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
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 interfaceBooleanSupplier
- Returns:
- get BStream as a Boolean
-
filtered
Create a new FilteredBStream from the current stream- Parameters:
filters
- the filters you want to apply to the BStream- Returns:
- The FilteredBStream
-
polling
Create a new PollingBStream from the current stream- Parameters:
dt
- the time inbetween each poll of the BStream- Returns:
- The PollingBStream
-
and
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
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
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
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
-