01: package com.jclark.xml.tok;
02:
03: /**
04: * Represents a position in an entity.
05: * A position can be modified by <code>Encoding.movePosition</code>.
06: * @see Encoding#movePosition
07: * @version $Revision: 1.2 $ $Date: 1998/02/17 04:24:15 $
08: */
09: public final class Position implements Cloneable {
10: int lineNumber;
11: int columnNumber;
12:
13: /**
14: * Creates a position for the start of an entity: the line number is
15: * 1 and the column number is 0.
16: */
17: public Position() {
18: lineNumber = 1;
19: columnNumber = 0;
20: }
21:
22: /**
23: * Returns the line number.
24: * The first line number is 1.
25: */
26: public int getLineNumber() {
27: return lineNumber;
28: }
29:
30: /**
31: * Returns the column number.
32: * The first column number is 0.
33: * A tab character is not treated specially.
34: */
35: public int getColumnNumber() {
36: return columnNumber;
37: }
38:
39: /**
40: * Returns a copy of this position.
41: */
42: public Object clone() {
43: try {
44: return super .clone();
45: } catch (CloneNotSupportedException e) {
46: throw new InternalError();
47: }
48: }
49: }
|