Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public APMatrix removeCross(int r, int c)
- {
- r-=1;
- c-=1;
- if (r > getRows() || c > getColumns())
- {
- System.out.println("ur bad @ dimensions REKT GG");
- System.out.println("have the original instead");
- return this;
- }
- else
- {
- APMatrix copy = new APMatrix(matrix.length-1, matrix[0].length-1, false);
- for(int i = 0; i < copy.getRows(); i++)
- {
- for(int j = 0; j < copy.getColumns(); j++)
- {
- if ((i < r)&& (j< c))
- {
- copy.matrix[i][j] = matrix[i][j];
- }
- else if (i == r || j == c)
- {
- continue;
- }
- else if (i > r || j > c)
- {
- if (i > r && j > c)
- {
- copy.matrix[i][j] = matrix[i+1][j+1];
- }
- else if (i > r)
- {
- copy.matrix[i][j] = matrix[i+1][j];
- }
- else if (j > c)
- {
- copy.matrix[i][j] = matrix[i][j+1];
- }
- }
- }
- }
- return copy;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement