Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ private boolean remove(double x, double y, T item) {
}
}
else {
return mItems.remove(item);
if (mItems == null) {
return false;
} else {
return mItems.remove(item);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ public void testEmpty() {
}

public void testMultiplePoints() {
boolean response;
Item item1 = new Item(0, 0);

// Remove item that isn't yet in the QuadTree
response = mTree.remove(item1);
assertFalse(response);

mTree.add(item1);
Item item2 = new Item(.1, .1);
mTree.add(item2);
Expand All @@ -59,11 +65,18 @@ public void testMultiplePoints() {
assertTrue(items.contains(item2));
assertTrue(items.contains(item3));

mTree.remove(item1);
mTree.remove(item2);
mTree.remove(item3);
response = mTree.remove(item1);
assertTrue(response);
response = mTree.remove(item2);
assertTrue(response);
response = mTree.remove(item3);
assertTrue(response);

assertEquals(0, searchAll().size());

// Remove item that is no longer in the QuadTree
response = mTree.remove(item1);
assertFalse(response);
}

public void testSameLocationDifferentPoint() {
Expand Down