comparison dwtx/jface/text/Line.d @ 129:eb30df5ca28b

Added JFace Text sources
author Frank Benoit <benoit@tionex.de>
date Sat, 23 Aug 2008 19:10:48 +0200
parents
children c4fb132a086c
comparison
equal deleted inserted replaced
128:8df1d4193877 129:eb30df5ca28b
1 /*******************************************************************************
2 * Copyright (c) 2000, 2006 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/
13 module dwtx.jface.text.Line;
14
15 import dwt.dwthelper.utils;
16
17
18 /**
19 * Describes a line as a particular number of characters beginning at
20 * a particular offset, consisting of a particular number of characters,
21 * and being closed with a particular line delimiter.
22 */
23 final class Line : IRegion {
24
25 /** The offset of the line */
26 public int offset;
27 /** The length of the line */
28 public int length;
29 /** The delimiter of this line */
30 public final String delimiter;
31
32 /**
33 * Creates a new Line.
34 *
35 * @param offset the offset of the line
36 * @param end the last including character offset of the line
37 * @param delimiter the line's delimiter
38 */
39 public Line(int offset, int end, String delimiter) {
40 this.offset= offset;
41 this.length= (end - offset) +1;
42 this.delimiter= delimiter;
43 }
44
45 /**
46 * Creates a new Line.
47 *
48 * @param offset the offset of the line
49 * @param length the length of the line
50 */
51 public Line(int offset, int length) {
52 this.offset= offset;
53 this.length= length;
54 this.delimiter= null;
55 }
56
57 /*
58 * @see dwtx.jface.text.IRegion#getOffset()
59 */
60 public int getOffset() {
61 return offset;
62 }
63
64 /*
65 * @see dwtx.jface.text.IRegion#getLength()
66 */
67 public int getLength() {
68 return length;
69 }
70 }
71
72