KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > groovy > antlr > LineColumn


1 /**
2  *
3  * Copyright 2005 Jeremy Rayner
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * 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
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  **/

18
19 package org.codehaus.groovy.antlr;
20
21 /**
22  * An object representing a line and column position
23  *
24  * @author <a HREF="mailto:groovy@ross-rayner.com">Jeremy Rayner</a>
25  * @version $Revision: 1.1 $
26  */

27 public class LineColumn {
28     private int line;
29     private int column;
30
31     public LineColumn(int line, int column) {
32         this.line = line;
33         this.column = column;
34     }
35
36     public int getLine() {
37         return line;
38     }
39
40     public int getColumn() {
41         return column;
42     }
43
44     public boolean equals(Object JavaDoc that) {
45         if (this == that) return true;
46         if (that == null || getClass() != that.getClass()) return false;
47
48         final LineColumn lineColumn = (LineColumn) that;
49
50         if (column != lineColumn.column) return false;
51         if (line != lineColumn.line) return false;
52
53         return true;
54     }
55
56     public int hashCode() {
57         int result;
58         result = line;
59         result = 29 * result + column;
60         return result;
61     }
62
63     public String JavaDoc toString() {
64         return "[" + line + "," + column + "]";
65     }
66 }
67
Popular Tags