Safe handling of internal data.


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1003606 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gilles Sadowski 2010-10-01 18:10:46 +00:00
parent daa37ac393
commit b176f5f469
2 changed files with 22 additions and 8 deletions

View File

@ -50,24 +50,24 @@ public class MatrixDimensionMismatchException extends MultiDimensionMismatchExce
* @return the expected row dimension.
*/
public int getWrongRowDimension() {
return getWrongDimensions()[0];
return getWrongDimension(0);
}
/**
* @return the expected row dimension.
*/
public int getExpectedRowDimension() {
return getExpectedDimensions()[0];
return getExpectedDimension(0);
}
/**
* @return the wrong column dimension.
*/
public int getWrongColumnDimension() {
return getWrongDimensions()[1];
return getWrongDimension(1);
}
/**
* @return the expected column dimension.
*/
public int getExpectedColumnDimension() {
return getExpectedDimensions()[1];
return getExpectedDimension(1);
}
}

View File

@ -62,15 +62,29 @@ public class MultiDimensionMismatchException extends MathIllegalArgumentExceptio
}
/**
* @return a reference to the array containing the wrong dimensions.
* @return an array containing the wrong dimensions.
*/
public Integer[] getWrongDimensions() {
return wrong;
return wrong.clone();
}
/**
* @return a reference to the array containing the expected dimensions.
* @return an array containing the expected dimensions.
*/
public Integer[] getExpectedDimensions() {
return expected;
return expected.clone();
}
/**
* @param index Dimension index.
* @return the wrong dimension stored at {@code index}.
*/
public int getWrongDimension(int index) {
return wrong[index];
}
/**
* @return an the expected dimension stored at {@code index}..
*/
public int getExpectedDimension(int index) {
return expected[index];
}
}