KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > revisions > RevisionRange


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 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.revisions;
12
13 import org.eclipse.core.runtime.Assert;
14
15 import org.eclipse.jface.text.source.ILineRange;
16
17
18 /**
19  * An unmodifiable line range that belongs to a {@link Revision}.
20  *
21  * @since 3.3
22  */

23 public final class RevisionRange implements ILineRange {
24     private final Revision fRevision;
25     private final int fStartLine;
26     private final int fNumberOfLines;
27
28     RevisionRange(Revision revision, ILineRange range) {
29         Assert.isLegal(revision != null);
30         fRevision= revision;
31         fStartLine= range.getStartLine();
32         fNumberOfLines= range.getNumberOfLines();
33     }
34
35     /**
36      * Returns the revision that this range belongs to.
37      *
38      * @return the revision that this range belongs to
39      */

40     public Revision getRevision() {
41         return fRevision;
42     }
43
44     /*
45      * @see org.eclipse.jface.text.source.ILineRange#getStartLine()
46      */

47     public int getStartLine() {
48         return fStartLine;
49     }
50
51     /*
52      * @see org.eclipse.jface.text.source.ILineRange#getNumberOfLines()
53      */

54     public int getNumberOfLines() {
55         return fNumberOfLines;
56     }
57
58     /*
59      * @see java.lang.Object#toString()
60      */

61     public String JavaDoc toString() {
62         return "RevisionRange [" + fRevision.toString() + ", [" + getStartLine() + "+" + getNumberOfLines() + ")]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
63
}
64 }
65
Popular Tags