01: // This file is part of KeY - Integrated Deductive Software Design
02: // Copyright (C) 2001-2007 Universitaet Karlsruhe, Germany
03: // Universitaet Koblenz-Landau, Germany
04: // Chalmers University of Technology, Sweden
05: //
06: // The KeY system is protected by the GNU General Public License.
07: // See LICENSE.TXT for details.
08: //
09: //
10:
11: package de.uka.ilkd.key.parser;
12:
13: /**
14: * This class represents a location in a file. It consists of a
15: * filename, a line number and a column number. The filename may be
16: * null, if the file is unknown (e.g. standard input). The class is
17: * mainly used for parser exceptions.
18: *
19: * @author Hubert Schmid
20: */
21:
22: public final class Location {
23:
24: /* --- constructors --- */
25:
26: /** @param filename the filename may be null. */
27: public Location(String filename, int line, int column) {
28: this .filename = filename;
29: this .line = line;
30: this .column = column;
31: }
32:
33: /* --- methods --- */
34:
35: /** @return the filename may be null */
36: public String getFilename() {
37: return filename;
38: }
39:
40: public int getLine() {
41: return line;
42: }
43:
44: public int getColumn() {
45: return column;
46: }
47:
48: /** Internal string representation. Do not rely on format! */
49: public String toString() {
50: return "[" + filename + ":" + line + "," + column + "]";
51: }
52:
53: /* --- fields --- */
54:
55: private final String filename;
56:
57: private final int line;
58:
59: private final int column;
60:
61: }
|