Skip to content

Commit 873428c

Browse files
committed
fixed checkstyle error
1 parent 001e441 commit 873428c

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/main/java/com/thealgorithms/datastructures/graphs/TwoSat.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class TwoSat {
9191
* @throws IllegalArgumentException if the number of variables is negative
9292
*/
9393
@SuppressWarnings({"unchecked", "rawtypes"})
94-
public TwoSat(int numberOfVariables) {
94+
TwoSat(int numberOfVariables) {
9595
if (numberOfVariables < 0) {
9696
throw new IllegalArgumentException("Number of variables cannot be negative.");
9797
}
@@ -124,7 +124,7 @@ public TwoSat(int numberOfVariables) {
124124
* @param isNegateB {@code true} if variable {@code b} is negated
125125
* @throws IllegalArgumentException if {@code a} or {@code b} are out of range
126126
*/
127-
public void addClause(int a, boolean isNegateA, int b, boolean isNegateB) {
127+
void addClause(int a, boolean isNegateA, int b, boolean isNegateB) {
128128
if (a <= 0 || a > numberOfVariables) {
129129
throw new IllegalArgumentException("Variable number must be between 1 and " + numberOfVariables);
130130
}
@@ -150,7 +150,7 @@ public void addClause(int a, boolean isNegateA, int b, boolean isNegateB) {
150150
* Solves the 2-SAT problem using Kosaraju's algorithm to find SCCs
151151
* and determines whether a satisfying assignment exists.
152152
*/
153-
public void solve() {
153+
void solve() {
154154
isSolved = true;
155155
int n = 2 * numberOfVariables + 1;
156156

@@ -195,7 +195,7 @@ public void solve() {
195195
* @return {@code true} if a solution exists; {@code false} otherwise
196196
* @throws Error if called before {@link #solve()}
197197
*/
198-
public boolean isSolutionExists() {
198+
boolean isSolutionExists() {
199199
if (!isSolved) {
200200
throw new Error("Please call solve() before checking for a solution.");
201201
}
@@ -209,7 +209,7 @@ public boolean isSolutionExists() {
209209
* variable {@code xᵢ}
210210
* @throws Error if called before {@link #solve()} or if no solution exists
211211
*/
212-
public boolean[] getSolutions() {
212+
boolean[] getSolutions() {
213213
if (!isSolved) {
214214
throw new Error("Please call solve() before fetching the solution.");
215215
}

src/test/java/com/thealgorithms/datastructures/graphs/TwoSatTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.thealgorithms.datastructures.graphs;
22

3-
import static org.junit.jupiter.api.Assertions.*;
3+
import static org.junit.jupiter.api.Assertions.assertFalse;
4+
import static org.junit.jupiter.api.Assertions.assertTrue;
5+
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
46

57
import org.junit.jupiter.api.Test;
68

0 commit comments

Comments
 (0)