maxWork = s.size();
}
}
- if (maxTask == null)
+ if (maxTask == null) {
return null;
- if (maxTask.tryStealWork(maxSlice))
+ }
+ if (maxTask.tryStealWork(maxSlice)) {
return forThread.initWindow(maxSlice);
+ }
}
}
for (; w < weightPerThread && i < endIndex;) {
if (nextTop < topPaths.size()
&& i == topPaths.get(nextTop).slice.beginIndex) {
- if (s < i)
+ if (s < i) {
task.add(new Slice(s, i));
+ }
s = i = topPaths.get(nextTop++).slice.endIndex;
- } else
+ } else {
w += list[i++].getWeight();
+ }
}
// Round up the slice to the end of a path.
if (s < i) {
int h = list[i - 1].getPathHash();
while (i < endIndex) {
- if (h == list[i].getPathHash())
+ if (h == list[i].getPathHash()) {
i++;
- else
+ } else {
break;
+ }
}
task.add(new Slice(s, i));
}
- if (!task.slices.isEmpty())
+ if (!task.slices.isEmpty()) {
tasks.add(task);
+ }
}
while (topPathItr.hasNext()) {
WeightedPath p = topPathItr.next();
if (topPaths.size() < threads) {
Slice s = new Slice(cp, i);
topPaths.add(new WeightedPath(cw, s));
- if (topPaths.size() == threads)
+ if (topPaths.size() == threads) {
Collections.sort(topPaths);
+ }
} else if (topPaths.get(0).weight < cw) {
Slice s = new Slice(cp, i);
WeightedPath p = new WeightedPath(cw, s);
topPaths.set(0, p);
- if (p.compareTo(topPaths.get(1)) > 0)
+ if (p.compareTo(topPaths.get(1)) > 0) {
Collections.sort(topPaths);
+ }
}
}
cp = i;
ch = o.getPathHash();
cw = 0;
}
- if (o.isEdge() || o.doNotAttemptDelta())
+ if (o.isEdge() || o.doNotAttemptDelta()) {
continue;
+ }
cw += o.getWeight();
totalWeight += o.getWeight();
}
});
bytesPerUnit = 1;
- while (MAX_METER <= (totalWeight / bytesPerUnit))
+ while (MAX_METER <= (totalWeight / bytesPerUnit)) {
bytesPerUnit <<= 10;
+ }
return topPaths;
}
}
public int compareTo(WeightedPath o) {
int cmp = Long.signum(weight - o.weight);
- if (cmp != 0)
+ if (cmp != 0) {
return cmp;
+ }
return slice.beginIndex - o.slice.beginIndex;
}
}
DeltaWindow w;
for (;;) {
synchronized (this) {
- if (slices.isEmpty())
+ if (slices.isEmpty()) {
break;
+ }
w = initWindow(slices.removeFirst());
}
runWindow(w);
}
- while ((w = block.stealWork(this)) != null)
+ while ((w = block.stealWork(this)) != null) {
runWindow(w);
+ }
} finally {
block.pm.endWorker();
or.close();
}
synchronized Slice remaining() {
- if (!slices.isEmpty())
+ if (!slices.isEmpty()) {
return slices.getLast();
+ }
DeltaWindow d = dw;
return d != null ? d.remaining() : null;
}