KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > antlr > works > debugger > events > DBEventFactory


1 package org.antlr.works.debugger.events;
2
3 import org.antlr.runtime.Token;
4 /*
5
6 [The "BSD licence"]
7 Copyright (c) 2005-2006 Jean Bovet
8 All rights reserved.
9
10 Redistribution and use in source and binary forms, with or without
11 modification, are permitted provided that the following conditions
12 are met:
13
14 1. Redistributions of source code must retain the above copyright
15 notice, this list of conditions and the following disclaimer.
16 2. Redistributions in binary form must reproduce the above copyright
17 notice, this list of conditions and the following disclaimer in the
18 documentation and/or other materials provided with the distribution.
19 3. The name of the author may not be used to endorse or promote products
20 derived from this software without specific prior written permission.
21
22 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33 */

34
35 public class DBEventFactory {
36
37     public static DBEvent createLocation(int line, int pos) {
38         return new DBEventLocation(line, pos);
39     }
40
41     public static DBEvent createConsumeToken(Token token) {
42         return new DBEventConsumeToken(token);
43     }
44
45     public static DBEvent createConsumeHiddenToken(Token token) {
46         return new DBEventConsumeHiddenToken(token);
47     }
48
49     public static DBEvent createLT(int i, Token token) {
50         return new DBEventLT(i, token);
51     }
52
53     public static DBEvent createEnterRule(String JavaDoc name) {
54         return new DBEventEnterRule(name);
55     }
56
57     public static DBEvent createExitRule(String JavaDoc name) {
58         return new DBEventExitRule(name);
59     }
60
61     public static DBEvent createEnterSubRule(int decision) {
62         return new DBEventEnterSubRule(decision);
63     }
64
65     public static DBEvent createExitSubRule(int decision) {
66         return new DBEventExitSubRule(decision);
67     }
68
69     public static DBEvent createEnterDecision(int decision) {
70         return new DBEventEnterDecision(decision);
71     }
72
73     public static DBEvent createExitDecision(int decision) {
74         return new DBEventExitDecision(decision);
75     }
76
77     public static DBEvent createEnterAlt(int alt) {
78         return new DBEventEnterAlt(alt);
79     }
80
81     public static DBEvent createMark(int i) {
82         return new DBEventMark(i);
83     }
84
85     public static DBEvent createRewind(int i) {
86         return new DBEventRewind(i);
87     }
88
89     public static DBEvent createRewind() {
90         return new DBEventRewind();
91     }
92
93     public static DBEvent createBeginBacktrack(int level) {
94         return new DBEventBeginBacktrack(level);
95     }
96
97     public static DBEvent createEndBacktrack(int level, boolean successful) {
98         return new DBEventEndBacktrack(level, successful);
99     }
100
101     public static DBEvent createRecognitionException(Exception JavaDoc e) {
102         return new DBEventRecognitionException(e);
103     }
104
105     public static DBEvent createBeginResync() {
106         return new DBEvent(DBEvent.BEGIN_RESYNC);
107     }
108
109     public static DBEvent createEndResync() {
110         return new DBEvent(DBEvent.END_RESYNC);
111     }
112
113     public static DBEvent createCommence() {
114         return new DBEvent(DBEvent.COMMENCE);
115     }
116
117     public static DBEvent createTerminate() {
118         return new DBEvent(DBEvent.TERMINATE);
119     }
120
121     public static DBEvent createNilNode(int id) {
122         return new DBEventNilNode(id);
123     }
124
125     public static DBEvent createCreateNode(int id, int tokenIndex) {
126         return new DBEventCreateNode(id, tokenIndex);
127     }
128
129     public static DBEvent createCreateNode(int id, String JavaDoc text, int type) {
130         return new DBEventCreateNode(id, text, type);
131     }
132
133     public static DBEvent createBecomeRoot(int newRootID, int oldRootID) {
134         return new DBEventBecomeRoot(newRootID, oldRootID);
135     }
136
137     public static DBEvent createAddChild(int rootID, int childID) {
138         return new DBEventAddChild(rootID, childID);
139     }
140
141     public static DBEvent createSetTokenBoundaries(int id, int startIndex, int stopIndex) {
142         return new DBEventSetTokenBoundaries(id, startIndex, stopIndex);
143     }
144
145 }
146
Popular Tags