@PublicEvolving public final class InputSelection extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
InputSelection.Builder
Utility class for creating
InputSelection . |
Modifier and Type | Field and Description |
---|---|
static InputSelection |
ALL
The
InputSelection instance which indicates to select all inputs. |
static InputSelection |
FIRST
The
InputSelection instance which indicates to select the first input. |
static InputSelection |
SECOND
The
InputSelection instance which indicates to select the second input. |
Modifier and Type | Method and Description |
---|---|
boolean |
areAllInputsSelected()
Tests if all inputs are selected.
|
boolean |
equals(Object o) |
int |
fairSelectNextIndexOutOf2(int availableInputsMask,
int lastReadInputIndex)
Fairly select one of the two inputs for reading.
|
long |
getInputMask() |
boolean |
isALLMaskOf2()
Tells whether or not the input mask includes all of two inputs.
|
boolean |
isInputSelected(int inputId)
Tests if the input specified by
inputId is selected. |
String |
toString() |
public static final InputSelection ALL
InputSelection
instance which indicates to select all inputs.public static final InputSelection FIRST
InputSelection
instance which indicates to select the first input.public static final InputSelection SECOND
InputSelection
instance which indicates to select the second input.public long getInputMask()
public boolean isInputSelected(int inputId)
inputId
is selected.inputId
- The input id, see the description of inputId
in InputSelection.Builder.select(int)
.true
if the input is selected, false
otherwise.public boolean areAllInputsSelected()
true
if the input mask equals -1, false
otherwise.public boolean isALLMaskOf2()
true
if the input mask includes all of two inputs, false
otherwise.public int fairSelectNextIndexOutOf2(int availableInputsMask, int lastReadInputIndex)
inputMask
includes two inputs and
both inputs are available, alternately select one of them. Otherwise, select the available one
of inputMask
, or return -1 to indicate no input is selected.
Note that this supports only two inputs for performance reasons.
availableInputsMask
- The mask of all available inputs.lastReadInputIndex
- The index of last read input.inputMask
is empty or the inputs in inputMask
are unavailable).Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.