blob: 3d47a782103316669208e43851dfc18590bf2da7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.task.util.text;
/**
* The location within an implied multi-line String.
*
* @author hakonhall
*/
//@Immutable
public class TextLocation {
private final int offset;
private final int lineIndex;
private final int columnIndex;
public TextLocation() { this(0, 0, 0); }
public TextLocation(int offset, int lineIndex, int columnIndex) {
this.offset = offset;
this.lineIndex = lineIndex;
this.columnIndex = columnIndex;
}
public int offset() { return offset; }
public int lineIndex() { return lineIndex; }
public int line() { return lineIndex + 1; }
public int columnIndex() { return columnIndex; }
public int column() { return columnIndex + 1; }
public String lineAndColumnText() { return "line " + line() + " and column " + column(); }
}
|