Skip to main content
summaryrefslogtreecommitdiffstats
blob: abec44689c885bad04b092409c4e26776cc14632 (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
/*******************************************************************************
 * Copyright (c) 2000, 2003 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jface.text.source;


/**
 * Describes the change state of one line, which consists of the state of the line itself, which
 * can be <code>UNCHANGED</code>, <code>CHANGED</code> or <code>ADDED</code>, and the number of 
 * deleted lines before and after this line. 
 * 
 * @since 3.0
 */
public interface ILineDiffInfo {
	
	/** Denotes an unchanged line. */
	static final int UNCHANGED= 0;

	/** Denotes an added line. */
	static final int ADDED= 1;

	/** Denotes a changed line. */
	static final int CHANGED= 2;

	/**
	 * Returns the number of deleted lines after this line.
	 * 
	 * @return the number of lines after this line.
	 */
	int getRemovedLinesBelow();
	
	/**
	 * Returns the number of deleted lines before this line.
	 * 
	 * @return the number of lines before this line.
	 */
	int getRemovedLinesAbove();
	
	/**
	 * Returns the type of this line, one out of <code>UNCHANGED</code>, <code>CHANGED</code> or
	 * <code>ADDED</code>.
	 * 
	 * @return the type of this line.
	 */
	int getChangeType();
	
	/**
	 * Returns whether this line has any changes (to itself, or any deletions before or after it).
	 * 
	 * @return <code>true</code>, if the line's state (as returned by <code>getType</code>) is
	 * either <code>CHANGED</code> or <code>ADDED</code> or either of <code>getRemovedLinesBelow</code>
	 * and <code>getRemovedLinesAbove</code> would return a number &gt; 0
	 */
	boolean hasChanges();
	
	/**
	 * Returns the original text of this changed region
	 * 
	 * @return the original text of this changed region, including any deleted lines. The returned
	 * value and its elements may not be <code>null/code>, it may however be of zero length
	 */
	String[] getOriginalText();
}

Back to the top