001 package org.apache.torque.engine.sql; 002 003 /* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022 /** 023 * A single token returned by SQLScanner. This class is used internally 024 * by SQLScanner and you should probably never need to create objects 025 * of this class unless you are working on SQLScanner. 026 * 027 * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a> 028 * @version $Id: Token.java,v 1.1 2007-10-21 07:57:27 abyrne Exp $ 029 */ 030 031 public class Token 032 { 033 /** string representation */ 034 private String str; 035 /** line number */ 036 private int line; 037 /** column number */ 038 private int col; 039 040 /** 041 * Creates a new token without positioning. 042 * 043 * @param str string representation 044 */ 045 public Token(String str) 046 { 047 this (str, 0, 0); 048 } 049 050 /** 051 * Creates a new token with positioning settings. 052 * 053 * @param str string representation 054 * @param line line number 055 * @param col column number 056 */ 057 public Token(String str, int line, int col) 058 { 059 this.str = str; 060 this.line = line; 061 this.col = col; 062 } 063 064 /** 065 * Returns the string representation of this token. 066 * 067 * @return the string representation 068 */ 069 public String getStr() 070 { 071 return str; 072 } 073 074 /** 075 * Get the line number of this token. 076 * 077 * @return the line number 078 */ 079 public int getLine() 080 { 081 return line; 082 } 083 084 /** 085 * Get the column number of this token. 086 * 087 * @return the column number 088 */ 089 public int getCol() 090 { 091 return col; 092 } 093 094 /** 095 * The same as getStr() 096 * 097 * @return the string representation 098 */ 099 public String toString() 100 { 101 return str; 102 } 103 }