@Test public void testRemove() { Random random = new Random(); Array<CollisionBox> collisionBoxs = new Array<CollisionBox>(); for (int i = 0; i < 1000; i++) { collisionBoxs.add( new CollisionBox(random.nextInt(96), random.nextInt(96), random.nextInt(32), random.nextInt(32))); } for (int i = 0; i < collisionBoxs.size; i++) { rootQuad.add(collisionBoxs.get(i)); Assert.assertEquals(i + 1, rootQuad.getElements().size); } for (int i = collisionBoxs.size - 1; i >= 0; i--) { Assert.assertEquals(i + 1, rootQuad.getElements().size); rootQuad.remove(collisionBoxs.get(i)); Assert.assertEquals(i, rootQuad.getElements().size); } }
@Override public boolean remove(T element) { if (element == null) return false; if (!this.intersects(element) && !this.contains(element)) { return false; } clearTotalElementsCache(); return removeElement(element, true); }
ConcurrentRegionQuadTree extends ConcurrentPointQuadTree<T> { @Override public boolean remove(T element) { if (element == null) return false; if (!this.intersects(element) && !this.contains(element)) { return false; } clearTotalElementsCache(); return removeElement(element, true); } }
ConcurrentRegionQuadTree extends ConcurrentPointQuadTree<T> { @Override public boolean remove(T element) { if (element == null) return false; if (!this.intersects(element) && !this.contains(element)) { return false; } clearTotalElementsCache(); return removeElement(element, true); } ConcurrentRegionQuadTree(int elementLimit, int mergeWatermark, float x, float y, float width, float height);  ConcurrentRegionQuadTree(int elementLimit, float x, float y, float width, float height);  ConcurrentRegionQuadTree(ConcurrentRegionQuadTree<T> parent, float x, float y, float width, float height);  ConcurrentRegionQuadTree(float minimumQuadWidth, float minimumQuadHeight, int elementLimitPerQuad,
			int mergeWatermark, float x, float y, float width, float height); }
ConcurrentRegionQuadTree extends ConcurrentPointQuadTree<T> { @Override public boolean remove(T element) { if (element == null) return false; if (!this.intersects(element) && !this.contains(element)) { return false; } clearTotalElementsCache(); return removeElement(element, true); } ConcurrentRegionQuadTree(int elementLimit, int mergeWatermark, float x, float y, float width, float height);  ConcurrentRegionQuadTree(int elementLimit, float x, float y, float width, float height);  ConcurrentRegionQuadTree(ConcurrentRegionQuadTree<T> parent, float x, float y, float width, float height);  ConcurrentRegionQuadTree(float minimumQuadWidth, float minimumQuadHeight, int elementLimitPerQuad,
			int mergeWatermark, float x, float y, float width, float height); @Override void debugRender(Graphics g); @Override void addAll(Array<T> elements); @Override boolean add(T element); @Override void removeAll(Array<T> elementsToRemove); @Override boolean remove(T element); @Override void getElementsWithinArea(Array<T> result, Shape area); @Override void getElementsWithinArea(Array<T> result, Shape area, QuadTreeSearchDirection searchDirection); @Override Array<T> getElementsContainingArea(Shape area, boolean entirelyContained); @Override Array<T> getElementsContainingArea(Shape area, QuadTreeSearchDirection searchDirection, boolean entirelyContained); @Override void getElementsContainingArea(Array<T> result, Shape area, boolean entirelyContained); @Override void getElementsContainingArea(Array<T> result, Shape area, QuadTreeSearchDirection searchDirection, boolean entirelyContained); @Override void getElementsContainingPoint(Array<T> result, Point point); @Override void getElementsContainingPoint(Array<T> result, Point point, QuadTreeSearchDirection searchDirection); @Override void getElementsIntersectingLineSegment(Array<T> result, LineSegment lineSegment); @Override void getElementsIntersectingLineSegment(Array<T> result, LineSegment lineSegment, QuadTreeSearchDirection searchDirection); @Override Array<T> getElements(); @Override void getElements(Array<T> result); @Override int getTotalElements(); @Override void positionChanged(T moved); }
ConcurrentRegionQuadTree extends ConcurrentPointQuadTree<T> { @Override public boolean remove(T element) { if (element == null) return false; if (!this.intersects(element) && !this.contains(element)) { return false; } clearTotalElementsCache(); return removeElement(element, true); } ConcurrentRegionQuadTree(int elementLimit, int mergeWatermark, float x, float y, float width, float height);  ConcurrentRegionQuadTree(int elementLimit, float x, float y, float width, float height);  ConcurrentRegionQuadTree(ConcurrentRegionQuadTree<T> parent, float x, float y, float width, float height);  ConcurrentRegionQuadTree(float minimumQuadWidth, float minimumQuadHeight, int elementLimitPerQuad,
			int mergeWatermark, float x, float y, float width, float height); @Override void debugRender(Graphics g); @Override void addAll(Array<T> elements); @Override boolean add(T element); @Override void removeAll(Array<T> elementsToRemove); @Override boolean remove(T element); @Override void getElementsWithinArea(Array<T> result, Shape area); @Override void getElementsWithinArea(Array<T> result, Shape area, QuadTreeSearchDirection searchDirection); @Override Array<T> getElementsContainingArea(Shape area, boolean entirelyContained); @Override Array<T> getElementsContainingArea(Shape area, QuadTreeSearchDirection searchDirection, boolean entirelyContained); @Override void getElementsContainingArea(Array<T> result, Shape area, boolean entirelyContained); @Override void getElementsContainingArea(Array<T> result, Shape area, QuadTreeSearchDirection searchDirection, boolean entirelyContained); @Override void getElementsContainingPoint(Array<T> result, Point point); @Override void getElementsContainingPoint(Array<T> result, Point point, QuadTreeSearchDirection searchDirection); @Override void getElementsIntersectingLineSegment(Array<T> result, LineSegment lineSegment); @Override void getElementsIntersectingLineSegment(Array<T> result, LineSegment lineSegment, QuadTreeSearchDirection searchDirection); @Override Array<T> getElements(); @Override void getElements(Array<T> result); @Override int getTotalElements(); @Override void positionChanged(T moved);  }