KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > torque > engine > sql > Token


1 package org.apache.torque.engine.sql;
2
3 /*
4  * Copyright 2001,2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 /**
20  * A single token returned by SQLScanner. This class is used internally
21  * by SQLScanner and you should probably never need to create objects
22  * of this class unless you are working on SQLScanner.
23  *
24  * @author <a HREF="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
25  * @version $Id: Token.java,v 1.3 2004/02/22 06:27:20 jmcnally Exp $
26  */

27
28 public class Token
29 {
30     /** string representation */
31     private String JavaDoc str;
32     /** line number */
33     private int line;
34     /** column number */
35     private int col;
36
37     /**
38      * Creates a new token without positioning.
39      *
40      * @param str string representation
41      */

42     public Token(String JavaDoc str)
43     {
44         this (str, 0, 0);
45     }
46
47     /**
48      * Creates a new token with positioning settings.
49      *
50      * @param str string representation
51      * @param line line number
52      * @param col column number
53      */

54     public Token(String JavaDoc str, int line, int col)
55     {
56         this.str = str;
57         this.line = line;
58         this.col = col;
59     }
60
61     /**
62      * Returns the string representation of this token.
63      *
64      * @return the string representation
65      */

66     public String JavaDoc getStr()
67     {
68         return str;
69     }
70
71     /**
72      * Get the line number of this token.
73      *
74      * @return the line number
75      */

76     public int getLine()
77     {
78         return line;
79     }
80
81     /**
82      * Get the column number of this token.
83      *
84      * @return the column number
85      */

86     public int getCol()
87     {
88         return col;
89     }
90
91     /**
92      * The same as getStr()
93      *
94      * @return the string representation
95      */

96     public String JavaDoc toString()
97     {
98         return str;
99     }
100 }
101
Popular Tags