Open averbraeck opened 2 hours ago
The class DoubleVector
has several methods that need to throw an IndexOutOfBoundsException
instead of a ValueRuntimeException
:
protected final void checkIndex(final int index)
public final double getSI(final int index)
public S get(final int index)
public final double getInUnit(final int index)
public final double getInUnit(final int index, final U targetUnit)
public final void setSI(final int index, final double valueSI)
public void setInUnit(final int index, final double valueInUnit)
public void setInUnit(final int index, final double valueInUnit, final U valueUnit)
public void set(final int index, final S value)
The method protected final void checkSize(final DoubleVector<?, ?, ?> other)
still throws a ValueRuntimeException
when vectors have unequal size.
The class DoubleVectorData
has a method:
public static DoubleVectorData instantiate(final Map<Integer, ? extends Number> valueMap,
final int size, final Scale scale, final StorageType storageType)
This method threw ValueRuntimeException
for almost everything. Now it throws:
NullPointerException
when values is null, or storageType is nullIllegalArgumentException
when length < 0IndexOutOfBoundsException
when one of the keys is out of range with the given sizeThe class DoubleMatrix
has several methods that need to throw an IndexOutOfBoundsException
instead of a ValueRuntimeException
:
public double getSI(final int row, final int column)
public double getInUnit(final int row, final int column)
public double getInUnit(final int row, final int column, final U targetUnit)
public void setSI(final int row, final int column, final double valueSI)
public void setInUnit(final int row, final int column, final double valueInUnit)
public void setInUnit(final int row, final int column, final double valueInUnit, final U valueUnit)
public void set(final int row, final int column, final S value)
public double[] getRowSI(final int row)
public double[] getColumnSI(final int column)
public S get(final int row, final int column)
public V getRow(final int row)
public V getColumn(final int column)
public S[] getRowScalars(final int row)
public S[] getColumnScalars(final int col)
protected final void checkIndex(final int row, final int col)
protected final void checkRowIndex(final int row)
protected final void checkColumnIndex(final int col)
The methods that expect a square matrix still throw a ValueRuntimeException
when the matrix is not square.
The class FloatVector
has several methods that need to throw an IndexOutOfBoundsException
instead of a ValueRuntimeException
:
protected final void checkIndex(final int index)
public final double getSI(final int index)
public S get(final int index)
public final double getInUnit(final int index)
public final double getInUnit(final int index, final U targetUnit)
public final void setSI(final int index, final float valueSI)
public void setInUnit(final int index, final float valueInUnit)
public void setInUnit(final int index, final float valueInUnit, final U valueUnit)
public void set(final int index, final S value)
The method protected final void checkSize(final FloatVector<?, ?, ?> other)
still throws a ValueRuntimeException
when vectors have unequal size.
The
Vector.get()
abstract class throws aValueRuntimeException
when the index of theget()
method is out of bounds. It should throw anIndexOutOfBoundsException
instead, since it explains the issue much clearer.The same holds for the
Matrix.get(row, column)
. For theMatrix
abstract class, the following methods should also get anIndexOutOfBoundsException
:public abstract V getRow(int row)
public abstract V getColumn(int column)
public abstract S[] getRowScalars(int row)
public abstract S[] getColumnScalars(int column)
Note that the methods
public abstract V getDiagonal()
andpublic abstract S[] getDiagonalScalars()
still throw aValueRuntimeException
when the matrix is not square.