style: enable ConstantName in checkstyle (#5139)

Co-authored-by: Maria Paszkiewicz SCC <maria.paszkiewicz@kit.edu>
This commit is contained in:
marysiuniq
2024-05-02 18:31:37 +02:00
committed by GitHub
parent ede3e4651f
commit 1e2d7e9431
16 changed files with 87 additions and 90 deletions

View File

@ -6,8 +6,8 @@ import java.util.Scanner;
public class MatrixChainMultiplication {
private static final Scanner scan = new Scanner(System.in);
private static final ArrayList<Matrix> mArray = new ArrayList<>();
private static final Scanner SCANNER = new Scanner(System.in);
private static final ArrayList<Matrix> MATRICES = new ArrayList<>();
private static int size;
private static int[][] m;
private static int[][] s;
@ -24,14 +24,14 @@ public class MatrixChainMultiplication {
int row = Integer.parseInt(mSize[1]);
Matrix matrix = new Matrix(count, col, row);
mArray.add(matrix);
MATRICES.add(matrix);
count++;
}
for (Matrix m : mArray) {
for (Matrix m : MATRICES) {
System.out.format("A(%d) = %2d x %2d%n", m.count(), m.col(), m.row());
}
size = mArray.size();
size = MATRICES.size();
m = new int[size + 1][size + 1];
s = new int[size + 1][size + 1];
p = new int[size + 1];
@ -42,7 +42,7 @@ public class MatrixChainMultiplication {
}
for (int i = 0; i < p.length; i++) {
p[i] = i == 0 ? mArray.get(i).col() : mArray.get(i - 1).row();
p[i] = i == 0 ? MATRICES.get(i).col() : MATRICES.get(i - 1).row();
}
matrixChainOrder();
@ -109,7 +109,7 @@ public class MatrixChainMultiplication {
private static String[] input(String string) {
System.out.print(string);
return (scan.nextLine().split(" "));
return (SCANNER.nextLine().split(" "));
}
}