Fix build warnings
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
//Matrix/src/main/java/com/mattrixwv/BigIntegerMatrix.java
|
||||
//Mattrixwv
|
||||
// Created: 02-10-22
|
||||
//Modified: 08-11-24
|
||||
package com.mattrixwv.matrix;
|
||||
|
||||
|
||||
@@ -27,18 +23,17 @@ public class BigIntegerMatrix{
|
||||
|
||||
//?Helper functions
|
||||
/**
|
||||
* Sets the matrix grid to the specified 2D array. Validates the input to ensure
|
||||
* all rows are of equal length.
|
||||
* Validates the input to ensure all rows are of equal length.
|
||||
*
|
||||
* @param grid The 2D array to set as the matrix grid.
|
||||
* @throws InvalidRowSizeException If the rows of the matrix are not all the same length.
|
||||
* @return the new validated grid
|
||||
*/
|
||||
protected void setGrid(BigInteger[][] grid){
|
||||
private BigInteger[][] validateGrid(BigInteger[][] grid){
|
||||
if(grid.length == 0){
|
||||
this.grid = new BigInteger[0][0];
|
||||
return new BigInteger[0][0];
|
||||
}
|
||||
else if(grid[0].length == 0){
|
||||
this.grid = new BigInteger[grid.length][0];
|
||||
return new BigInteger[grid.length][0];
|
||||
}
|
||||
else{
|
||||
//Make sure all rows are the same length
|
||||
@@ -56,9 +51,19 @@ public class BigIntegerMatrix{
|
||||
}
|
||||
|
||||
//Save the new grid
|
||||
this.grid = newGrid;
|
||||
return newGrid;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Sets the matrix grid to the specified 2D array. Validates the input to ensure
|
||||
* all rows are of equal length.
|
||||
*
|
||||
* @param grid The 2D array to set as the matrix grid.
|
||||
* @throws InvalidRowSizeException If the rows of the matrix are not all the same length.
|
||||
*/
|
||||
protected void setGrid(BigInteger[][] grid){
|
||||
this.grid = validateGrid(grid);
|
||||
}
|
||||
/**
|
||||
* Creates a deep copy of the matrix grid.
|
||||
*
|
||||
@@ -159,7 +164,7 @@ public class BigIntegerMatrix{
|
||||
* @param grid The 2D array to initialize the matrix with.
|
||||
*/
|
||||
public BigIntegerMatrix(BigInteger[][] grid){
|
||||
setGrid(grid);
|
||||
this.grid = validateGrid(grid);
|
||||
}
|
||||
/**
|
||||
* Constructs a copy of the specified matrix.
|
||||
@@ -167,7 +172,7 @@ public class BigIntegerMatrix{
|
||||
* @param matrix The matrix to copy.
|
||||
*/
|
||||
public BigIntegerMatrix(BigIntegerMatrix matrix){
|
||||
setGrid(matrix.grid);
|
||||
this.grid = validateGrid(matrix.grid);
|
||||
}
|
||||
/**
|
||||
* Constructs a matrix with the specified number of rows and columns, filled with the specified value.
|
||||
|
||||
Reference in New Issue
Block a user