1 package org.apache.torque.engine.sql;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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 239624 2005-08-24 12:18:03Z henning $
26 */
27
28 public class Token
29 {
30 /*** string representation */
31 private String 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 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 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 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 toString()
97 {
98 return str;
99 }
100 }