Revert "add counter for stack graph nodes."

This reverts commit 43e73c8da9.
This commit is contained in:
Sam Harwell 2013-04-21 13:11:40 -05:00
parent bc4b530b3b
commit ecf2258380
1 changed files with 0 additions and 21 deletions

View File

@ -30,7 +30,6 @@
package org.antlr.v4.runtime.atn;
import org.antlr.misc.MutableInteger;
import org.antlr.v4.runtime.Recognizer;
import org.antlr.v4.runtime.RuleContext;
import org.antlr.v4.runtime.misc.DoubleKeyMap;
@ -655,26 +654,6 @@ public abstract class PredictionContext implements Iterable<SingletonPredictionC
}
}
public static int countAllContextNodes(PredictionContext context) {
MutableInteger count = new MutableInteger(0);
Map<PredictionContext, PredictionContext> visited =
new IdentityHashMap<PredictionContext, PredictionContext>();
countAllContextNodes_(context, count, visited);
return count.value;
}
public static void countAllContextNodes_(PredictionContext context,
MutableInteger count,
Map<PredictionContext, PredictionContext> visited)
{
if ( context==null || visited.containsKey(context) ) return;
visited.put(context, context);
count.value++;
for (int i = 0; i < context.size(); i++) {
countAllContextNodes_(context.getParent(i), count, visited);
}
}
public String toString(@Nullable Recognizer<?,?> recog) {
return toString();
// return toString(recog, ParserRuleContext.EMPTY);