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
21
22 /***
23 * A single token returned by SQLScanner. This class is used internally
24 * by SQLScanner and you should probably never need to create objects
25 * of this class unless you are working on SQLScanner.
26 *
27 * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
28 * @version $Id: Token.java 473814 2006-11-11 22:30:30Z tv $
29 */
30
31 public class Token
32 {
33 /*** string representation */
34 private String str;
35 /*** line number */
36 private int line;
37 /*** column number */
38 private int col;
39
40 /***
41 * Creates a new token without positioning.
42 *
43 * @param str string representation
44 */
45 public Token(String str)
46 {
47 this (str, 0, 0);
48 }
49
50 /***
51 * Creates a new token with positioning settings.
52 *
53 * @param str string representation
54 * @param line line number
55 * @param col column number
56 */
57 public Token(String str, int line, int col)
58 {
59 this.str = str;
60 this.line = line;
61 this.col = col;
62 }
63
64 /***
65 * Returns the string representation of this token.
66 *
67 * @return the string representation
68 */
69 public String getStr()
70 {
71 return str;
72 }
73
74 /***
75 * Get the line number of this token.
76 *
77 * @return the line number
78 */
79 public int getLine()
80 {
81 return line;
82 }
83
84 /***
85 * Get the column number of this token.
86 *
87 * @return the column number
88 */
89 public int getCol()
90 {
91 return col;
92 }
93
94 /***
95 * The same as getStr()
96 *
97 * @return the string representation
98 */
99 public String toString()
100 {
101 return str;
102 }
103 }