1 package persistence.antlr.debug; 2 3 public class InputBufferEvent extends Event { 4 char c; 5 int lookaheadAmount; public static final int CONSUME = 0; 7 public static final int LA = 1; 8 public static final int MARK = 2; 9 public static final int REWIND = 3; 10 11 12 16 public InputBufferEvent(Object source) { 17 super(source); 18 } 19 23 public InputBufferEvent(Object source, int type, char c, int lookaheadAmount) { 24 super(source); 25 setValues(type, c, lookaheadAmount); 26 } 27 public char getChar() { 28 return c; 29 } 30 public int getLookaheadAmount() { 31 return lookaheadAmount; 32 } 33 void setChar(char c) { 34 this.c = c; 35 } 36 void setLookaheadAmount(int la) { 37 this.lookaheadAmount = la; 38 } 39 40 void setValues(int type, char c, int la) { 41 super.setValues(type); 42 setChar(c); 43 setLookaheadAmount(la); 44 } 45 public String toString() { 46 return "CharBufferEvent [" + 47 (getType()==CONSUME?"CONSUME, ":"LA, ")+ 48 getChar() + "," + getLookaheadAmount() + "]"; 49 } 50 } 51 | Popular Tags |