From bd9a3ede72270a6ae2f52408e129525ce408f8ad Mon Sep 17 00:00:00 2001 From: Tore Halset Date: Wed, 3 Nov 2021 15:54:41 +0100 Subject: [PATCH] STRtree & co value generics https://github.com/locationtech/jts/issues/777 Signed-off-by: Tore Halset --- .../jts/index/ArrayListVisitor.java | 10 +++--- .../locationtech/jts/index/ItemVisitor.java | 4 +-- .../locationtech/jts/index/SpatialIndex.java | 8 ++--- .../jts/index/hprtree/HPRtree.java | 32 +++++++++---------- .../locationtech/jts/index/hprtree/Item.java | 8 ++--- .../jts/index/quadtree/Quadtree.java | 14 ++++---- .../jts/index/strtree/AbstractNode.java | 6 ++-- .../jts/index/strtree/AbstractSTRtree.java | 15 +++++---- .../jts/index/strtree/ItemBoundable.java | 8 ++--- .../jts/index/strtree/SIRtree.java | 8 ++--- .../jts/index/strtree/STRtree.java | 31 ++++++++++-------- .../jts/index/strtree/SIRtreeTest.java | 6 ++-- .../jts/index/strtree/STRtreeTest.java | 4 +-- .../test/java/test/jts/index/STRtreeDemo.java | 2 +- 14 files changed, 80 insertions(+), 76 deletions(-) diff --git a/modules/core/src/main/java/org/locationtech/jts/index/ArrayListVisitor.java b/modules/core/src/main/java/org/locationtech/jts/index/ArrayListVisitor.java index 2a18fefc54..2aafa80084 100644 --- a/modules/core/src/main/java/org/locationtech/jts/index/ArrayListVisitor.java +++ b/modules/core/src/main/java/org/locationtech/jts/index/ArrayListVisitor.java @@ -19,11 +19,11 @@ * * @version 1.7 */ -public class ArrayListVisitor - implements ItemVisitor +public class ArrayListVisitor + implements ItemVisitor { - private ArrayList items = new ArrayList(); + private ArrayList items = new ArrayList<>(); /** * Creates a new instance. @@ -36,7 +36,7 @@ public ArrayListVisitor() { * * @param item the item to visit */ - public void visitItem(Object item) + public void visitItem(T item) { items.add(item); } @@ -46,6 +46,6 @@ public void visitItem(Object item) * * @return the array of items */ - public ArrayList getItems() { return items; } + public ArrayList getItems() { return items; } } diff --git a/modules/core/src/main/java/org/locationtech/jts/index/ItemVisitor.java b/modules/core/src/main/java/org/locationtech/jts/index/ItemVisitor.java index 589d9cf188..d8e138b9cf 100644 --- a/modules/core/src/main/java/org/locationtech/jts/index/ItemVisitor.java +++ b/modules/core/src/main/java/org/locationtech/jts/index/ItemVisitor.java @@ -18,12 +18,12 @@ * @version 1.7 */ -public interface ItemVisitor +public interface ItemVisitor { /** * Visits an item in the index. * * @param item the index item to be visited */ - void visitItem(Object item); + void visitItem(T item); } diff --git a/modules/core/src/main/java/org/locationtech/jts/index/SpatialIndex.java b/modules/core/src/main/java/org/locationtech/jts/index/SpatialIndex.java index c44fcf9fca..3dfcb42b98 100644 --- a/modules/core/src/main/java/org/locationtech/jts/index/SpatialIndex.java +++ b/modules/core/src/main/java/org/locationtech/jts/index/SpatialIndex.java @@ -26,12 +26,12 @@ * * @version 1.7 */ -public interface SpatialIndex +public interface SpatialIndex { /** * Adds a spatial item with an extent specified by the given {@link Envelope} to the index */ - void insert(Envelope itemEnv, Object item); + void insert(Envelope itemEnv, T item); /** * Queries the index for all items whose extents intersect the given search {@link Envelope} @@ -41,7 +41,7 @@ public interface SpatialIndex * @param searchEnv the envelope to query for * @return a list of the items found by the query */ - List query(Envelope searchEnv); + List query(Envelope searchEnv); /** * Queries the index for all items whose extents intersect the given search {@link Envelope}, @@ -52,7 +52,7 @@ public interface SpatialIndex * @param searchEnv the envelope to query for * @param visitor a visitor object to apply to the items found */ - void query(Envelope searchEnv, ItemVisitor visitor); + void query(Envelope searchEnv, ItemVisitor visitor); /** * Removes a single item from the tree. diff --git a/modules/core/src/main/java/org/locationtech/jts/index/hprtree/HPRtree.java b/modules/core/src/main/java/org/locationtech/jts/index/hprtree/HPRtree.java index 2f9cbf243a..45fd89825b 100644 --- a/modules/core/src/main/java/org/locationtech/jts/index/hprtree/HPRtree.java +++ b/modules/core/src/main/java/org/locationtech/jts/index/hprtree/HPRtree.java @@ -59,8 +59,8 @@ * @author Martin Davis * */ -public class HPRtree - implements SpatialIndex +public class HPRtree + implements SpatialIndex { private static final int ENV_SIZE = 4; @@ -68,7 +68,7 @@ public class HPRtree private static int DEFAULT_NODE_CAPACITY = 16; - private List items = new ArrayList(); + private List> items = new ArrayList<>(); private int nodeCapacity = DEFAULT_NODE_CAPACITY; @@ -108,28 +108,28 @@ public int size() { } @Override - public void insert(Envelope itemEnv, Object item) { + public void insert(Envelope itemEnv, T item) { if (isBuilt) { throw new IllegalStateException("Cannot insert items after tree is built."); } - items.add( new Item(itemEnv, item) ); + items.add( new Item<>(itemEnv, item) ); totalExtent.expandToInclude(itemEnv); } @Override - public List query(Envelope searchEnv) { + public List query(Envelope searchEnv) { build(); if (! totalExtent.intersects(searchEnv)) - return new ArrayList(); + return new ArrayList<>(); - ArrayListVisitor visitor = new ArrayListVisitor(); + ArrayListVisitor visitor = new ArrayListVisitor<>(); query(searchEnv, visitor); return visitor.getItems(); } @Override - public void query(Envelope searchEnv, ItemVisitor visitor) { + public void query(Envelope searchEnv, ItemVisitor visitor) { build(); if (! totalExtent.intersects(searchEnv)) return; @@ -141,7 +141,7 @@ public void query(Envelope searchEnv, ItemVisitor visitor) { } } - private void queryTopLayer(Envelope searchEnv, ItemVisitor visitor) { + private void queryTopLayer(Envelope searchEnv, ItemVisitor visitor) { int layerIndex = layerStartIndex.length - 2; int layerSize = layerSize(layerIndex); // query each node in layer @@ -150,7 +150,7 @@ private void queryTopLayer(Envelope searchEnv, ItemVisitor visitor) { } } - private void queryNode(int layerIndex, int nodeOffset, Envelope searchEnv, ItemVisitor visitor) { + private void queryNode(int layerIndex, int nodeOffset, Envelope searchEnv, ItemVisitor visitor) { int layerStart = layerStartIndex[layerIndex]; int nodeIndex = layerStart + nodeOffset; if (! intersects(nodeIndex, searchEnv)) return; @@ -173,7 +173,7 @@ private boolean intersects(int nodeIndex, Envelope env) { return ! isBeyond; } - private void queryNodeChildren(int layerIndex, int blockOffset, Envelope searchEnv, ItemVisitor visitor) { + private void queryNodeChildren(int layerIndex, int blockOffset, Envelope searchEnv, ItemVisitor visitor) { int layerStart = layerStartIndex[layerIndex]; int layerEnd = layerStartIndex[layerIndex + 1]; for (int i = 0; i < nodeCapacity; i++) { @@ -185,14 +185,14 @@ private void queryNodeChildren(int layerIndex, int blockOffset, Envelope searchE } } - private void queryItems(int blockStart, Envelope searchEnv, ItemVisitor visitor) { + private void queryItems(int blockStart, Envelope searchEnv, ItemVisitor visitor) { for (int i = 0; i < nodeCapacity; i++) { int itemIndex = blockStart + i; // don't query past end of items if (itemIndex >= items.size()) break; // visit the item if its envelope intersects search env - Item item = items.get(itemIndex); + Item item = items.get(itemIndex); //nodeIntersectsCount++; if (intersects( item.getEnvelope(), searchEnv) ) { //if (item.getEnvelope().intersects(searchEnv)) { @@ -387,7 +387,7 @@ private void sortItems() { Collections.sort(items, comp); } - static class ItemComparator implements Comparator { + static class ItemComparator implements Comparator> { private HilbertEncoder encoder; @@ -396,7 +396,7 @@ public ItemComparator(HilbertEncoder encoder) { } @Override - public int compare(Item item1, Item item2) { + public int compare(Item item1, Item item2) { int hcode1 = encoder.encode(item1.getEnvelope()); int hcode2 = encoder.encode(item2.getEnvelope()); return Integer.compare(hcode1, hcode2); diff --git a/modules/core/src/main/java/org/locationtech/jts/index/hprtree/Item.java b/modules/core/src/main/java/org/locationtech/jts/index/hprtree/Item.java index 7de93a1001..e876c911d0 100644 --- a/modules/core/src/main/java/org/locationtech/jts/index/hprtree/Item.java +++ b/modules/core/src/main/java/org/locationtech/jts/index/hprtree/Item.java @@ -13,12 +13,12 @@ import org.locationtech.jts.geom.Envelope; -public class Item { +public class Item { private Envelope env; - private Object item; + private T item; - public Item(Envelope env, Object item) { + public Item(Envelope env, T item) { this.env = env; this.item = item; } @@ -27,7 +27,7 @@ public Envelope getEnvelope() { return env; } - public Object getItem() { + public T getItem() { return item; } diff --git a/modules/core/src/main/java/org/locationtech/jts/index/quadtree/Quadtree.java b/modules/core/src/main/java/org/locationtech/jts/index/quadtree/Quadtree.java index 8ac5563868..9698e55dc6 100644 --- a/modules/core/src/main/java/org/locationtech/jts/index/quadtree/Quadtree.java +++ b/modules/core/src/main/java/org/locationtech/jts/index/quadtree/Quadtree.java @@ -49,8 +49,8 @@ * * @version 1.7 */ -public class Quadtree - implements SpatialIndex, Serializable +public class Quadtree + implements SpatialIndex, Serializable { private static final long serialVersionUID = -7461163625812743604L; @@ -184,13 +184,13 @@ public List OLDquery(Envelope searchEnv) * @param searchEnv the envelope of the desired query area. * @return a List of items which may intersect the search envelope */ - public List query(Envelope searchEnv) + public List query(Envelope searchEnv) { /** * the items that are matched are the items in quads which * overlap the search envelope */ - ArrayListVisitor visitor = new ArrayListVisitor(); + ArrayListVisitor visitor = new ArrayListVisitor<>(); query(searchEnv, visitor); return visitor.getItems(); } @@ -208,7 +208,7 @@ public List query(Envelope searchEnv) * @param searchEnv the envelope of the desired query area. * @param visitor a visitor object which is passed the visited items */ - public void query(Envelope searchEnv, ItemVisitor visitor) + public void query(Envelope searchEnv, ItemVisitor visitor) { /** * the items that are matched are the items in quads which @@ -220,9 +220,9 @@ public void query(Envelope searchEnv, ItemVisitor visitor) /** * Return a list of all items in the Quadtree */ - public List queryAll() + public List queryAll() { - List foundItems = new ArrayList(); + List foundItems = new ArrayList<>(); root.addAllItems(foundItems); return foundItems; } diff --git a/modules/core/src/main/java/org/locationtech/jts/index/strtree/AbstractNode.java b/modules/core/src/main/java/org/locationtech/jts/index/strtree/AbstractNode.java index 71d5801962..f3a1c92fa5 100644 --- a/modules/core/src/main/java/org/locationtech/jts/index/strtree/AbstractNode.java +++ b/modules/core/src/main/java/org/locationtech/jts/index/strtree/AbstractNode.java @@ -34,7 +34,7 @@ public abstract class AbstractNode implements Boundable, Serializable { */ private static final long serialVersionUID = 6493722185909573708L; - private ArrayList childBoundables = new ArrayList(); + private ArrayList childBoundables = new ArrayList<>(); private Object bounds = null; private int level; @@ -59,7 +59,7 @@ public AbstractNode(int level) { * * @return a list of the children */ - public List getChildBoundables() { + public List getChildBoundables() { return childBoundables; } @@ -128,7 +128,7 @@ public void addChildBoundable(Boundable childBoundable) { childBoundables.add(childBoundable); } - void setChildBoundables(ArrayList childBoundables) + void setChildBoundables(ArrayList childBoundables) { this.childBoundables = childBoundables; } diff --git a/modules/core/src/main/java/org/locationtech/jts/index/strtree/AbstractSTRtree.java b/modules/core/src/main/java/org/locationtech/jts/index/strtree/AbstractSTRtree.java index 19dee621ad..1336075172 100644 --- a/modules/core/src/main/java/org/locationtech/jts/index/strtree/AbstractSTRtree.java +++ b/modules/core/src/main/java/org/locationtech/jts/index/strtree/AbstractSTRtree.java @@ -40,7 +40,7 @@ * * @version 1.7 */ -public abstract class AbstractSTRtree implements Serializable { +public abstract class AbstractSTRtree implements Serializable { /** * @@ -68,7 +68,7 @@ protected static interface IntersectsOp { /** * Set to null when index is built, to avoid retaining memory. */ - private ArrayList itemBoundables = new ArrayList(); + private ArrayList> itemBoundables = new ArrayList<>(); private int nodeCapacity; @@ -112,7 +112,7 @@ public AbstractSTRtree(int nodeCapacity, AbstractNode root) { * @param nodeCapacity the maximum number of child nodes in a node * @param itemBoundables the list of leaf nodes in the tree */ - public AbstractSTRtree(int nodeCapacity, ArrayList itemBoundables) { + public AbstractSTRtree(int nodeCapacity, ArrayList> itemBoundables) { this(nodeCapacity); this.itemBoundables = itemBoundables; } @@ -260,17 +260,18 @@ protected int depth(AbstractNode node) } - protected void insert(Object bounds, Object item) { + protected void insert(Object bounds, T item) { Assert.isTrue(!built, "Cannot insert items into an STR packed R-tree after it has been built."); - itemBoundables.add(new ItemBoundable(bounds, item)); + itemBoundables.add(new ItemBoundable<>(bounds, item)); } /** * Also builds the tree, if necessary. + * @param */ - protected List query(Object searchBounds) { + protected List query(Object searchBounds) { build(); - ArrayList matches = new ArrayList(); + ArrayList matches = new ArrayList<>(); if (isEmpty()) { //Assert.isTrue(root.getBounds() == null); return matches; diff --git a/modules/core/src/main/java/org/locationtech/jts/index/strtree/ItemBoundable.java b/modules/core/src/main/java/org/locationtech/jts/index/strtree/ItemBoundable.java index d11dbe5963..a640794e63 100644 --- a/modules/core/src/main/java/org/locationtech/jts/index/strtree/ItemBoundable.java +++ b/modules/core/src/main/java/org/locationtech/jts/index/strtree/ItemBoundable.java @@ -19,11 +19,11 @@ * * @version 1.7 */ -public class ItemBoundable implements Boundable, Serializable { +public class ItemBoundable implements Boundable, Serializable { private Object bounds; - private Object item; + private T item; - public ItemBoundable(Object bounds, Object item) { + public ItemBoundable(Object bounds, T item) { this.bounds = bounds; this.item = item; } @@ -32,5 +32,5 @@ public Object getBounds() { return bounds; } - public Object getItem() { return item; } + public T getItem() { return item; } } diff --git a/modules/core/src/main/java/org/locationtech/jts/index/strtree/SIRtree.java b/modules/core/src/main/java/org/locationtech/jts/index/strtree/SIRtree.java index b843e530aa..5f0d2ca757 100644 --- a/modules/core/src/main/java/org/locationtech/jts/index/strtree/SIRtree.java +++ b/modules/core/src/main/java/org/locationtech/jts/index/strtree/SIRtree.java @@ -28,7 +28,7 @@ * * @version 1.7 */ -public class SIRtree extends AbstractSTRtree { +public class SIRtree extends AbstractSTRtree { private Comparator comparator = new Comparator() { public int compare(Object o1, Object o2) { @@ -78,14 +78,14 @@ protected Object computeBounds() { /** * Inserts an item having the given bounds into the tree. */ - public void insert(double x1, double x2, Object item) { + public void insert(double x1, double x2, T item) { super.insert(new Interval(Math.min(x1, x2), Math.max(x1, x2)), item); } /** * Returns items whose bounds intersect the given value. */ - public List query(double x) { + public List query(double x) { return query(x, x); } @@ -93,7 +93,7 @@ public List query(double x) { * Returns items whose bounds intersect the given bounds. * @param x1 possibly equal to x2 */ - public List query(double x1, double x2) { + public List query(double x1, double x2) { return super.query(new Interval(Math.min(x1, x2), Math.max(x1, x2))); } diff --git a/modules/core/src/main/java/org/locationtech/jts/index/strtree/STRtree.java b/modules/core/src/main/java/org/locationtech/jts/index/strtree/STRtree.java index a0bfc91e04..75336c0c34 100644 --- a/modules/core/src/main/java/org/locationtech/jts/index/strtree/STRtree.java +++ b/modules/core/src/main/java/org/locationtech/jts/index/strtree/STRtree.java @@ -50,12 +50,15 @@ * * @version 1.7 */ -public class STRtree extends AbstractSTRtree -implements SpatialIndex, Serializable +public class STRtree extends AbstractSTRtree +implements SpatialIndex, Serializable { static final class STRtreeNode extends AbstractNode { + + private static final long serialVersionUID = -5153132721074681573L; + STRtreeNode(int level) { super(level); @@ -63,8 +66,8 @@ static final class STRtreeNode extends AbstractNode protected Object computeBounds() { Envelope bounds = null; - for (Iterator i = getChildBoundables().iterator(); i.hasNext(); ) { - Boundable childBoundable = (Boundable) i.next(); + for (Iterator i = getChildBoundables().iterator(); i.hasNext(); ) { + Boundable childBoundable = i.next(); if (bounds == null) { bounds = new Envelope((Envelope)childBoundable.getBounds()); } @@ -203,7 +206,7 @@ public STRtree(int nodeCapacity, STRtreeNode root) { * The minimum recommended capacity setting is 4. * */ - public STRtree(int nodeCapacity, ArrayList itemBoundables) { + public STRtree(int nodeCapacity, ArrayList> itemBoundables) { super(nodeCapacity, itemBoundables); } @@ -218,7 +221,7 @@ protected IntersectsOp getIntersectsOp() { /** * Inserts an item having the given bounds into the tree. */ - public void insert(Envelope itemEnv, Object item) { + public void insert(Envelope itemEnv, T item) { if (itemEnv.isNull()) { return; } super.insert(itemEnv, item); } @@ -226,7 +229,7 @@ public void insert(Envelope itemEnv, Object item) { /** * Returns items whose bounds intersect the given envelope. */ - public List query(Envelope searchEnv) { + public List query(Envelope searchEnv) { //Yes this method does something. It specifies that the bounds is an //Envelope. super.query takes an Object, not an Envelope. [Jon Aquino 10/24/2003] return super.query((Object)searchEnv); @@ -235,7 +238,7 @@ public List query(Envelope searchEnv) { /** * Returns items whose bounds intersect the given envelope. */ - public void query(Envelope searchEnv, ItemVisitor visitor) { + public void query(Envelope searchEnv, ItemVisitor visitor) { //Yes this method does something. It specifies that the bounds is an //Envelope. super.query takes an Object, not an Envelope. [Jon Aquino 10/24/2003] super.query(searchEnv, visitor); @@ -319,9 +322,9 @@ public Object[] nearestNeighbour(ItemDistance itemDist) * @return the nearest item in this tree * or null if the tree is empty */ - public Object nearestNeighbour(Envelope env, Object item, ItemDistance itemDist) + public Object nearestNeighbour(Envelope env, T item, ItemDistance itemDist) { - Boundable bnd = new ItemBoundable(env, item); + Boundable bnd = new ItemBoundable<>(env, item); BoundablePair bp = new BoundablePair(this.getRoot(), bnd, itemDist); return nearestNeighbour(bp)[0]; } @@ -341,7 +344,7 @@ public Object nearestNeighbour(Envelope env, Object item, ItemDistance itemDist) * @return the pair of the nearest items, one from each tree * or null if no pair of distinct items can be found */ - public Object[] nearestNeighbour(STRtree tree, ItemDistance itemDist) + public Object[] nearestNeighbour(STRtree tree, ItemDistance itemDist) { if (isEmpty() || tree.isEmpty()) return null; BoundablePair bp = new BoundablePair(this.getRoot(), tree.getRoot(), itemDist); @@ -414,7 +417,7 @@ private Object[] nearestNeighbour(BoundablePair initBndPair) * @param maxDistance the distance limit for the search * @return true if there are items within the distance */ - public boolean isWithinDistance(STRtree tree, ItemDistance itemDist, double maxDistance) + public boolean isWithinDistance(STRtree tree, ItemDistance itemDist, double maxDistance) { BoundablePair bp = new BoundablePair(this.getRoot(), tree.getRoot(), itemDist); return isWithinDistance(bp, maxDistance); @@ -517,9 +520,9 @@ private boolean isWithinDistance(BoundablePair initBndPair, double maxDistance) * @param k the K nearest items in kNearestNeighbour * @return the K nearest items in this tree */ - public Object[] nearestNeighbour(Envelope env, Object item, ItemDistance itemDist,int k) + public Object[] nearestNeighbour(Envelope env, T item, ItemDistance itemDist,int k) { - Boundable bnd = new ItemBoundable(env, item); + Boundable bnd = new ItemBoundable<>(env, item); BoundablePair bp = new BoundablePair(this.getRoot(), bnd, itemDist); return nearestNeighbourK(bp,k); } diff --git a/modules/core/src/test/java/org/locationtech/jts/index/strtree/SIRtreeTest.java b/modules/core/src/test/java/org/locationtech/jts/index/strtree/SIRtreeTest.java index 27160dd438..81126de2f2 100644 --- a/modules/core/src/test/java/org/locationtech/jts/index/strtree/SIRtreeTest.java +++ b/modules/core/src/test/java/org/locationtech/jts/index/strtree/SIRtreeTest.java @@ -29,14 +29,14 @@ public static void main(String[] args) { junit.textui.TestRunner.main(testCaseName); } - private static class TestTree extends SIRtree { + private static class TestTree extends SIRtree { public TestTree(int nodeCapacity) { super(nodeCapacity); } public AbstractNode getRoot() { return super.getRoot(); } protected List boundablesAtLevel(int level) { return super.boundablesAtLevel(level); } } public void test() { - TestTree t = new TestTree(2); + TestTree t = new TestTree<>(2); t.insert(2, 6, "A"); t.insert(2, 4, "B"); t.insert(2, 3, "C"); @@ -55,7 +55,7 @@ public void test() { } public void testEmptyTree() { - TestTree t = new TestTree(2); + TestTree t = new TestTree<>(2); t.build(); assertEquals(0, t.getRoot().getLevel()); assertEquals(1, t.boundablesAtLevel(0).size()); diff --git a/modules/core/src/test/java/org/locationtech/jts/index/strtree/STRtreeTest.java b/modules/core/src/test/java/org/locationtech/jts/index/strtree/STRtreeTest.java index ff7744ff8f..4a4223b5e3 100644 --- a/modules/core/src/test/java/org/locationtech/jts/index/strtree/STRtreeTest.java +++ b/modules/core/src/test/java/org/locationtech/jts/index/strtree/STRtreeTest.java @@ -75,7 +75,7 @@ public void testSpatialIndex() throws Exception { SpatialIndexTester tester = new SpatialIndexTester(); - tester.setSpatialIndex(new STRtree(4)); + tester.setSpatialIndex(new STRtree<>(4)); tester.init(); tester.run(); assertTrue(tester.isSuccess()); @@ -173,7 +173,7 @@ public void testVerticalSlices() { } public void testRemove() { - STRtree tree = new STRtree(); + STRtree tree = new STRtree<>(); tree.insert(new Envelope(0, 10, 0, 10), "1"); tree.insert(new Envelope(5, 15, 5, 15), "2"); tree.insert(new Envelope(10, 20, 10, 20), "3"); diff --git a/modules/core/src/test/java/test/jts/index/STRtreeDemo.java b/modules/core/src/test/java/test/jts/index/STRtreeDemo.java index 7dbf1cb760..46429ca80b 100644 --- a/modules/core/src/test/java/test/jts/index/STRtreeDemo.java +++ b/modules/core/src/test/java/test/jts/index/STRtreeDemo.java @@ -35,7 +35,7 @@ public class STRtreeDemo { public STRtreeDemo() { } - public static class TestTree extends STRtree { + public static class TestTree extends STRtree { public TestTree(int nodeCapacity) { super(nodeCapacity); }