diff options
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java index 9914b0c991..a575dee029 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java @@ -102,27 +102,34 @@ public class PlotCommit<L extends PlotLane> extends RevCommit { private static PlotLane[] addLane(PlotLane l, PlotLane[] lanes) { final int cnt = lanes.length; - if (cnt == 0) + switch (cnt) { + case 0: lanes = new PlotLane[] { l }; - else if (cnt == 1) + break; + case 1: lanes = new PlotLane[] { lanes[0], l }; - else { + break; + default: final PlotLane[] n = new PlotLane[cnt + 1]; System.arraycopy(lanes, 0, n, 0, cnt); n[cnt] = l; lanes = n; + break; } return lanes; } void addChild(PlotCommit c) { final int cnt = children.length; - if (cnt == 0) + switch (cnt) { + case 0: children = new PlotCommit[] { c }; - else if (cnt == 1) { + break; + case 1: if (!c.getId().equals(children[0].getId())) children = new PlotCommit[] { children[0], c }; - } else { + break; + default: for (PlotCommit pc : children) if (c.getId().equals(pc.getId())) return; @@ -130,6 +137,7 @@ public class PlotCommit<L extends PlotLane> extends RevCommit { System.arraycopy(children, 0, n, 0, cnt); n[cnt] = c; children = n; + break; } } |