KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > Line


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  *******************************************************************************/

11 package org.eclipse.jface.text;
12
13
14 /**
15  * Describes a line as a particular number of characters beginning at
16  * a particular offset, consisting of a particular number of characters,
17  * and being closed with a particular line delimiter.
18  */

19 final class Line implements IRegion {
20
21     /** The offset of the line */
22     public int offset;
23     /** The length of the line */
24     public int length;
25     /** The delimiter of this line */
26     public final String JavaDoc delimiter;
27
28     /**
29      * Creates a new Line.
30      *
31      * @param offset the offset of the line
32      * @param end the last including character offset of the line
33      * @param delimiter the line's delimiter
34      */

35     public Line(int offset, int end, String JavaDoc delimiter) {
36         this.offset= offset;
37         this.length= (end - offset) +1;
38         this.delimiter= delimiter;
39     }
40
41     /**
42      * Creates a new Line.
43      *
44      * @param offset the offset of the line
45      * @param length the length of the line
46      */

47     public Line(int offset, int length) {
48         this.offset= offset;
49         this.length= length;
50         this.delimiter= null;
51     }
52
53     /*
54      * @see org.eclipse.jface.text.IRegion#getOffset()
55      */

56     public int getOffset() {
57         return offset;
58     }
59
60     /*
61      * @see org.eclipse.jface.text.IRegion#getLength()
62      */

63     public int getLength() {
64         return length;
65     }
66 }
67
68
69
Popular Tags