getUniqueAlt static method

int getUniqueAlt(
  1. List<BitSet> altsets
)

Returns the unique alternative predicted by all alternative subsets in altsets. If no such alternative exists, this method returns {@link ATN#INVALID_ALT_NUMBER}.

@param altsets a collection of alternative subsets

Implementation

static int getUniqueAlt(List<BitSet> altsets) {
  final all = getAlts(altsets);
  if (all.cardinality == 1) return all.nextset(0);
  return ATN.INVALID_ALT_NUMBER;
}