Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wpimath] Remove deprecated MatBuilder constructor #6956

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(
calcmogul marked this conversation as resolved.
Show resolved Hide resolved
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) {
PeterJohnson marked this conversation as resolved.
Show resolved Hide resolved
return fill(m_rows, m_cols, data);
}
}
Loading