deprecated an old style exception that was forgotten
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@981243 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
accccd996a
commit
2431890261
|
@ -1020,7 +1020,7 @@ public abstract class AbstractFieldMatrix<T extends FieldElement<T>> implements
|
|||
*/
|
||||
protected void checkRowIndex(final int row) {
|
||||
if (row < 0 || row >= getRowDimension()) {
|
||||
throw new MatrixIndexException("row index {0} out of allowed range [{1}, {2}]",
|
||||
throw new MatrixIndexException(LocalizedFormats.ROW_INDEX_OUT_OF_RANGE,
|
||||
row, 0, getRowDimension() - 1);
|
||||
}
|
||||
}
|
||||
|
@ -1033,7 +1033,7 @@ public abstract class AbstractFieldMatrix<T extends FieldElement<T>> implements
|
|||
protected void checkColumnIndex(final int column)
|
||||
throws MatrixIndexException {
|
||||
if (column < 0 || column >= getColumnDimension()) {
|
||||
throw new MatrixIndexException("column index {0} out of allowed range [{1}, {2}]",
|
||||
throw new MatrixIndexException(LocalizedFormats.COLUMN_INDEX_OUT_OF_RANGE,
|
||||
column, 0, getColumnDimension() - 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,9 +69,8 @@ public abstract class AbstractRealVector implements RealVector {
|
|||
protected void checkIndex(final int index)
|
||||
throws MatrixIndexException {
|
||||
if (index < 0 || index >= getDimension()) {
|
||||
throw new MatrixIndexException(
|
||||
"index {0} out of allowed range [{1}, {2}]",
|
||||
index, 0, getDimension() - 1);
|
||||
throw new MatrixIndexException(LocalizedFormats.INDEX_OUT_OF_RANGE,
|
||||
index, 0, getDimension() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -794,9 +794,8 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
|
|||
private void checkIndex(final int index)
|
||||
throws MatrixIndexException {
|
||||
if (index < 0 || index >= getDimension()) {
|
||||
throw new MatrixIndexException(
|
||||
"index {0} out of allowed range [{1}, {2}]",
|
||||
index, 0, getDimension() - 1);
|
||||
throw new MatrixIndexException(LocalizedFormats.INDEX_OUT_OF_RANGE,
|
||||
index, 0, getDimension() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,9 @@ public class MatrixIndexException extends MathRuntimeException {
|
|||
* Constructs a new instance with specified formatted detail message.
|
||||
* @param pattern format specifier
|
||||
* @param arguments format arguments
|
||||
* @deprecated as of 2.2 replaced by {@link #MatrixIndexException(Localizable, Object...)}
|
||||
*/
|
||||
@Deprecated
|
||||
public MatrixIndexException(final String pattern, final Object ... arguments) {
|
||||
this(new DummyLocalizable(pattern), arguments);
|
||||
}
|
||||
|
|
|
@ -529,7 +529,7 @@ public class MatrixUtils {
|
|||
*/
|
||||
public static void checkRowIndex(final AnyMatrix m, final int row) {
|
||||
if (row < 0 || row >= m.getRowDimension()) {
|
||||
throw new MatrixIndexException("row index {0} out of allowed range [{1}, {2}]",
|
||||
throw new MatrixIndexException(LocalizedFormats.ROW_INDEX_OUT_OF_RANGE,
|
||||
row, 0, m.getRowDimension() - 1);
|
||||
}
|
||||
}
|
||||
|
@ -543,7 +543,7 @@ public class MatrixUtils {
|
|||
public static void checkColumnIndex(final AnyMatrix m, final int column)
|
||||
throws MatrixIndexException {
|
||||
if (column < 0 || column >= m.getColumnDimension()) {
|
||||
throw new MatrixIndexException("column index {0} out of allowed range [{1}, {2}]",
|
||||
throw new MatrixIndexException(LocalizedFormats.COLUMN_INDEX_OUT_OF_RANGE,
|
||||
column, 0, m.getColumnDimension() - 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -549,9 +549,8 @@ public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector
|
|||
*/
|
||||
private void checkIndex(final int index) throws MatrixIndexException {
|
||||
if (index < 0 || index >= getDimension()) {
|
||||
throw new MatrixIndexException(
|
||||
"index {0} out of allowed range [{1}, {2}]",
|
||||
index, 0, getDimension() - 1);
|
||||
throw new MatrixIndexException(LocalizedFormats.INDEX_OUT_OF_RANGE,
|
||||
index, 0, getDimension() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package org.apache.commons.math.linear;
|
||||
|
||||
import org.apache.commons.math.util.LocalizedFormats;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
|
@ -27,9 +29,10 @@ public class MatrixIndexExceptionTest extends TestCase {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public void testConstructorMessage(){
|
||||
String msg = "message";
|
||||
MatrixIndexException ex = new MatrixIndexException(msg);
|
||||
assertEquals(msg, ex.getMessage());
|
||||
public void testParameter(){
|
||||
MatrixIndexException ex = new MatrixIndexException(LocalizedFormats.INDEX_OUT_OF_RANGE, 12, 0, 5);
|
||||
assertEquals(12, ex.getArguments()[0]);
|
||||
assertEquals(0, ex.getArguments()[1]);
|
||||
assertEquals(5, ex.getArguments()[2]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue