From faf011ce8a103832d88709333046c26688d61a9a Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Sun, 6 Apr 2014 16:51:34 -0500 Subject: [PATCH] Updated documentation for ParserATNSimulator.getConflictingAlts (fixes #528) --- .../org/antlr/v4/runtime/atn/ParserATNSimulator.java | 12 +++++++++++- .../src/org/antlr/v4/runtime/atn/PredictionMode.java | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/runtime/Java/src/org/antlr/v4/runtime/atn/ParserATNSimulator.java b/runtime/Java/src/org/antlr/v4/runtime/atn/ParserATNSimulator.java index 8ae3ff471..164e9aa58 100755 --- a/runtime/Java/src/org/antlr/v4/runtime/atn/ParserATNSimulator.java +++ b/runtime/Java/src/org/antlr/v4/runtime/atn/ParserATNSimulator.java @@ -1617,7 +1617,17 @@ public class ParserATNSimulator extends ATNSimulator { return new ATNConfig(config, t.target, newContext); } - protected BitSet getConflictingAlts(ATNConfigSet configs) { + /** + * Gets a {@link BitSet} containing the alternatives in {@code configs} + * which are part of one or more conflicting alternative subsets. + * + * @param configs The {@link ATNConfigSet} to analyze. + * @return The alternatives in {@code configs} which are part of one or more + * conflicting alternative subsets. If {@code configs} does not contain any + * conflicting subsets, this method returns an empty {@link BitSet}. + */ + @NotNull + protected BitSet getConflictingAlts(@NotNull ATNConfigSet configs) { Collection altsets = PredictionMode.getConflictingAltSubsets(configs); return PredictionMode.getAlts(altsets); } diff --git a/runtime/Java/src/org/antlr/v4/runtime/atn/PredictionMode.java b/runtime/Java/src/org/antlr/v4/runtime/atn/PredictionMode.java index 15b25f4d0..3c17f052f 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/atn/PredictionMode.java +++ b/runtime/Java/src/org/antlr/v4/runtime/atn/PredictionMode.java @@ -556,7 +556,7 @@ public enum PredictionMode { * */ @NotNull - public static Collection getConflictingAltSubsets(ATNConfigSet configs) { + public static Collection getConflictingAltSubsets(@NotNull ATNConfigSet configs) { AltAndContextMap configToAlts = new AltAndContextMap(); for (ATNConfig c : configs) { BitSet alts = configToAlts.get(c);