Add automatic linter (#4214)

This commit is contained in:
acbin
2023-06-09 20:05:14 +08:00
committed by GitHub
parent 00282efd8b
commit 415a04ea7f
188 changed files with 661 additions and 1133 deletions

View File

@@ -27,8 +27,7 @@ public final class LinearDiophantineEquationsSolver {
return toReturn;
}
private static GcdSolutionWrapper gcd(
final int a, final int b, final GcdSolutionWrapper previous) {
private static GcdSolutionWrapper gcd(final int a, final int b, final GcdSolutionWrapper previous) {
if (b == 0) {
return new GcdSolutionWrapper(a, new Solution(1, 0));
}
@@ -36,18 +35,15 @@ public final class LinearDiophantineEquationsSolver {
final var stubWrapper = new GcdSolutionWrapper(0, new Solution(0, 0));
final var next = /* recursive call */ gcd(b, a % b, stubWrapper);
previous.getSolution().setX(next.getSolution().getY());
previous.getSolution().setY(
next.getSolution().getX() - (a / b) * (next.getSolution().getY()));
previous.getSolution().setY(next.getSolution().getX() - (a / b) * (next.getSolution().getY()));
previous.setGcd(next.getGcd());
return new GcdSolutionWrapper(next.getGcd(), previous.getSolution());
}
public static final class Solution {
public static final Solution NO_SOLUTION
= new Solution(Integer.MAX_VALUE, Integer.MAX_VALUE);
public static final Solution INFINITE_SOLUTIONS
= new Solution(Integer.MIN_VALUE, Integer.MIN_VALUE);
public static final Solution NO_SOLUTION = new Solution(Integer.MAX_VALUE, Integer.MAX_VALUE);
public static final Solution INFINITE_SOLUTIONS = new Solution(Integer.MIN_VALUE, Integer.MIN_VALUE);
private int x;
private int y;