Add utility method ATNConfigSet.getAlts

This commit is contained in:
Sam Harwell 2014-05-31 18:20:06 -05:00
parent f3fcf5a712
commit 27ce016d3d
1 changed files with 15 additions and 0 deletions

View File

@ -194,6 +194,21 @@ public class ATNConfigSet implements Set<ATNConfig> {
return states;
}
/**
* Gets the complete set of represented alternatives for the configuration
* set.
*
* @return the set of represented alternatives in this configuration set
*/
@NotNull
public BitSet getAlts() {
BitSet alts = new BitSet();
for (ATNConfig config : configs) {
alts.set(config.alt);
}
return alts;
}
public List<SemanticContext> getPredicates() {
List<SemanticContext> preds = new ArrayList<SemanticContext>();
for (ATNConfig c : configs) {