@Test public void plusEqual() { longMatrix.plusEqual(longMatrix); Assert.assertEquals(longMatrix.getTotal(), 26L); }
public void plusEqual(LongMatrix other) { Preconditions.checkArgument(other.rowNum == rowNum && other.colNum == colNum, "Matrix size not the same! The rowNums are {},{}; the colNums are {},{}.", rowNum, other.rowNum, colNum, other.colNum); for (int i = 0; i < rowNum; i++) { for (int j = 0; j < colNum; j++) { matrix[i][j] += other.matrix[i][j]; } } }
LongMatrix implements Serializable { public void plusEqual(LongMatrix other) { Preconditions.checkArgument(other.rowNum == rowNum && other.colNum == colNum, "Matrix size not the same! The rowNums are {},{}; the colNums are {},{}.", rowNum, other.rowNum, colNum, other.colNum); for (int i = 0; i < rowNum; i++) { for (int j = 0; j < colNum; j++) { matrix[i][j] += other.matrix[i][j]; } } } }
LongMatrix implements Serializable { public void plusEqual(LongMatrix other) { Preconditions.checkArgument(other.rowNum == rowNum && other.colNum == colNum, "Matrix size not the same! The rowNums are {},{}; the colNums are {},{}.", rowNum, other.rowNum, colNum, other.colNum); for (int i = 0; i < rowNum; i++) { for (int j = 0; j < colNum; j++) { matrix[i][j] += other.matrix[i][j]; } } } LongMatrix(long[][] matrix); }
LongMatrix implements Serializable { public void plusEqual(LongMatrix other) { Preconditions.checkArgument(other.rowNum == rowNum && other.colNum == colNum, "Matrix size not the same! The rowNums are {},{}; the colNums are {},{}.", rowNum, other.rowNum, colNum, other.colNum); for (int i = 0; i < rowNum; i++) { for (int j = 0; j < colNum; j++) { matrix[i][j] += other.matrix[i][j]; } } } LongMatrix(long[][] matrix); long[][] getMatrix(); int getRowNum(); int getColNum(); void plusEqual(LongMatrix other); long[] getRowSums(); long[] getColSums(); long getTotal(); long getValue(int i, int j); void setValue(int i, int j, long value); }
LongMatrix implements Serializable { public void plusEqual(LongMatrix other) { Preconditions.checkArgument(other.rowNum == rowNum && other.colNum == colNum, "Matrix size not the same! The rowNums are {},{}; the colNums are {},{}.", rowNum, other.rowNum, colNum, other.colNum); for (int i = 0; i < rowNum; i++) { for (int j = 0; j < colNum; j++) { matrix[i][j] += other.matrix[i][j]; } } } LongMatrix(long[][] matrix); long[][] getMatrix(); int getRowNum(); int getColNum(); void plusEqual(LongMatrix other); long[] getRowSums(); long[] getColSums(); long getTotal(); long getValue(int i, int j); void setValue(int i, int j, long value);  }