style: include NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION (#5149)

* style: use `assertFalse` and `assertTrue`

* style: include `NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION`
This commit is contained in:
Piotr Idzik
2024-05-08 19:11:46 +02:00
committed by GitHub
parent d3bb691f59
commit d2ddec55e5
11 changed files with 47 additions and 43 deletions

View File

@ -26,10 +26,10 @@ public abstract class CompositeLFSR implements BaseLFSR {
private boolean getMajorityBit() {
Map<Boolean, Integer> bitCount = new TreeMap<>();
bitCount.put(false, 0);
bitCount.put(true, 0);
bitCount.put(Boolean.FALSE, 0);
bitCount.put(Boolean.TRUE, 0);
registers.forEach(lfsr -> bitCount.put(lfsr.getClockBit(), bitCount.get(lfsr.getClockBit()) + 1));
return bitCount.get(false) <= bitCount.get(true);
return bitCount.get(Boolean.FALSE) <= bitCount.get(Boolean.TRUE);
}
}

View File

@ -34,7 +34,7 @@ class dijkstras {
for (int i = 0; i < k; i++) {
dist[i] = Integer.MAX_VALUE;
Set[i] = false;
Set[i] = Boolean.FALSE;
}
dist[src] = 0;
@ -42,7 +42,7 @@ class dijkstras {
for (int c = 0; c < k - 1; c++) {
int u = minDist(dist, Set);
Set[u] = true;
Set[u] = Boolean.TRUE;
for (int v = 0; v < k; v++) {
if (!Set[v] && graph[u][v] != 0 && dist[u] != Integer.MAX_VALUE && dist[u] + graph[u][v] < dist[v]) {

View File

@ -50,7 +50,7 @@ class PrimMST {
// Initialize all keys as INFINITE
for (int i = 0; i < V; i++) {
key[i] = Integer.MAX_VALUE;
mstSet[i] = false;
mstSet[i] = Boolean.FALSE;
}
// Always include first 1st vertex in MST.
@ -65,7 +65,7 @@ class PrimMST {
int u = minKey(key, mstSet);
// Add the picked vertex to the MST Set
mstSet[u] = true;
mstSet[u] = Boolean.TRUE;
// Update key value and parent index of the adjacent
// vertices of the picked vertex. Consider only those

View File

@ -31,7 +31,7 @@ public final class JobSequencing {
// Function to print the job sequence
public static String findJobSequence(ArrayList<Job> jobs, int size) {
Boolean[] slots = new Boolean[size];
Arrays.fill(slots, false);
Arrays.fill(slots, Boolean.FALSE);
int[] result = new int[size];
@ -40,7 +40,7 @@ public final class JobSequencing {
for (int j = jobs.get(i).deadline - 1; j >= 0; j--) {
if (!slots[j]) {
result[j] = i;
slots[j] = true;
slots[j] = Boolean.TRUE;
break;
}
}

View File

@ -25,7 +25,7 @@ public class CircleSort implements SortAlgorithm {
boolean swapped = false;
if (left == right) {
return false;
return Boolean.FALSE;
}
int low = left;