Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: c47bc42249261ffc55bbbc2f0c0f28b8b9130ba1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*******************************************************************************
 * Copyright (c) 2000, 2008 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.team.core.diff;
import org.eclipse.core.runtime.IPath;
import org.eclipse.team.core.diff.provider.Diff;

/**
 * A diff describes differences between two or more model objects.
 *
 * @see ITwoWayDiff
 * @see IThreeWayDiff
 * @since 3.2
 * @noimplement This interface is not intended to be implemented by clients.
 *              Instead, clients can subclass {@link Diff}.
 */
public interface IDiff {

	/*
	 * ====================================================================
	 * Constants defining diff kinds:
	 * ====================================================================
	 */

	/**
	 * Diff kind constant (bit mask) indicating that the resource has not been changed in
	 * any way.
	 *
	 * @see IDiff#getKind()
	 */
	public static final int NO_CHANGE = 0;

	/**
	 * Diff kind constant (bit mask) indicating that the resource has been
	 * added to its parent. That is, one that appears in the "after" state, not
	 * in the "before" one.
	 *
	 * @see IDiff#getKind()
	 */
	public static final int ADD = 0x1;

	/**
	 * Diff kind constant (bit mask) indicating that the resource has been
	 * removed from its parent. That is, one that appears in the "before" state,
	 * not in the "after" one.
	 *
	 * @see IDiff#getKind()
	 */
	public static final int REMOVE = 0x2;

	/**
	 * Diff kind constant (bit mask) indicating that the resource has been
	 * changed. That is, one that appears in both the "before" and "after"
	 * states.
	 *
	 * @see IDiff#getKind()
	 */
	public static final int CHANGE = 0x4;

	/**
	 * Returns the full, absolute path of the object to which the diff applies
	 * with respect to the model root.
	 * <p>
	 * Note: the returned path never has a trailing separator.
	 * </p>
	 *
	 * @return the full, absolute path of this diff
	 */
	public IPath getPath();

	/**
	 * Returns the kind of this diff. Normally, one of
	 * <code>ADDED</code>, <code>REMOVED</code>, <code>CHANGED</code>.
	 *
	 * @return the kind of this diff
	 * @see IDiff#ADD
	 * @see IDiff#REMOVE
	 * @see IDiff#CHANGE
	 */
	public int getKind();

	/**
	 * Return a string that describes the difference represented by
	 * this node.
	 * @return a string that describes the difference represented by
	 * this node
	 */
	public String toDiffString();
}

Back to the top