blob: 6ff1c072920c8a3790229c0391b9c5c4c7eeaf6d [file] [log] [blame]
Stuart McCulloch39cc9ac2012-07-16 13:43:38 +00001package aQute.bnd.properties;
Stuart McCullochd4826102012-06-26 16:34:24 +00002
3/**
4 * Describes a line as a particular number of characters beginning at a
5 * particular offset, consisting of a particular number of characters, and being
6 * closed with a particular line delimiter.
7 */
8final class Line implements IRegion {
9
10 /** The offset of the line */
11 public int offset;
12 /** The length of the line */
13 public int length;
14 /** The delimiter of this line */
15 public final String delimiter;
16
17 /**
18 * Creates a new Line.
19 *
20 * @param offset
21 * the offset of the line
22 * @param end
23 * the last including character offset of the line
24 * @param delimiter
25 * the line's delimiter
26 */
27 public Line(int offset, int end, String delimiter) {
28 this.offset = offset;
29 this.length = (end - offset) + 1;
30 this.delimiter = delimiter;
31 }
32
33 /**
34 * Creates a new Line.
35 *
36 * @param offset
37 * the offset of the line
38 * @param length
39 * the length of the line
40 */
41 public Line(int offset, int length) {
42 this.offset = offset;
43 this.length = length;
44 this.delimiter = null;
45 }
46
47 /*
48 * @see org.eclipse.jface.text.IRegion#getOffset()
49 */
50 public int getOffset() {
51 return offset;
52 }
53
54 /*
55 * @see org.eclipse.jface.text.IRegion#getLength()
56 */
57 public int getLength() {
58 return length;
59 }
60}