Mercurial > projects > dwt-addons
comparison dwtx/jface/text/revisions/RevisionRange.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) 2006, 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.revisions.RevisionRange; | |
14 | |
15 import dwt.dwthelper.utils; | |
16 | |
17 | |
18 import dwtx.core.runtime.Assert; | |
19 import dwtx.jface.text.source.ILineRange; | |
20 | |
21 | |
22 /** | |
23 * An unmodifiable line range that belongs to a {@link Revision}. | |
24 * | |
25 * @since 3.3 | |
26 * @noinstantiate This class is not intended to be instantiated by clients. | |
27 */ | |
28 public final class RevisionRange : ILineRange { | |
29 private final Revision fRevision; | |
30 private final int fStartLine; | |
31 private final int fNumberOfLines; | |
32 | |
33 RevisionRange(Revision revision, ILineRange range) { | |
34 Assert.isLegal(revision !is null); | |
35 fRevision= revision; | |
36 fStartLine= range.getStartLine(); | |
37 fNumberOfLines= range.getNumberOfLines(); | |
38 } | |
39 | |
40 /** | |
41 * Returns the revision that this range belongs to. | |
42 * | |
43 * @return the revision that this range belongs to | |
44 */ | |
45 public Revision getRevision() { | |
46 return fRevision; | |
47 } | |
48 | |
49 /* | |
50 * @see dwtx.jface.text.source.ILineRange#getStartLine() | |
51 */ | |
52 public int getStartLine() { | |
53 return fStartLine; | |
54 } | |
55 | |
56 /* | |
57 * @see dwtx.jface.text.source.ILineRange#getNumberOfLines() | |
58 */ | |
59 public int getNumberOfLines() { | |
60 return fNumberOfLines; | |
61 } | |
62 | |
63 /* | |
64 * @see java.lang.Object#toString() | |
65 */ | |
66 public String toString() { | |
67 return "RevisionRange [" + fRevision.toString() + ", [" + getStartLine() + "+" + getNumberOfLines() + ")]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ | |
68 } | |
69 } |