Merge pull request #586 from sharwell/getalts

Add utility method ATNConfigSet.getAlts
This commit is contained in:
Terence Parr 2014-05-31 16:48:29 -07:00
commit 63fb71cc9f
1 changed files with 15 additions and 0 deletions

View File

@ -194,6 +194,21 @@ public class ATNConfigSet implements Set<ATNConfig> {
return states; 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() { public List<SemanticContext> getPredicates() {
List<SemanticContext> preds = new ArrayList<SemanticContext>(); List<SemanticContext> preds = new ArrayList<SemanticContext>();
for (ATNConfig c : configs) { for (ATNConfig c : configs) {