KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > texteditor > quickdiff > compare > rangedifferencer > LinkedRangeDifference


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.ui.internal.texteditor.quickdiff.compare.rangedifferencer;
12
13 /**
14  * @since 3.0
15  */

16 /* package */ class LinkedRangeDifference extends RangeDifference {
17
18     static final int INSERT= 0;
19     static final int DELETE= 1;
20
21     LinkedRangeDifference fNext;
22
23     /**
24      * Creates a LinkedRangeDifference an initializes it to the error state
25      */

26     LinkedRangeDifference() {
27         super(ERROR);
28         fNext= null;
29     }
30
31     /**
32      * Constructs and links a LinkeRangeDifference to another LinkedRangeDifference
33      *
34      * @param next the next difference
35      * @param operation the operation code. Either {@link #INSERT} or {@link #DELETE}
36      */

37     LinkedRangeDifference(LinkedRangeDifference next, int operation) {
38         super(operation);
39         fNext= next;
40     }
41
42     /**
43      * Returns the next difference.
44      *
45      * @return the next difference
46      */

47     LinkedRangeDifference getNext() {
48         return fNext;
49     }
50
51     /**
52      * Returns whether this difference represents a delete operation.
53      *
54      * @return <code>true</code> if this difference represents a delete operation
55      */

56     boolean isDelete() {
57         return kind() == DELETE;
58     }
59
60     /**
61      * Returns whether this difference represents an insert operation.
62      *
63      * @return <code>true</code> if this difference represents an insert operation
64      */

65     boolean isInsert() {
66         return kind() == INSERT;
67     }
68
69     /**
70      * Sets the next difference of this <code>LinkedRangeDifference</code>
71      *
72      * @param next the next difference
73      */

74     void setNext(LinkedRangeDifference next) {
75         fNext= next;
76     }
77 }
78
Popular Tags