1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.johnzon.core; |
20 | |
|
21 | |
import java.io.Serializable; |
22 | |
|
23 | |
import javax.json.stream.JsonLocation; |
24 | |
|
25 | |
final class JsonLocationImpl implements JsonLocation, Serializable { |
26 | |
|
27 | 1 | public static final JsonLocation UNKNOWN_LOCATION = new JsonLocationImpl(-1, -1, -1); |
28 | |
|
29 | |
private final long lineNumber; |
30 | |
private final long columnNumber; |
31 | |
private final long streamOffset; |
32 | |
|
33 | 1936 | JsonLocationImpl(final long lineNumber, final long columnNumber, final long streamOffset) { |
34 | 1936 | this.lineNumber = lineNumber; |
35 | 1936 | this.columnNumber = columnNumber; |
36 | 1936 | this.streamOffset = streamOffset; |
37 | 1936 | } |
38 | |
|
39 | |
@Override |
40 | |
public long getLineNumber() { |
41 | 28 | return lineNumber; |
42 | |
} |
43 | |
|
44 | |
@Override |
45 | |
public long getColumnNumber() { |
46 | 28 | return columnNumber; |
47 | |
} |
48 | |
|
49 | |
@Override |
50 | |
public long getStreamOffset() { |
51 | 28 | return streamOffset; |
52 | |
} |
53 | |
|
54 | |
@Override |
55 | |
public boolean equals(final Object o) { |
56 | 912 | if (this == o) { |
57 | 0 | return true; |
58 | |
} |
59 | 912 | if (o == null || getClass() != o.getClass()) { |
60 | 0 | return false; |
61 | |
} |
62 | |
|
63 | 912 | final JsonLocationImpl that = JsonLocationImpl.class.cast(o); |
64 | 912 | return columnNumber == that.columnNumber && lineNumber == that.lineNumber && streamOffset == that.streamOffset; |
65 | |
|
66 | |
} |
67 | |
|
68 | |
@Override |
69 | |
public int hashCode() { |
70 | 0 | int result = (int) (lineNumber ^ (lineNumber >>> 32)); |
71 | 0 | result = 31 * result + (int) (columnNumber ^ (columnNumber >>> 32)); |
72 | 0 | result = 31 * result + (int) (streamOffset ^ (streamOffset >>> 32)); |
73 | 0 | return result; |
74 | |
} |
75 | |
|
76 | |
@Override |
77 | |
public String toString() { |
78 | 100 | return "[lineNumber=" + lineNumber + ", columnNumber=" + columnNumber + ", streamOffset=" + streamOffset + "]"; |
79 | |
} |
80 | |
} |