Fixed most reported issues by SonarCloud.

This commit is contained in:
Toxic Dreamz
2020-08-15 21:47:39 +04:00
parent e7e3ace01f
commit 31471acb69
190 changed files with 1426 additions and 661 deletions

View File

@ -59,6 +59,7 @@ import org.slf4j.LoggerFactory;
public class App {
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
private static final String BUBBLE = "Bubble ";
static void noSpatialPartition(int numOfMovements, Hashtable<Integer, Bubble> bubbles) {
//all bubbles have to be checked for collision for all bubbles
@ -76,7 +77,7 @@ public class App {
numOfMovements--;
}
//bubbles not popped
bubbles.keySet().stream().map(key -> "Bubble " + key + " not popped").forEach(LOGGER::info);
bubbles.keySet().stream().map(key -> BUBBLE + key + " not popped").forEach(LOGGER::info);
}
static void withSpatialPartition(
@ -99,7 +100,7 @@ public class App {
numOfMovements--;
}
//bubbles not popped
bubbles.keySet().stream().map(key -> "Bubble " + key + " not popped").forEach(LOGGER::info);
bubbles.keySet().stream().map(key -> BUBBLE + key + " not popped").forEach(LOGGER::info);
}
/**
@ -116,7 +117,7 @@ public class App {
var b = new Bubble(rand.nextInt(300), rand.nextInt(300), i, rand.nextInt(2) + 1);
bubbles1.put(i, b);
bubbles2.put(i, b);
LOGGER.info("Bubble " + i + " with radius " + b.radius
LOGGER.info(BUBBLE + i + " with radius " + b.radius
+ " added at (" + b.coordinateX + "," + b.coordinateY + ")");
}

View File

@ -34,8 +34,8 @@ import java.util.Hashtable;
public class SpatialPartitionBubbles extends SpatialPartitionGeneric<Bubble> {
final Hashtable<Integer, Bubble> bubbles;
final QuadTree quadTree;
private final Hashtable<Integer, Bubble> bubbles;
private final QuadTree quadTree;
SpatialPartitionBubbles(Hashtable<Integer, Bubble> bubbles, QuadTree quadTree) {
this.bubbles = bubbles;