01: package persistence.antlr.debug;
02:
03: public class TraceEvent extends GuessingEvent {
04: private int ruleNum;
05: private int data;
06: public static int ENTER = 0;
07: public static int EXIT = 1;
08: public static int DONE_PARSING = 2;
09:
10: public TraceEvent(Object source) {
11: super (source);
12: }
13:
14: public TraceEvent(Object source, int type, int ruleNum,
15: int guessing, int data) {
16: super (source);
17: setValues(type, ruleNum, guessing, data);
18: }
19:
20: public int getData() {
21: return data;
22: }
23:
24: public int getRuleNum() {
25: return ruleNum;
26: }
27:
28: void setData(int data) {
29: this .data = data;
30: }
31:
32: void setRuleNum(int ruleNum) {
33: this .ruleNum = ruleNum;
34: }
35:
36: /** This should NOT be called from anyone other than ParserEventSupport! */
37: void setValues(int type, int ruleNum, int guessing, int data) {
38: super .setValues(type, guessing);
39: setRuleNum(ruleNum);
40: setData(data);
41: }
42:
43: public String toString() {
44: return "ParserTraceEvent ["
45: + (getType() == ENTER ? "enter," : "exit,")
46: + getRuleNum() + "," + getGuessing() + "]";
47: }
48: }
|