Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package nWeb4;
- /**
- * Created by Артем on 16.09.2014.
- */
- public final class Immutable extends MatrixImpl implements Matrix {
- public Immutable(int[][] matrix) {
- super(matrix);
- }
- public Immutable() {
- }
- /* @Override
- public int[][] multiply(int[][] m) {
- return super.multiply(m);
- }*/
- @Override
- public Matrix add(int[][] m) {
- int[][] result = null;
- result = new int[this.matrix.length][this.matrix.length];
- for (int i = 0; i < this.matrix.length; i++) {
- for (int j = 0; j < this.matrix[i].length; j++) {
- result[i][j] = this.matrix[i][j] + m[i][j];
- }
- }
- return new Immutable(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement