In AbstractRealMatrix, provided empty implementations to methods

- createMatrix(int, int),
  - copy(),
  - getEntry(int, int),
  - setEntry(int, int).
This allows the use of the @Override tag in classes Array2DRowRealMatrix, BlockRealMatrix,
OpenMapRealMatrix with java 5.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1390302 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastien Brisard 2012-09-26 07:24:35 +00:00
parent 774257e3a7
commit 2ff6587c4e
4 changed files with 32 additions and 0 deletions

View File

@ -957,4 +957,24 @@ public abstract class AbstractRealMatrix
}
return ret;
}
/*
* Empty implementations of these methods are provided in order to allow for
* the use of the @Override tag with Java 1.5.
*/
/** {@inheritDoc} */
public abstract RealMatrix createMatrix(int rowDimension, int columnDimension)
throws NotStrictlyPositiveException;
/** {@inheritDoc} */
public abstract RealMatrix copy();
/** {@inheritDoc} */
public abstract double getEntry(int row, int column)
throws OutOfRangeException;
/** {@inheritDoc} */
public abstract void setEntry(int row, int column, double value);
}

View File

@ -138,6 +138,7 @@ public class Array2DRowRealMatrix extends AbstractRealMatrix implements Serializ
}
/** {@inheritDoc} */
@Override
public RealMatrix createMatrix(final int rowDimension,
final int columnDimension)
throws NotStrictlyPositiveException {
@ -145,6 +146,7 @@ public class Array2DRowRealMatrix extends AbstractRealMatrix implements Serializ
}
/** {@inheritDoc} */
@Override
public RealMatrix copy() {
return new Array2DRowRealMatrix(copyOut(), false);
}
@ -298,6 +300,7 @@ public class Array2DRowRealMatrix extends AbstractRealMatrix implements Serializ
}
/** {@inheritDoc} */
@Override
public double getEntry(final int row, final int column)
throws OutOfRangeException {
MatrixUtils.checkMatrixIndex(this, row, column);
@ -305,6 +308,7 @@ public class Array2DRowRealMatrix extends AbstractRealMatrix implements Serializ
}
/** {@inheritDoc} */
@Override
public void setEntry(final int row, final int column, final double value)
throws OutOfRangeException {
MatrixUtils.checkMatrixIndex(this, row, column);

View File

@ -266,11 +266,13 @@ public class BlockRealMatrix extends AbstractRealMatrix implements Serializable
}
/** {@inheritDoc} */
@Override
public BlockRealMatrix createMatrix(final int rowDimension, final int columnDimension) {
return new BlockRealMatrix(rowDimension, columnDimension);
}
/** {@inheritDoc} */
@Override
public BlockRealMatrix copy() {
// create an empty matrix
BlockRealMatrix copied = new BlockRealMatrix(rows, columns);
@ -1126,6 +1128,7 @@ public class BlockRealMatrix extends AbstractRealMatrix implements Serializable
}
/** {@inheritDoc} */
@Override
public double getEntry(final int row, final int column) {
MatrixUtils.checkMatrixIndex(this, row, column);
final int iBlock = row / BLOCK_SIZE;
@ -1136,6 +1139,7 @@ public class BlockRealMatrix extends AbstractRealMatrix implements Serializable
}
/** {@inheritDoc} */
@Override
public void setEntry(final int row, final int column, final double value) {
MatrixUtils.checkMatrixIndex(this, row, column);
final int iBlock = row / BLOCK_SIZE;

View File

@ -69,11 +69,13 @@ public class OpenMapRealMatrix extends AbstractRealMatrix
}
/** {@inheritDoc} */
@Override
public OpenMapRealMatrix copy() {
return new OpenMapRealMatrix(this);
}
/** {@inheritDoc} */
@Override
public OpenMapRealMatrix createMatrix(int rowDimension, int columnDimension) {
return new OpenMapRealMatrix(rowDimension, columnDimension);
}
@ -209,6 +211,7 @@ public class OpenMapRealMatrix extends AbstractRealMatrix
}
/** {@inheritDoc} */
@Override
public double getEntry(int row, int column) {
MatrixUtils.checkRowIndex(this, row);
MatrixUtils.checkColumnIndex(this, column);
@ -222,6 +225,7 @@ public class OpenMapRealMatrix extends AbstractRealMatrix
}
/** {@inheritDoc} */
@Override
public void setEntry(int row, int column, double value) {
MatrixUtils.checkRowIndex(this, row);
MatrixUtils.checkColumnIndex(this, column);