Changed private to protected for future overloading

This commit is contained in:
2022-02-03 22:17:33 +00:00
parent b8cfb478e8
commit 125dd365a2

View File

@@ -13,10 +13,10 @@ import com.mattrixwv.matrix.exceptions.InvalidRowSizeException;
public class IntegerMatrix{ public class IntegerMatrix{
private int[][] grid; protected int[][] grid;
//Helper functions //Helper functions
private void setGrid(int[][] grid){ protected void setGrid(int[][] grid){
if(grid.length == 0){ if(grid.length == 0){
grid = new int[0][0]; grid = new int[0][0];
} }
@@ -44,7 +44,7 @@ public class IntegerMatrix{
this.grid = newGrid; this.grid = newGrid;
} }
} }
private int[][] copyGrid(){ protected int[][] copyGrid(){
//Allocate memory for the new grid //Allocate memory for the new grid
int[][] newGrid = new int[grid.length][grid[0].length]; int[][] newGrid = new int[grid.length][grid[0].length];
@@ -58,7 +58,7 @@ public class IntegerMatrix{
//Return the new grid //Return the new grid
return newGrid; return newGrid;
} }
private boolean isSquare(){ protected boolean isSquare(){
if(getNumRows() == 0){ if(getNumRows() == 0){
return false; return false;
} }
@@ -67,7 +67,7 @@ public class IntegerMatrix{
} }
} }
//Returns a matrix with the supplied row and column removed //Returns a matrix with the supplied row and column removed
private IntegerMatrix laplaceExpansionHelper(int row, int col){ protected IntegerMatrix laplaceExpansionHelper(int row, int col){
//Make sure the matrix is square //Make sure the matrix is square
if(!isSquare()){ if(!isSquare()){
throw new InvalidGeometryException("A matrix must be square for you to perform Laplace Expansion"); throw new InvalidGeometryException("A matrix must be square for you to perform Laplace Expansion");