Skip to content

Commit

Permalink
[wpimath] Remove deprecated MatBuilder constructor (#6956)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzblue authored Aug 14, 2024
1 parent e21e129 commit 55c1c53
Showing 1 changed file with 7 additions and 38 deletions.
45 changes: 7 additions & 38 deletions wpimath/src/main/java/edu/wpi/first/math/MatBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
import java.util.Objects;
import org.ejml.simple.SimpleMatrix;

/**
* A class for constructing arbitrary RxC matrices.
*
* @param <R> The number of rows of the desired matrix.
* @param <C> The number of columns of the desired matrix.
*/
public class MatBuilder<R extends Num, C extends Num> {
/** A class for constructing arbitrary RxC matrices. */
public final class MatBuilder {
private MatBuilder() {
throw new UnsupportedOperationException("This is a utility class!");
}

/**
* Fills the matrix with the given data, encoded in row major form. (The matrix is filled row by
* row, left to right with the given data).
Expand All @@ -25,7 +24,7 @@ public class MatBuilder<R extends Num, C extends Num> {
* @param <C> The number of columns of the matrix.
* @return The constructed matrix.
*/
public static final <R extends Num, C extends Num> Matrix<R, C> fill(
public static <R extends Num, C extends Num> Matrix<R, C> fill(
Nat<R> rows, Nat<C> cols, double... data) {
if (Objects.requireNonNull(data).length != rows.getNum() * cols.getNum()) {
throw new IllegalArgumentException(
Expand All @@ -39,34 +38,4 @@ public static final <R extends Num, C extends Num> Matrix<R, C> fill(
}
return new Matrix<>(new SimpleMatrix(rows.getNum(), cols.getNum(), true, data));
}

/** Number of rows. */
protected final Nat<R> m_rows;

/** Number of columns. */
protected final Nat<C> m_cols;

/**
* Creates a new {@link MatBuilder} with the given dimensions.
*
* @param rows The number of rows of the matrix.
* @param cols The number of columns of the matrix.
* @deprecated Use {@link MatBuilder#fill} instead.
*/
@Deprecated(since = "2024", forRemoval = true)
public MatBuilder(Nat<R> rows, Nat<C> cols) {
this.m_rows = Objects.requireNonNull(rows);
this.m_cols = Objects.requireNonNull(cols);
}

/**
* Fills the matrix with the given data, encoded in row major form. (The matrix is filled row by
* row, left to right with the given data).
*
* @param data The data to fill the matrix with.
* @return The constructed matrix.
*/
public final Matrix<R, C> fill(double... data) {
return fill(m_rows, m_cols, data);
}
}

0 comments on commit 55c1c53

Please sign in to comment.