Skip to content

Commit

Permalink
Fixed typos in comments
Browse files Browse the repository at this point in the history
  • Loading branch information
czengler committed Jul 18, 2022
1 parent 8f9391f commit a06339f
Show file tree
Hide file tree
Showing 57 changed files with 165 additions and 165 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/logicng/backbones/Backbone.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

/**
* This class represents a backbone. A backbone of a formula is a set of literals (positive and/or negative) which
* are present in their respective polarity in every model of the given formula. Therefore the literals must be set
* are present in their respective polarity in every model of the given formula. Therefore, the literals must be set
* accordingly in order for the formula to evaluate to true.
* <p>
* A backbone of a formula has up to three sets of variables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private void encodeRecursive() {
}

/**
* Internal non recursive encoding.
* Internal non-recursive encoding.
* @param literals the current literals
*/
private void encodeNonRecursive(final LNGVector<Literal> literals) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public interface CCAtLeastK {
* Builds a cardinality constraint of the form {@code var_1 + var_2 + ... + var_n >= k}.
* @param result the result of the encoding
* @param vars the variables {@code var_1 ... var_n}
* @param rhs the right hand side {@code k} of the constraint
* @throws IllegalArgumentException if the right hand side of the cardinality constraint is negative
* @param rhs the right-hand side {@code k} of the constraint
* @throws IllegalArgumentException if the right-hand side of the cardinality constraint is negative
*/
void build(final EncodingResult result, final Variable[] vars, int rhs);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public interface CCAtMostK {
* Builds a cardinality constraint of the form {@code var_1 + var_2 + ... + var_n <= k}.
* @param result the result for the encoding
* @param vars the variables {@code var_1 ... var_n}
* @param rhs the right hand side {@code k} of the constraint
* @throws IllegalArgumentException if the right hand side of the cardinality constraint is negative
* @param rhs the right-hand side {@code k} of the constraint
* @throws IllegalArgumentException if the right-hand side of the cardinality constraint is negative
*/
void build(final EncodingResult result, final Variable[] vars, int rhs);

Expand Down
16 changes: 8 additions & 8 deletions src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ protected void exo(final EncodingResult result, final Variable... vars) {
* Encodes an at-most-k constraint.
* @param result the result
* @param vars the variables of the constraint
* @param rhs the right hand side of the constraint
* @param rhs the right-hand side of the constraint
*/
protected void amk(final EncodingResult result, final Variable[] vars, final int rhs) {
if (rhs < 0) {
Expand Down Expand Up @@ -350,7 +350,7 @@ protected void amk(final EncodingResult result, final Variable[] vars, final int
* Encodes an at-most-k constraint for incremental usage.
* @param result the result
* @param vars the variables of the constraint
* @param rhs the right hand side of the constraint
* @param rhs the right-hand side of the constraint
* @return the incremental data
*/
protected CCIncrementalData amkIncremental(final EncodingResult result, final Variable[] vars, final int rhs) {
Expand Down Expand Up @@ -398,7 +398,7 @@ protected CCIncrementalData amkIncremental(final EncodingResult result, final Va
* Encodes an at-lest-k constraint.
* @param result the result
* @param vars the variables of the constraint
* @param rhs the right hand side of the constraint
* @param rhs the right-hand side of the constraint
*/
protected void alk(final EncodingResult result, final Variable[] vars, final int rhs) {
if (rhs < 0) {
Expand Down Expand Up @@ -452,7 +452,7 @@ protected void alk(final EncodingResult result, final Variable[] vars, final int
* Encodes an at-lest-k constraint for incremental usage.
* @param result the result
* @param vars the variables of the constraint
* @param rhs the right hand side of the constraint
* @param rhs the right-hand side of the constraint
* @return the incremental data
*/
protected CCIncrementalData alkIncremental(final EncodingResult result, final Variable[] vars, final int rhs) {
Expand Down Expand Up @@ -507,7 +507,7 @@ protected CCIncrementalData alkIncremental(final EncodingResult result, final Va
* Encodes an exactly-k constraint.
* @param result the result
* @param vars the variables of the constraint
* @param rhs the right hand side of the constraint
* @param rhs the right-hand side of the constraint
*/
protected void exk(final EncodingResult result, final Variable[] vars, final int rhs) {
if (rhs < 0) {
Expand Down Expand Up @@ -573,7 +573,7 @@ protected CCAtMostOne bestAMO(final int n) {

/**
* Returns the best at-most-k encoder for a given number of variables. The valuation is based on theoretical and
* practical observations. Currently the modular totalizer is the best encoder for all sizes and therefore is always
* practical observations. Currently, the modular totalizer is the best encoder for all sizes and therefore is always
* chosen.
* @param n the number of variables
* @return the best at-most-one encoder
Expand All @@ -587,7 +587,7 @@ protected CCAtMostK bestAMK(final int n) {

/**
* Returns the best at-least-k encoder for a given number of variables. The valuation is based on theoretical and
* practical observations. Currently the modular totalizer is the best encoder for all sizes and therefore is always
* practical observations. Currently, the modular totalizer is the best encoder for all sizes and therefore is always
* chosen.
* @param n the number of variables
* @return the best at-most-one encoder
Expand All @@ -601,7 +601,7 @@ protected CCAtLeastK bestALK(final int n) {

/**
* Returns the best exactly-k encoder for a given number of variables. The valuation is based on theoretical and
* practical observations. Currently the totalizer is the best encoder for all sizes and therefore is always
* practical observations. Currently, the totalizer is the best encoder for all sizes and therefore is always
* chosen.
* @param n the number of variables
* @return the best at-most-one encoder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public interface CCExactlyK {
* Builds a cardinality constraint of the form {@code var_1 + var_2 + ... + var_n = k}.
* @param result the result of the encoding
* @param vars the variables {@code var_1 ... var_n}
* @param rhs the right hand side {@code k} of the constraint
* @throws IllegalArgumentException if the right hand side of the cardinality constraint is negative
* @param rhs the right-hand side {@code k} of the constraint
* @throws IllegalArgumentException if the right-hand side of the cardinality constraint is negative
*/
void build(final EncodingResult result, final Variable[] vars, int rhs);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

/**
* Incremental data for an at-most-k cardinality constraint. When an at-most-k cardinality constraint is constructed,
* it is possible to save incremental data with it. Then one can modify the constraint after it is was created by
* it is possible to save incremental data with it. Then one can modify the constraint after it was created by
* tightening the original bound.
* @version 1.1
* @since 1.1
Expand Down Expand Up @@ -156,7 +156,7 @@ public List<Formula> newUpperBound(final int rhs) {
* Tightens the upper bound of an at-most-k constraint and encodes it on the solver of the result.
* <p>
* Usage constraints:
* -New right hand side must be smaller than current right hand side.
* -New right-hand side must be smaller than current right-hand side.
* -Cannot be used for at-least-k constraints.
* @param rhs the new upperBound
*/
Expand Down Expand Up @@ -227,7 +227,7 @@ public List<Formula> newLowerBound(final int rhs) {
* Tightens the lower bound of an at-least-k constraint and encodes it on the solver of the result.
* <p>
* Usage constraints:
* -New right hand side must be greater than current right hand side.
* -New right-hand side must be greater than current right-hand side.
* -Cannot be used for at-most-k constraints.
* @param rhs the new upperBound
*/
Expand Down Expand Up @@ -286,8 +286,8 @@ private void computeLBConstraint(final EncodingResult result, final int rhs) {
}

/**
* Returns the current right hand side of this CCIncrementalData.
* @return the current right hand side of this CCIncrementalData.
* Returns the current right-hand side of this CCIncrementalData.
* @return the current right-hand side of this CCIncrementalData.
*/
public int currentRHS() {
return this.currentRHS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public final class CCModularTotalizer {
* Builds an at-most-k constraint.
* @param result the result of the encoding
* @param vars the variables of the constraint
* @param rhs the right hand side of the constraint
* @param rhs the right-hand side of the constraint
*/
void buildAMK(final EncodingResult result, final Variable[] vars, final int rhs) {
final int mod = this.initialize(result, rhs, vars.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private static int directSorterValue(final int n) {

/**
* Generates a sorter encoding for the given input.
* @param m the the counter
* @param m the counter
* @param input the input literals
* @param result the result of the encoding
* @param output the output literals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private enum Bound {LOWER, UPPER, BOTH}
* @param result the result
* @param vars the variables
* @param rhs the right-hand side
* @throws IllegalArgumentException if the right hand side of the constraint was negative
* @throws IllegalArgumentException if the right-hand side of the constraint was negative
*/
void buildAMK(final EncodingResult result, final Variable[] vars, final int rhs) {
final LNGVector<Variable> cardinalityOutvars = this.initializeConstraint(result, vars);
Expand All @@ -95,7 +95,7 @@ void buildAMK(final EncodingResult result, final Variable[] vars, final int rhs)
* @param result the result
* @param vars the variables
* @param rhs the right-hand side
* @throws IllegalArgumentException if the right hand side of the constraint was negative
* @throws IllegalArgumentException if the right-hand side of the constraint was negative
*/
void buildALK(final EncodingResult result, final Variable[] vars, final int rhs) {
final LNGVector<Variable> cardinalityOutvars = this.initializeConstraint(result, vars);
Expand All @@ -111,7 +111,7 @@ void buildALK(final EncodingResult result, final Variable[] vars, final int rhs)
* Builds an exactly-k constraint.
* @param vars the variables
* @param rhs the right-hand side
* @throws IllegalArgumentException if the right hand side of the constraint was negative
* @throws IllegalArgumentException if the right-hand side of the constraint was negative
*/
void buildEXK(final EncodingResult result, final Variable[] vars, final int rhs) {
final LNGVector<Variable> cardinalityOutvars = this.initializeConstraint(result, vars);
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/org/logicng/collections/LNGBooleanVector.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public LNGBooleanVector() {
* Creates a vector with a given capacity.
* @param size the capacity of the vector.
*/
public LNGBooleanVector(int size) {
public LNGBooleanVector(final int size) {
this.elements = new boolean[size];
}

Expand All @@ -64,7 +64,7 @@ public LNGBooleanVector(int size) {
* @param size the capacity of the vector
* @param pad the initial element
*/
public LNGBooleanVector(int size, boolean pad) {
public LNGBooleanVector(final int size, final boolean pad) {
this.elements = new boolean[size];
Arrays.fill(this.elements, pad);
this.size = size;
Expand Down Expand Up @@ -117,7 +117,7 @@ public boolean back() {
* @param element the element to push
*/
public void push(final boolean element) {
int newSize = this.size + 1;
final int newSize = this.size + 1;
this.ensure(newSize);
this.elements[this.size++] = element;
}
Expand All @@ -137,7 +137,7 @@ public void unsafePush(final boolean element) {
* @return the element at the position
* @throws ArrayIndexOutOfBoundsException if the position is not found in the vector
*/
public boolean get(int position) {
public boolean get(final int position) {
return this.elements[position];
}

Expand All @@ -147,7 +147,7 @@ public boolean get(int position) {
* @param element the element
* @throws ArrayIndexOutOfBoundsException if the position is not found in the vector
*/
public void set(int position, boolean element) {
public void set(final int position, final boolean element) {
this.elements[position] = element;
}

Expand All @@ -159,11 +159,11 @@ public void pop() {
}

/**
* Shrinks the vector to a given size if the new size is less then the current size. Otherwise the size remains
* Shrinks the vector to a given size if the new size is less than the current size. Otherwise, the size remains
* the same.
* @param newSize the new size
*/
public void shrinkTo(int newSize) {
public void shrinkTo(final int newSize) {
if (newSize < this.size) {
this.size = newSize;
}
Expand All @@ -174,7 +174,7 @@ public void shrinkTo(int newSize) {
* @param size the new size
* @param pad the value for new elements
*/
public void growTo(int size, boolean pad) {
public void growTo(final int size, final boolean pad) {
if (this.size >= size) {
return;
}
Expand All @@ -190,7 +190,7 @@ public void growTo(int size, boolean pad) {
* @param num the number of elements to remove.
* @throws ArrayIndexOutOfBoundsException if the number of elements to remove is larger than the size of the vector
*/
public void removeElements(int num) {
public void removeElements(final int num) {
int count = num;
while (count-- > 0) {
this.elements[--this.size] = false;
Expand All @@ -202,7 +202,7 @@ public void removeElements(int num) {
*/
public void reverseInplace() {
for (int i = 0; i < this.size / 2; i++) {
boolean temp = this.elements[i];
final boolean temp = this.elements[i];
this.elements[i] = this.elements[this.size - i - 1];
this.elements[this.size() - i - 1] = temp;
}
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/org/logicng/collections/LNGByteVector.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public LNGByteVector() {
* Creates a vector with a given capacity.
* @param size the capacity of the vector.
*/
public LNGByteVector(int size) {
public LNGByteVector(final int size) {
this.elements = new byte[size];
}

Expand All @@ -64,7 +64,7 @@ public LNGByteVector(int size) {
* @param size the capacity of the vector
* @param pad the initial element
*/
public LNGByteVector(int size, byte pad) {
public LNGByteVector(final int size, final byte pad) {
this.elements = new byte[size];
Arrays.fill(this.elements, pad);
this.size = size;
Expand Down Expand Up @@ -117,7 +117,7 @@ public int back() {
* @param element the element to push
*/
public void push(final byte element) {
int newSize = this.size + 1;
final int newSize = this.size + 1;
this.ensure(newSize);
this.elements[this.size++] = element;
}
Expand All @@ -137,7 +137,7 @@ public void unsafePush(final byte element) {
* @return the element at the position
* @throws ArrayIndexOutOfBoundsException if the position is not found in the vector
*/
public byte get(int position) {
public byte get(final int position) {
return this.elements[position];
}

Expand All @@ -147,7 +147,7 @@ public byte get(int position) {
* @param element the element
* @throws ArrayIndexOutOfBoundsException if the position is not found in the vector
*/
public void set(int position, byte element) {
public void set(final int position, final byte element) {
this.elements[position] = element;
}

Expand All @@ -159,11 +159,11 @@ public void pop() {
}

/**
* Shrinks the vector to a given size if the new size is less then the current size. Otherwise the size remains
* Shrinks the vector to a given size if the new size is less than the current size. Otherwise, the size remains
* the same.
* @param newSize the new size
*/
public void shrinkTo(int newSize) {
public void shrinkTo(final int newSize) {
if (newSize < this.size) {
this.size = newSize;
}
Expand All @@ -174,7 +174,7 @@ public void shrinkTo(int newSize) {
* @param size the new size
* @param pad the value for new elements
*/
public void growTo(int size, byte pad) {
public void growTo(final int size, final byte pad) {
if (this.size >= size) {
return;
}
Expand All @@ -190,7 +190,7 @@ public void growTo(int size, byte pad) {
* @param num the number of elements to remove.
* @throws ArrayIndexOutOfBoundsException if the number of elements to remove is larger than the size of the vector
*/
public void removeElements(int num) {
public void removeElements(final int num) {
int count = num;
while (count-- > 0) {
this.elements[--this.size] = -1;
Expand All @@ -217,7 +217,7 @@ public void sort() {
public void sortReverse() {
Arrays.sort(this.elements, 0, this.size);
for (int i = 0; i < this.size / 2; i++) {
byte temp = this.elements[i];
final byte temp = this.elements[i];
this.elements[i] = this.elements[this.size - i - 1];
this.elements[this.size - i - 1] = temp;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public void rescore(final double factor) {
}

/**
* Compares two elements by their priority and returns whether the first element's priority is less then the second
* Compares two elements by their priority and returns whether the first element's priority is less than the second
* element's priority.
* @param e1 the first element
* @param e2 the second element
Expand Down
Loading

0 comments on commit a06339f

Please sign in to comment.