001 /**
002 *
003 * Copyright 2005 Jeremy Rayner
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 *
017 **/
018
019 package org.codehaus.groovy.antlr;
020
021 /**
022 * An object representing a line and column position
023 *
024 * @author <a href="mailto:groovy@ross-rayner.com">Jeremy Rayner</a>
025 * @version $Revision: 1.1 $
026 */
027 public class LineColumn {
028 private int line;
029 private int column;
030
031 public LineColumn(int line, int column) {
032 this.line = line;
033 this.column = column;
034 }
035
036 public int getLine() {
037 return line;
038 }
039
040 public int getColumn() {
041 return column;
042 }
043
044 public boolean equals(Object that) {
045 if (this == that) return true;
046 if (that == null || getClass() != that.getClass()) return false;
047
048 final LineColumn lineColumn = (LineColumn) that;
049
050 if (column != lineColumn.column) return false;
051 if (line != lineColumn.line) return false;
052
053 return true;
054 }
055
056 public int hashCode() {
057 int result;
058 result = line;
059 result = 29 * result + column;
060 return result;
061 }
062
063 public String toString() {
064 return "[" + line + "," + column + "]";
065 }
066 }