From 46df74d6d904586851641b2cf7991d74dc1033f9 Mon Sep 17 00:00:00 2001 From: Sarah Mount Date: Mon, 11 Jun 2018 14:32:25 +0100 Subject: [PATCH] Remove start attribute from ZSTree. This attribute was read from but never mutated. --- .../matchers/optimal/zs/ZsMatcher.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/com/github/gumtreediff/matchers/optimal/zs/ZsMatcher.java b/core/src/main/java/com/github/gumtreediff/matchers/optimal/zs/ZsMatcher.java index cf3d8c8bd..18c147fb4 100644 --- a/core/src/main/java/com/github/gumtreediff/matchers/optimal/zs/ZsMatcher.java +++ b/core/src/main/java/com/github/gumtreediff/matchers/optimal/zs/ZsMatcher.java @@ -176,8 +176,6 @@ private double getUpdateCost(ITree n1, ITree n2) { private static final class ZsTree { - private int start; // internal array position of leafmost leaf descendant of the root node - private int nodeCount; // number of nodes private int leafCount; @@ -189,11 +187,10 @@ private static final class ZsTree { private int[] kr; private ZsTree(ITree t) { - this.start = 0; this.nodeCount = t.getSize(); this.leafCount = 0; - this.llds = new int[start + nodeCount]; - this.labels = new ITree[start + nodeCount]; + this.llds = new int[nodeCount]; + this.labels = new ITree[nodeCount]; int idx = 1; Map tmpData = new HashMap<>(); @@ -210,13 +207,13 @@ private ZsTree(ITree t) { } public void setITree(int i, ITree tree) { - labels[i + start - 1] = tree; + labels[i - 1] = tree; if (nodeCount < i) nodeCount = i; } public void setLld(int i, int lld) { - llds[i + start - 1] = lld + start - 1; + llds[i - 1] = lld - 1; if (nodeCount < i) nodeCount = i; } @@ -226,11 +223,11 @@ public boolean isLeaf(int i) { } public int lld(int i) { - return llds[i + start - 1] - start + 1; + return llds[i - 1] + 1; } public ITree tree(int i) { - return labels[i + start - 1]; + return labels[i - 1]; } public void setKeyRoots() {