Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Token |
|
| 1.0;1 |
1 | package org.apache.torque.engine.sql; | |
2 | ||
3 | /* | |
4 | * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE | |
5 | * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file | |
6 | * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the | |
7 | * License. You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | |
12 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
13 | * specific language governing permissions and limitations under the License. | |
14 | */ | |
15 | ||
16 | /** | |
17 | * A single token returned by SQLScanner. This class is used internally by SQLScanner and you should probably never need | |
18 | * to create objects of this class unless you are working on SQLScanner. | |
19 | * | |
20 | * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a> | |
21 | * @version $Id: Token.java,v 1.1 2007-10-21 07:57:27 abyrne Exp $ | |
22 | */ | |
23 | ||
24 | public class Token { | |
25 | /** string representation */ | |
26 | private String str; | |
27 | /** line number */ | |
28 | private int line; | |
29 | /** column number */ | |
30 | private int col; | |
31 | ||
32 | /** | |
33 | * Creates a new token without positioning. | |
34 | * | |
35 | * @param str | |
36 | * string representation | |
37 | */ | |
38 | public Token(String str) { | |
39 | 0 | this(str, 0, 0); |
40 | 0 | } |
41 | ||
42 | /** | |
43 | * Creates a new token with positioning settings. | |
44 | * | |
45 | * @param str | |
46 | * string representation | |
47 | * @param line | |
48 | * line number | |
49 | * @param col | |
50 | * column number | |
51 | */ | |
52 | 0 | public Token(String str, int line, int col) { |
53 | 0 | this.str = str; |
54 | 0 | this.line = line; |
55 | 0 | this.col = col; |
56 | 0 | } |
57 | ||
58 | /** | |
59 | * Returns the string representation of this token. | |
60 | * | |
61 | * @return the string representation | |
62 | */ | |
63 | public String getStr() { | |
64 | 0 | return str; |
65 | } | |
66 | ||
67 | /** | |
68 | * Get the line number of this token. | |
69 | * | |
70 | * @return the line number | |
71 | */ | |
72 | public int getLine() { | |
73 | 0 | return line; |
74 | } | |
75 | ||
76 | /** | |
77 | * Get the column number of this token. | |
78 | * | |
79 | * @return the column number | |
80 | */ | |
81 | public int getCol() { | |
82 | 0 | return col; |
83 | } | |
84 | ||
85 | /** | |
86 | * The same as getStr() | |
87 | * | |
88 | * @return the string representation | |
89 | */ | |
90 | public String toString() { | |
91 | 0 | return str; |
92 | } | |
93 | } |