@Test public void testClear() { Random random = new Random(); Array<CollisionBox> rects = new Array<CollisionBox>(); for(int i = 0; i < 100; i++) { rects.add(new CollisionBox(random.nextInt(96), random.nextInt(96), random.nextInt(32), random.nextInt(32))); } rootQuad.addAll(rects); Assert.assertEquals(rects.size, rootQuad.getTotalElements()); rootQuad.clear(); Assert.assertEquals(0, rootQuad.getTotalElements()); }
@Override public void clear() { if (topLeft != null) { topLeft.clear(); topRight.clear(); bottomLeft.clear(); bottomRight.clear(); topLeft = null; topRight = null; bottomLeft = null; bottomRight = null; } elements.clear(); clearTotalElementsCache(); }
RegionQuadTree extends PointQuadTree<T> { @Override public void clear() { if (topLeft != null) { topLeft.clear(); topRight.clear(); bottomLeft.clear(); bottomRight.clear(); topLeft = null; topRight = null; bottomLeft = null; bottomRight = null; } elements.clear(); clearTotalElementsCache(); } }
RegionQuadTree extends PointQuadTree<T> { @Override public void clear() { if (topLeft != null) { topLeft.clear(); topRight.clear(); bottomLeft.clear(); bottomRight.clear(); topLeft = null; topRight = null; bottomLeft = null; bottomRight = null; } elements.clear(); clearTotalElementsCache(); } RegionQuadTree(int elementLimit, int mergeWatermark, float x, float y, float width, float height);  RegionQuadTree(int elementLimit, float x, float y, float width, float height);  RegionQuadTree(RegionQuadTree<T> parent, float x, float y, float width, float height);  RegionQuadTree(float minimumQuadWidth, float minimumQuadHeight, int elementLimitPerQuad, int mergeWatermark,
			float x, float y, float width, float height); }
RegionQuadTree extends PointQuadTree<T> { @Override public void clear() { if (topLeft != null) { topLeft.clear(); topRight.clear(); bottomLeft.clear(); bottomRight.clear(); topLeft = null; topRight = null; bottomLeft = null; bottomRight = null; } elements.clear(); clearTotalElementsCache(); } RegionQuadTree(int elementLimit, int mergeWatermark, float x, float y, float width, float height);  RegionQuadTree(int elementLimit, float x, float y, float width, float height);  RegionQuadTree(RegionQuadTree<T> parent, float x, float y, float width, float height);  RegionQuadTree(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> elementsToAdd); @Override boolean add(T element); @Override boolean remove(T element); @Override void clear(); @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); }
RegionQuadTree extends PointQuadTree<T> { @Override public void clear() { if (topLeft != null) { topLeft.clear(); topRight.clear(); bottomLeft.clear(); bottomRight.clear(); topLeft = null; topRight = null; bottomLeft = null; bottomRight = null; } elements.clear(); clearTotalElementsCache(); } RegionQuadTree(int elementLimit, int mergeWatermark, float x, float y, float width, float height);  RegionQuadTree(int elementLimit, float x, float y, float width, float height);  RegionQuadTree(RegionQuadTree<T> parent, float x, float y, float width, float height);  RegionQuadTree(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> elementsToAdd); @Override boolean add(T element); @Override boolean remove(T element); @Override void clear(); @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);  }