KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > antlr > works > debugger > tree > DBTreeToken


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

35
36 public class DBTreeToken implements Token {
37     public ProxyTree tree;
38     public int ID;
39
40     public DBTreeToken(ProxyTree tree) {
41         this.tree = tree;
42         this.ID = tree.ID;
43     }
44
45     public String JavaDoc getText() {
46         return tree.text;
47     }
48
49     public void setText(String JavaDoc text) {
50         tree.text = text;
51     }
52
53     public int getType() {
54         return tree.type;
55     }
56
57     public void setType(int ttype) {
58         tree.type = ttype;
59     }
60
61     public int getLine() {
62         return tree.line;
63     }
64
65     public void setLine(int line) {
66         tree.line = line;
67     }
68
69     public int getCharPositionInLine() {
70         return tree.charPos;
71     }
72
73     public void setCharPositionInLine(int pos) {
74         tree.charPos = pos;
75     }
76
77     public int getChannel() {
78         return 0;
79     }
80
81     public void setChannel(int channel) {
82     }
83
84     public int getTokenIndex() {
85         return tree.tokenIndex;
86     }
87
88     public void setTokenIndex(int index) {
89         tree.tokenIndex = index;
90     }
91
92     public String JavaDoc toString() {
93         String JavaDoc tokenIndexS = tree.tokenIndex>=0?(",@"+tree.tokenIndex):"";
94         String JavaDoc pos = tree.line>0?(","+tree.line+":"+tree.charPos):"";
95         return "["+tree.text+"/, <"+tree.type+">, "+tree.ID+pos+tokenIndexS+"]";
96     }
97 }
98
Popular Tags