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;
|
package com.mattrixwv.matrix;
|
||||||
|
|
||||||
|
|
||||||
@@ -27,18 +23,17 @@ public class BigIntegerMatrix{
|
|||||||
|
|
||||||
//?Helper functions
|
//?Helper functions
|
||||||
/**
|
/**
|
||||||
* Sets the matrix grid to the specified 2D array. Validates the input to ensure
|
* Validates the input to ensure all rows are of equal length.
|
||||||
* all rows are of equal length.
|
|
||||||
*
|
*
|
||||||
* @param grid The 2D array to set as the matrix grid.
|
* @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){
|
if(grid.length == 0){
|
||||||
this.grid = new BigInteger[0][0];
|
return new BigInteger[0][0];
|
||||||
}
|
}
|
||||||
else if(grid[0].length == 0){
|
else if(grid[0].length == 0){
|
||||||
this.grid = new BigInteger[grid.length][0];
|
return new BigInteger[grid.length][0];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//Make sure all rows are the same length
|
//Make sure all rows are the same length
|
||||||
@@ -56,9 +51,19 @@ public class BigIntegerMatrix{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Save the new grid
|
//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.
|
* 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.
|
* @param grid The 2D array to initialize the matrix with.
|
||||||
*/
|
*/
|
||||||
public BigIntegerMatrix(BigInteger[][] grid){
|
public BigIntegerMatrix(BigInteger[][] grid){
|
||||||
setGrid(grid);
|
this.grid = validateGrid(grid);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Constructs a copy of the specified matrix.
|
* Constructs a copy of the specified matrix.
|
||||||
@@ -167,7 +172,7 @@ public class BigIntegerMatrix{
|
|||||||
* @param matrix The matrix to copy.
|
* @param matrix The matrix to copy.
|
||||||
*/
|
*/
|
||||||
public BigIntegerMatrix(BigIntegerMatrix matrix){
|
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.
|
* Constructs a matrix with the specified number of rows and columns, filled with the specified value.
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
//Matrix/src/main/java/com/mattrixwv/matrix/DoubleMatrix.java
|
|
||||||
//Mattrixwv
|
|
||||||
// Created: 02-07-22
|
|
||||||
//Modified: 08-11-24
|
|
||||||
package com.mattrixwv.matrix;
|
package com.mattrixwv.matrix;
|
||||||
|
|
||||||
|
|
||||||
@@ -30,18 +26,17 @@ public class DoubleMatrix{
|
|||||||
|
|
||||||
//?Helper functions
|
//?Helper functions
|
||||||
/**
|
/**
|
||||||
* Sets the matrix grid to the specified 2D array. Validates the input to ensure
|
* Validates the input to ensure all rows are of equal length.
|
||||||
* all rows are of equal length.
|
|
||||||
*
|
*
|
||||||
* @param grid The 2D array to set as the matrix grid.
|
* @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(double[][] grid){
|
private double[][] validateGrid(double[][] grid){
|
||||||
if(grid.length == 0){
|
if(grid.length == 0){
|
||||||
this.grid = new double[0][0];
|
return new double[0][0];
|
||||||
}
|
}
|
||||||
else if(grid[0].length == 0){
|
else if(grid[0].length == 0){
|
||||||
this.grid = new double[grid.length][0];
|
return new double[grid.length][0];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//Make sure all rows are the same length
|
//Make sure all rows are the same length
|
||||||
@@ -59,9 +54,19 @@ public class DoubleMatrix{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Save the new grid
|
//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(double[][] grid){
|
||||||
|
this.grid = validateGrid(grid);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Creates a deep copy of the matrix grid.
|
* Creates a deep copy of the matrix grid.
|
||||||
*
|
*
|
||||||
@@ -163,7 +168,7 @@ public class DoubleMatrix{
|
|||||||
* @param grid The 2D array to initialize the matrix with.
|
* @param grid The 2D array to initialize the matrix with.
|
||||||
*/
|
*/
|
||||||
public DoubleMatrix(double[][] grid){
|
public DoubleMatrix(double[][] grid){
|
||||||
setGrid(grid);
|
this.grid = validateGrid(grid);
|
||||||
delta = 0.0;
|
delta = 0.0;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -172,7 +177,7 @@ public class DoubleMatrix{
|
|||||||
* @param matrix The matrix to copy.
|
* @param matrix The matrix to copy.
|
||||||
*/
|
*/
|
||||||
public DoubleMatrix(DoubleMatrix matrix){
|
public DoubleMatrix(DoubleMatrix matrix){
|
||||||
setGrid(matrix.grid);
|
this.grid = validateGrid(matrix.grid);
|
||||||
delta = 0.0;
|
delta = 0.0;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
//Matrix/src/main/java/com/mattrixwv/IntegerMatrix.java
|
|
||||||
//Mattrixwv
|
|
||||||
// Created: 02-01-22
|
|
||||||
//Modified: 08-11-24
|
|
||||||
package com.mattrixwv.matrix;
|
package com.mattrixwv.matrix;
|
||||||
|
|
||||||
|
|
||||||
@@ -26,18 +22,17 @@ public class IntegerMatrix{
|
|||||||
|
|
||||||
//?Helper functions
|
//?Helper functions
|
||||||
/**
|
/**
|
||||||
* Sets the matrix grid to the specified 2D array. Validates the input to ensure
|
* Validates that all rows in the grid are of equal length.
|
||||||
* all rows are of equal length.
|
|
||||||
*
|
*
|
||||||
* @param grid The 2D array to set as the matrix grid.
|
* @param grid The 2D array to validate.
|
||||||
* @throws InvalidRowSizeException If the rows of the matrix are not all the same length.
|
* @throws InvalidRowSizeException If the rows of the matrix are not all the same length.
|
||||||
*/
|
*/
|
||||||
protected void setGrid(int[][] grid){
|
private int[][] validateGrid(int[][] grid){
|
||||||
if(grid.length == 0){
|
if(grid.length == 0){
|
||||||
this.grid = new int[0][0];
|
return new int[0][0];
|
||||||
}
|
}
|
||||||
else if(grid[0].length == 0){
|
else if(grid[0].length == 0){
|
||||||
this.grid = new int[grid.length][0];
|
return new int[grid.length][0];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//Make sure all rows are the same length
|
//Make sure all rows are the same length
|
||||||
@@ -55,9 +50,19 @@ public class IntegerMatrix{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Save the new grid
|
//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(int[][] grid){
|
||||||
|
this.grid = validateGrid(grid);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Creates a deep copy of the matrix grid.
|
* Creates a deep copy of the matrix grid.
|
||||||
*
|
*
|
||||||
@@ -158,7 +163,7 @@ public class IntegerMatrix{
|
|||||||
* @param grid The 2D array to initialize the matrix with.
|
* @param grid The 2D array to initialize the matrix with.
|
||||||
*/
|
*/
|
||||||
public IntegerMatrix(int[][] grid){
|
public IntegerMatrix(int[][] grid){
|
||||||
setGrid(grid);
|
this.grid = validateGrid(grid);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Constructs a copy of the specified matrix.
|
* Constructs a copy of the specified matrix.
|
||||||
@@ -166,7 +171,7 @@ public class IntegerMatrix{
|
|||||||
* @param matrix The matrix to copy.
|
* @param matrix The matrix to copy.
|
||||||
*/
|
*/
|
||||||
public IntegerMatrix(IntegerMatrix matrix){
|
public IntegerMatrix(IntegerMatrix 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.
|
* Constructs a matrix with the specified number of rows and columns, filled with the specified value.
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
//Matrix/src/main/java/com/mattrixwv/matrix/LongMatrix.java
|
|
||||||
//Mattrixwv
|
|
||||||
// Created: 02-10-22
|
|
||||||
//Modified: 08-11-24
|
|
||||||
package com.mattrixwv.matrix;
|
package com.mattrixwv.matrix;
|
||||||
|
|
||||||
|
|
||||||
@@ -26,18 +22,17 @@ public class LongMatrix{
|
|||||||
|
|
||||||
//?Helper functions
|
//?Helper functions
|
||||||
/**
|
/**
|
||||||
* Sets the matrix grid to the specified 2D array. Validates the input to ensure
|
* Validates the input to ensure all rows are of equal length.
|
||||||
* all rows are of equal length.
|
|
||||||
*
|
*
|
||||||
* @param grid The 2D array to set as the matrix grid.
|
* @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(long[][] grid){
|
private long[][] validateGrid(long[][] grid){
|
||||||
if(grid.length == 0){
|
if(grid.length == 0){
|
||||||
this.grid = new long[0][0];
|
return new long[0][0];
|
||||||
}
|
}
|
||||||
else if(grid[0].length == 0){
|
else if(grid[0].length == 0){
|
||||||
this.grid = new long[grid.length][0];
|
return new long[grid.length][0];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//Make sure all rows are the same length
|
//Make sure all rows are the same length
|
||||||
@@ -55,9 +50,19 @@ public class LongMatrix{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Save the new grid
|
//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(long[][] grid){
|
||||||
|
this.grid = validateGrid(grid);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Creates a deep copy of the matrix grid.
|
* Creates a deep copy of the matrix grid.
|
||||||
*
|
*
|
||||||
@@ -158,7 +163,7 @@ public class LongMatrix{
|
|||||||
* @param grid The 2D array to initialize the matrix with.
|
* @param grid The 2D array to initialize the matrix with.
|
||||||
*/
|
*/
|
||||||
public LongMatrix(long[][] grid){
|
public LongMatrix(long[][] grid){
|
||||||
setGrid(grid);
|
this.grid = validateGrid(grid);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Constructs a copy of the specified matrix.
|
* Constructs a copy of the specified matrix.
|
||||||
@@ -166,7 +171,7 @@ public class LongMatrix{
|
|||||||
* @param matrix The matrix to copy.
|
* @param matrix The matrix to copy.
|
||||||
*/
|
*/
|
||||||
public LongMatrix(LongMatrix matrix){
|
public LongMatrix(LongMatrix 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.
|
* Constructs a matrix with the specified number of rows and columns, filled with the specified value.
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
//Matrix/src/main/java/com/mattrixwv/matrix/ModMatrix.java
|
|
||||||
//Mattrixwv
|
|
||||||
// Created: 02-09-22
|
|
||||||
//Modified: 08-11-24
|
|
||||||
package com.mattrixwv.matrix;
|
package com.mattrixwv.matrix;
|
||||||
|
|
||||||
|
|
||||||
@@ -17,13 +13,26 @@ import com.mattrixwv.matrix.exceptions.NullMatrixException;
|
|||||||
/**
|
/**
|
||||||
* Represents a matrix of integers that have been run through a modulus function, and provides various matrix operations.
|
* Represents a matrix of integers that have been run through a modulus function, and provides various matrix operations.
|
||||||
*/
|
*/
|
||||||
public class ModMatrix extends IntegerMatrix{
|
public final class ModMatrix extends IntegerMatrix{
|
||||||
/**
|
/**
|
||||||
* The mod used on each element of the matrix
|
* The mod used on each element of the matrix
|
||||||
*/
|
*/
|
||||||
protected int mod;
|
protected int mod;
|
||||||
|
|
||||||
//?Helper functions
|
//?Helper functions
|
||||||
|
/**
|
||||||
|
* Validate the mod values
|
||||||
|
*
|
||||||
|
* @param mod The new mod value
|
||||||
|
* @throws InvalidScalarException If the mod value is less than or equal to 0
|
||||||
|
*/
|
||||||
|
private int validateMod(int mod){
|
||||||
|
if(mod <= 0){
|
||||||
|
throw new InvalidScalarException("The mod must be > 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
return mod;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Set the mod values
|
* Set the mod values
|
||||||
*
|
*
|
||||||
@@ -31,11 +40,7 @@ public class ModMatrix extends IntegerMatrix{
|
|||||||
* @throws InvalidScalarException If the mod value is less than or equal to 0
|
* @throws InvalidScalarException If the mod value is less than or equal to 0
|
||||||
*/
|
*/
|
||||||
protected void setMod(int mod){
|
protected void setMod(int mod){
|
||||||
if(mod <= 0){
|
this.mod = validateMod(mod);
|
||||||
throw new InvalidScalarException("The mod must be > 0");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.mod = mod;
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the mod value of a number
|
* Get the mod value of a number
|
||||||
@@ -103,7 +108,7 @@ public class ModMatrix extends IntegerMatrix{
|
|||||||
*/
|
*/
|
||||||
public ModMatrix(int mod){
|
public ModMatrix(int mod){
|
||||||
super();
|
super();
|
||||||
setMod(mod);
|
this.mod = validateMod(mod);
|
||||||
modGrid();
|
modGrid();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -114,7 +119,7 @@ public class ModMatrix extends IntegerMatrix{
|
|||||||
*/
|
*/
|
||||||
public ModMatrix(int[][] grid, int mod){
|
public ModMatrix(int[][] grid, int mod){
|
||||||
super();
|
super();
|
||||||
setMod(mod);
|
this.mod = validateMod(mod);
|
||||||
setGrid(grid);
|
setGrid(grid);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -124,7 +129,7 @@ public class ModMatrix extends IntegerMatrix{
|
|||||||
*/
|
*/
|
||||||
public ModMatrix(ModMatrix matrix){
|
public ModMatrix(ModMatrix matrix){
|
||||||
super();
|
super();
|
||||||
setMod(matrix.mod);
|
this.mod = validateMod(matrix.mod);
|
||||||
setGrid(matrix.grid);
|
setGrid(matrix.grid);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -135,7 +140,7 @@ public class ModMatrix extends IntegerMatrix{
|
|||||||
*/
|
*/
|
||||||
public ModMatrix(IntegerMatrix matrix, int mod){
|
public ModMatrix(IntegerMatrix matrix, int mod){
|
||||||
super();
|
super();
|
||||||
setMod(mod);
|
this.mod = validateMod(mod);
|
||||||
setGrid(matrix.grid);
|
setGrid(matrix.grid);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -149,7 +154,7 @@ public class ModMatrix extends IntegerMatrix{
|
|||||||
*/
|
*/
|
||||||
public ModMatrix(int rows, int cols, int fill, int mod){
|
public ModMatrix(int rows, int cols, int fill, int mod){
|
||||||
super(rows, cols, fill);
|
super(rows, cols, fill);
|
||||||
setMod(mod);
|
this.mod = validateMod(mod);
|
||||||
modGrid();
|
modGrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user