01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.texteditor.quickdiff.compare.rangedifferencer;
11:
12: /**
13: * @since 3.0
14: */
15: /* package */class LinkedRangeDifference extends RangeDifference {
16:
17: static final int INSERT = 0;
18: static final int DELETE = 1;
19:
20: LinkedRangeDifference fNext;
21:
22: /**
23: * Creates a LinkedRangeDifference an initializes it to the error state
24: */
25: LinkedRangeDifference() {
26: super (ERROR);
27: fNext = null;
28: }
29:
30: /**
31: * Constructs and links a LinkeRangeDifference to another LinkedRangeDifference
32: *
33: * @param next the next difference
34: * @param operation the operation code. Either {@link #INSERT} or {@link #DELETE}
35: */
36: LinkedRangeDifference(LinkedRangeDifference next, int operation) {
37: super (operation);
38: fNext = next;
39: }
40:
41: /**
42: * Returns the next difference.
43: *
44: * @return the next difference
45: */
46: LinkedRangeDifference getNext() {
47: return fNext;
48: }
49:
50: /**
51: * Returns whether this difference represents a delete operation.
52: *
53: * @return <code>true</code> if this difference represents a delete operation
54: */
55: boolean isDelete() {
56: return kind() == DELETE;
57: }
58:
59: /**
60: * Returns whether this difference represents an insert operation.
61: *
62: * @return <code>true</code> if this difference represents an insert operation
63: */
64: boolean isInsert() {
65: return kind() == INSERT;
66: }
67:
68: /**
69: * Sets the next difference of this <code>LinkedRangeDifference</code>
70: *
71: * @param next the next difference
72: */
73: void setNext(LinkedRangeDifference next) {
74: fNext = next;
75: }
76: }
|