comparison dwtx/jface/text/projection/Segment.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, 2008 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.projection.Segment;
14
15 import dwt.dwthelper.utils;
16
17 import dwtx.jface.text.Position;
18
19
20 /**
21 * Internal class. Do not use. Only public for testing purposes.
22 * <p>
23 * A segment is the image of a master document fragment in a projection
24 * document.
25 *
26 * @since 3.0
27 * @noinstantiate This class is not intended to be instantiated by clients.
28 * @noextend This class is not intended to be subclassed by clients.
29 */
30 public class Segment : Position {
31
32 /** The corresponding fragment for this segment. */
33 public Fragment fragment;
34 /** A flag indicating that the segment updater should stretch this segment when a change happens at its boundaries. */
35 public bool isMarkedForStretch;
36 /** A flag indicating that the segment updater should shift this segment when a change happens at its boundaries. */
37 public bool isMarkedForShift;
38
39 /**
40 * Creates a new segment covering the given range.
41 *
42 * @param offset the offset of the segment
43 * @param length the length of the segment
44 */
45 public Segment(int offset, int length) {
46 super(offset, length);
47 }
48
49 /**
50 * Sets the stretching flag.
51 */
52 public void markForStretch() {
53 isMarkedForStretch= true;
54 }
55
56 /**
57 * Returns <code>true</code> if the stretching flag is set, <code>false</code> otherwise.
58 * @return <code>true</code> if the stretching flag is set, <code>false</code> otherwise
59 */
60 public bool isMarkedForStretch() {
61 return isMarkedForStretch;
62 }
63
64 /**
65 * Sets the shifting flag.
66 */
67 public void markForShift() {
68 isMarkedForShift= true;
69 }
70
71 /**
72 * Returns <code>true</code> if the shifting flag is set, <code>false</code> otherwise.
73 * @return <code>true</code> if the shifting flag is set, <code>false</code> otherwise
74 */
75 public bool isMarkedForShift() {
76 return isMarkedForShift;
77 }
78
79 /**
80 * Clears the shifting and the stretching flag.
81 */
82 public void clearMark() {
83 isMarkedForStretch= false;
84 isMarkedForShift= false;
85 }
86 }