提交 9e7a31c4 authored 作者: Andrei Tokar's avatar Andrei Tokar

additional optimizations for MVRTreeMap

上级 6d79ef93
......@@ -271,8 +271,11 @@ public final class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
} else {
result = operate(c, key, value, decisionMaker);
Object bounds = p.getKey(index);
keyType.increaseBounds(bounds, key);
p.setKey(index, bounds);
if (!keyType.contains(bounds, key)) {
bounds = keyType.createBoundingBox(bounds);
keyType.increaseBounds(bounds, key);
p.setKey(index, bounds);
}
p.setChild(index, c);
}
}
......
......@@ -163,8 +163,14 @@ public class SpatialDataType implements DataType {
return;
}
for (int i = 0; i < dimensions; i++) {
b.setMin(i, Math.min(b.min(i), a.min(i)));
b.setMax(i, Math.max(b.max(i), a.max(i)));
float v = a.min(i);
if (v < b.min(i)) {
b.setMin(i, v);
}
v = a.max(i);
if (v > b.max(i)) {
b.setMax(i, v);
}
}
}
......@@ -287,12 +293,7 @@ public class SpatialDataType implements DataType {
if (a.isNull()) {
return a;
}
float[] minMax = new float[dimensions * 2];
for (int i = 0; i < dimensions; i++) {
minMax[i + i] = a.min(i);
minMax[i + i + 1] = a.max(i);
}
return new SpatialKey(0, minMax);
return new SpatialKey(0, a);
}
/**
......
......@@ -26,6 +26,11 @@ public class SpatialKey {
this.minMax = minMax;
}
public SpatialKey(long id, SpatialKey other) {
this.id = id;
this.minMax = other.minMax.clone();
}
/**
* Get the minimum value for the given dimension.
*
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论