diff --git a/wpimath/src/main/java/edu/wpi/first/math/MatBuilder.java b/wpimath/src/main/java/edu/wpi/first/math/MatBuilder.java index 46e42f47f4e..68c1c8dd424 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/MatBuilder.java +++ b/wpimath/src/main/java/edu/wpi/first/math/MatBuilder.java @@ -7,13 +7,12 @@ import java.util.Objects; import org.ejml.simple.SimpleMatrix; -/** - * A class for constructing arbitrary RxC matrices. - * - * @param The number of rows of the desired matrix. - * @param The number of columns of the desired matrix. - */ -public class MatBuilder { +/** 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). @@ -25,7 +24,7 @@ public class MatBuilder { * @param The number of columns of the matrix. * @return The constructed matrix. */ - public static final Matrix fill( + public static Matrix fill( Nat rows, Nat cols, double... data) { if (Objects.requireNonNull(data).length != rows.getNum() * cols.getNum()) { throw new IllegalArgumentException( @@ -39,34 +38,4 @@ public static final Matrix fill( } return new Matrix<>(new SimpleMatrix(rows.getNum(), cols.getNum(), true, data)); } - - /** Number of rows. */ - protected final Nat m_rows; - - /** Number of columns. */ - protected final Nat 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 rows, Nat 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 fill(double... data) { - return fill(m_rows, m_cols, data); - } }