update SpatialPartitionBubbles - fix Sonar blocker issue

This commit is contained in:
atayal
2021-10-30 23:05:02 +05:30
parent 72bb189dc0
commit fc3a476942

View File

@ -34,11 +34,11 @@ import java.util.HashMap;
public class SpatialPartitionBubbles extends SpatialPartitionGeneric<Bubble> { public class SpatialPartitionBubbles extends SpatialPartitionGeneric<Bubble> {
private final HashMap<Integer, Bubble> bubbles; private final HashMap<Integer, Bubble> bubbles;
private final QuadTree quadTree; private final QuadTree bubblesQuadTree;
SpatialPartitionBubbles(HashMap<Integer, Bubble> bubbles, QuadTree quadTree) { SpatialPartitionBubbles(HashMap<Integer, Bubble> bubbles, QuadTree bubblesQuadTree) {
this.bubbles = bubbles; this.bubbles = bubbles;
this.quadTree = quadTree; this.bubblesQuadTree = bubblesQuadTree;
} }
void handleCollisionsUsingQt(Bubble b) { void handleCollisionsUsingQt(Bubble b) {
@ -46,7 +46,7 @@ public class SpatialPartitionBubbles extends SpatialPartitionGeneric<Bubble> {
// centre of bubble and length = radius of bubble // centre of bubble and length = radius of bubble
var rect = new Rect(b.coordinateX, b.coordinateY, 2D * b.radius, 2D * b.radius); var rect = new Rect(b.coordinateX, b.coordinateY, 2D * b.radius, 2D * b.radius);
var quadTreeQueryResult = new ArrayList<Point>(); var quadTreeQueryResult = new ArrayList<Point>();
this.quadTree.query(rect, quadTreeQueryResult); this.bubblesQuadTree.query(rect, quadTreeQueryResult);
//handling these collisions //handling these collisions
b.handleCollision(quadTreeQueryResult, this.bubbles); b.handleCollision(quadTreeQueryResult, this.bubbles);
} }