Added javadocs for recently added methods

This commit is contained in:
Sam Harwell 2013-01-03 02:44:39 -06:00
parent 6c23a96046
commit 90c234895a
2 changed files with 31 additions and 0 deletions

View File

@ -976,6 +976,17 @@ public class ParserATNSimulator extends ATNSimulator {
return reach;
}
/**
* Return a configuration set containing only the configurations from
* {@code configs} which are in a {@link RuleStopState}. If all
* configurations in {@code configs} are already in a rule stop state, this
* method simply returns {@code configs}.
*
* @param configs the configuration set to update
* @return {@code configs} if all configurations in {@code configs} are in a
* rule stop state, otherwise return a new configuration set containing only
* the configurations from {@code configs} which are in a rule stop state
*/
protected ATNConfigSet removeNonRuleStopStates(ATNConfigSet configs) {
if (PredictionMode.onlyRuleStopStates(configs)) {
return configs;

View File

@ -212,6 +212,16 @@ public enum PredictionMode {
return heuristic;
}
/**
* Checks if any configuration in {@code configs} is in a
* {@link RuleStopState}. Configurations meeting this condition have reached
* the end of the decision rule (local context) or end of start rule (full
* context).
*
* @param configs the configuration set to test
* @return {@code true} if any configuration in {@code configs} is in a
* {@link RuleStopState}, otherwise {@code false}
*/
public static boolean hasConfigAtRuleStopState(ATNConfigSet configs) {
for (ATNConfig c : configs) {
if (c.state instanceof RuleStopState) {
@ -222,6 +232,16 @@ public enum PredictionMode {
return false;
}
/**
* Checks if all configurations in {@code configs} are in a
* {@link RuleStopState}. Configurations meeting this condition have reached
* the end of the decision rule (local context) or end of start rule (full
* context).
*
* @param configs the configuration set to test
* @return {@code true} if all configurations in {@code configs} are in a
* {@link RuleStopState}, otherwise {@code false}
*/
public static boolean onlyRuleStopStates(@NotNull ATNConfigSet configs) {
for (ATNConfig config : configs) {
if (!(config.state instanceof RuleStopState)) {