@@ -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 }
0 commit comments