class 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);

}