Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Aniszczyk2010-09-07 02:33:09 +0000
committerCode Review2010-09-07 02:33:09 +0000
commit18aadc826dae7c6308c2a6c68d48ab75c8dd9b6d (patch)
treedd8507709b654d3cf88adaf90fff68267eb5fca4
parentba984ba2e0a66a82952bca31c9deb5b9053563e8 (diff)
parent6938f99ef3338ec51b528800caf561dad30d9cec (diff)
downloadjgit-18aadc826dae7c6308c2a6c68d48ab75c8dd9b6d.tar.gz
jgit-18aadc826dae7c6308c2a6c68d48ab75c8dd9b6d.tar.xz
jgit-18aadc826dae7c6308c2a6c68d48ab75c8dd9b6d.zip
Merge "Reduce compares in Edit.getType"
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java
index 4a5de57b07..f0c7cdac5f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java
@@ -121,13 +121,18 @@ public class Edit {
/** @return the type of this region */
public final Type getType() {
- if (beginA == endA && beginB < endB)
- return Type.INSERT;
- if (beginA < endA && beginB == endB)
- return Type.DELETE;
- if (beginA == endA && beginB == endB)
- return Type.EMPTY;
- return Type.REPLACE;
+ if (beginA < endA) {
+ if (beginB < endB)
+ return Type.REPLACE;
+ else /* if (beginB == endB) */
+ return Type.DELETE;
+
+ } else /* if (beginA == endA) */{
+ if (beginB < endB)
+ return Type.INSERT;
+ else /* if (beginB == endB) */
+ return Type.EMPTY;
+ }
}
/** @return true if the edit is empty (lengths of both a and b is zero). */

Back to the top