public static int getSingleViableAlt(Collection<BitSet> altsets) {BitSet viableAlts = new BitSet();for (BitSet alts : altsets) {int minAlt = alts.nextSetBit(0);viableAlts.set(minAlt);if ( viableAlts.cardinality()>1 ) { return ATN.INVALID_ALT_NUMBER;}}return viableAlts.nextSetBit(0);}
public static int GetSingleViableAlt(IEnumerable<BitSet> altsets){BitSet viableAlts = new BitSet();foreach (BitSet alts in altsets){int minAlt = alts.NextSetBit(0);viableAlts.Set(minAlt);if (viableAlts.Cardinality() > 1){return ATN.INVALID_ALT_NUMBER;}}return viableAlts.NextSetBit(0);}