@Test(expected = UnsupportedOperationException.class) public void testUnsupportedFairSelectNextIndexOutOf2() { InputSelection.ALL.fairSelectNextIndexOutOf2(7, 0); }
public int fairSelectNextIndexOutOf2(int availableInputsMask, int lastReadInputIndex) { int selectionMask = (int) inputMask; int combineMask = availableInputsMask & selectionMask; if (combineMask == 3) { return lastReadInputIndex == 0 ? 1 : 0; } else if (combineMask >= 0 && combineMask < 3) { return combineMask - 1; } throw new UnsupportedOperationException("Only two inputs are supported."); }
InputSelection implements Serializable { public int fairSelectNextIndexOutOf2(int availableInputsMask, int lastReadInputIndex) { int selectionMask = (int) inputMask; int combineMask = availableInputsMask & selectionMask; if (combineMask == 3) { return lastReadInputIndex == 0 ? 1 : 0; } else if (combineMask >= 0 && combineMask < 3) { return combineMask - 1; } throw new UnsupportedOperationException("Only two inputs are supported."); } }
InputSelection implements Serializable { public int fairSelectNextIndexOutOf2(int availableInputsMask, int lastReadInputIndex) { int selectionMask = (int) inputMask; int combineMask = availableInputsMask & selectionMask; if (combineMask == 3) { return lastReadInputIndex == 0 ? 1 : 0; } else if (combineMask >= 0 && combineMask < 3) { return combineMask - 1; } throw new UnsupportedOperationException("Only two inputs are supported."); } private  InputSelection(long inputMask, boolean isALLMaskOf2); }
InputSelection implements Serializable { public int fairSelectNextIndexOutOf2(int availableInputsMask, int lastReadInputIndex) { int selectionMask = (int) inputMask; int combineMask = availableInputsMask & selectionMask; if (combineMask == 3) { return lastReadInputIndex == 0 ? 1 : 0; } else if (combineMask >= 0 && combineMask < 3) { return combineMask - 1; } throw new UnsupportedOperationException("Only two inputs are supported."); } private  InputSelection(long inputMask, boolean isALLMaskOf2); long getInputMask(); boolean isInputSelected(int inputId); boolean areAllInputsSelected(); boolean isALLMaskOf2(); int fairSelectNextIndexOutOf2(int availableInputsMask, int lastReadInputIndex); @Override boolean equals(Object o); @Override String toString(); }
InputSelection implements Serializable { public int fairSelectNextIndexOutOf2(int availableInputsMask, int lastReadInputIndex) { int selectionMask = (int) inputMask; int combineMask = availableInputsMask & selectionMask; if (combineMask == 3) { return lastReadInputIndex == 0 ? 1 : 0; } else if (combineMask >= 0 && combineMask < 3) { return combineMask - 1; } throw new UnsupportedOperationException("Only two inputs are supported."); } private  InputSelection(long inputMask, boolean isALLMaskOf2); long getInputMask(); boolean isInputSelected(int inputId); boolean areAllInputsSelected(); boolean isALLMaskOf2(); int fairSelectNextIndexOutOf2(int availableInputsMask, int lastReadInputIndex); @Override boolean equals(Object o); @Override String toString(); static final InputSelection ALL; static final InputSelection FIRST; static final InputSelection SECOND; }