MATH-854: fill the throws clause of all methods.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1380440 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastien Brisard 2012-09-04 03:08:31 +00:00
parent 56a22909a1
commit 4e7d797b1c
1 changed files with 109 additions and 84 deletions

View File

@ -22,6 +22,7 @@ import java.util.NoSuchElementException;
import org.apache.commons.math3.exception.MathUnsupportedOperationException; import org.apache.commons.math3.exception.MathUnsupportedOperationException;
import org.apache.commons.math3.exception.DimensionMismatchException; import org.apache.commons.math3.exception.DimensionMismatchException;
import org.apache.commons.math3.exception.NotPositiveException;
import org.apache.commons.math3.exception.NumberIsTooSmallException; import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.exception.OutOfRangeException; import org.apache.commons.math3.exception.OutOfRangeException;
import org.apache.commons.math3.exception.MathArithmeticException; import org.apache.commons.math3.exception.MathArithmeticException;
@ -69,33 +70,32 @@ public abstract class RealVector {
* *
* @param index Index location of entry to be fetched. * @param index Index location of entry to be fetched.
* @return the vector entry at {@code index}. * @return the vector entry at {@code index}.
* @throws org.apache.commons.math3.exception.OutOfRangeException * @throws OutOfRangeException if the index is not valid.
* if the index is not valid.
* @see #setEntry(int, double) * @see #setEntry(int, double)
*/ */
public abstract double getEntry(int index); public abstract double getEntry(int index) throws OutOfRangeException;
/** /**
* Set a single element. * Set a single element.
* *
* @param index element index. * @param index element index.
* @param value new value for the element. * @param value new value for the element.
* @throws org.apache.commons.math3.exception.OutOfRangeException * @throws OutOfRangeException if the index is not valid.
* if the index is not valid.
* @see #getEntry(int) * @see #getEntry(int)
*/ */
public abstract void setEntry(int index, double value); public abstract void setEntry(int index, double value)
throws OutOfRangeException;
/** /**
* Change an entry at the specified index. * Change an entry at the specified index.
* *
* @param index Index location of entry to be set. * @param index Index location of entry to be set.
* @param increment Value to add to the vector entry. * @param increment Value to add to the vector entry.
* @throws org.apache.commons.math3.exception.OutOfRangeException if * @throws OutOfRangeException if the index is not valid.
* the index is not valid.
* @since 3.0 * @since 3.0
*/ */
public void addToEntry(int index, double increment) { public void addToEntry(int index, double increment)
throws OutOfRangeException {
setEntry(index, getEntry(index) + increment); setEntry(index, getEntry(index) + increment);
} }
@ -121,22 +121,21 @@ public abstract class RealVector {
* @param index index of first element. * @param index index of first element.
* @param n number of elements to be retrieved. * @param n number of elements to be retrieved.
* @return a vector containing n elements. * @return a vector containing n elements.
* @throws org.apache.commons.math3.exception.OutOfRangeException * @throws OutOfRangeException if the index is not valid.
* if the index is not valid. * @throws NotPositiveException if the number of elements is not positive.
* @throws org.apache.commons.math3.exception.NotPositiveException
* if the number of elements is not positive
*/ */
public abstract RealVector getSubVector(int index, int n); public abstract RealVector getSubVector(int index, int n)
throws NotPositiveException, OutOfRangeException;
/** /**
* Set a sequence of consecutive elements. * Set a sequence of consecutive elements.
* *
* @param index index of first element to be set. * @param index index of first element to be set.
* @param v vector containing the values to set. * @param v vector containing the values to set.
* @throws org.apache.commons.math3.exception.OutOfRangeException * @throws OutOfRangeException if the index is not valid.
* if the index is not valid.
*/ */
public abstract void setSubVector(int index, RealVector v); public abstract void setSubVector(int index, RealVector v)
throws OutOfRangeException;
/** /**
* Check whether any coordinate of this vector is {@code NaN}. * Check whether any coordinate of this vector is {@code NaN}.
@ -161,7 +160,8 @@ public abstract class RealVector {
* @throws DimensionMismatchException if the vectors do not * @throws DimensionMismatchException if the vectors do not
* have the same dimension. * have the same dimension.
*/ */
protected void checkVectorDimensions(RealVector v) { protected void checkVectorDimensions(RealVector v)
throws DimensionMismatchException {
checkVectorDimensions(v.getDimension()); checkVectorDimensions(v.getDimension());
} }
@ -172,7 +172,8 @@ public abstract class RealVector {
* @throws DimensionMismatchException if the dimension is * @throws DimensionMismatchException if the dimension is
* inconsistent with the vector size. * inconsistent with the vector size.
*/ */
protected void checkVectorDimensions(int n) { protected void checkVectorDimensions(int n)
throws DimensionMismatchException {
int d = getDimension(); int d = getDimension();
if (d != n) { if (d != n) {
throw new DimensionMismatchException(d, n); throw new DimensionMismatchException(d, n);
@ -185,7 +186,7 @@ public abstract class RealVector {
* @param index Index to check. * @param index Index to check.
* @exception OutOfRangeException if {@code index} is not valid. * @exception OutOfRangeException if {@code index} is not valid.
*/ */
protected void checkIndex(final int index) { protected void checkIndex(final int index) throws OutOfRangeException {
if (index < 0 || if (index < 0 ||
index >= getDimension()) { index >= getDimension()) {
throw new OutOfRangeException(LocalizedFormats.INDEX, throw new OutOfRangeException(LocalizedFormats.INDEX,
@ -201,7 +202,8 @@ public abstract class RealVector {
* @throws OutOfRangeException if {@code start} of {@code end} are not valid * @throws OutOfRangeException if {@code start} of {@code end} are not valid
* @throws NumberIsTooSmallException if {@code end < start} * @throws NumberIsTooSmallException if {@code end < start}
*/ */
protected void checkIndices(final int start, final int end) { protected void checkIndices(final int start, final int end)
throws NumberIsTooSmallException, OutOfRangeException {
final int dim = getDimension(); final int dim = getDimension();
if ((start < 0) || (start >= dim)) { if ((start < 0) || (start >= dim)) {
throw new OutOfRangeException(LocalizedFormats.INDEX, start, 0, throw new OutOfRangeException(LocalizedFormats.INDEX, start, 0,
@ -224,10 +226,10 @@ public abstract class RealVector {
* *
* @param v Vector to be added. * @param v Vector to be added.
* @return {@code this} + {@code v}. * @return {@code this} + {@code v}.
* @throws org.apache.commons.math3.exception.DimensionMismatchException * @throws DimensionMismatchException if {@code v} is not the same size as
* if {@code v} is not the same size as this vector. * {@code this} vector.
*/ */
public RealVector add(RealVector v) { public RealVector add(RealVector v) throws DimensionMismatchException {
checkVectorDimensions(v); checkVectorDimensions(v);
RealVector result = v.copy(); RealVector result = v.copy();
Iterator<Entry> it = sparseIterator(); Iterator<Entry> it = sparseIterator();
@ -245,10 +247,10 @@ public abstract class RealVector {
* *
* @param v Vector to be subtracted. * @param v Vector to be subtracted.
* @return {@code this} - {@code v}. * @return {@code this} - {@code v}.
* @throws org.apache.commons.math3.exception.DimensionMismatchException * @throws DimensionMismatchException if {@code v} is not the same size as
* if {@code v} is not the same size as this vector. * {@code this} vector.
*/ */
public RealVector subtract(RealVector v) { public RealVector subtract(RealVector v) throws DimensionMismatchException {
checkVectorDimensions(v); checkVectorDimensions(v);
RealVector result = v.mapMultiply(-1d); RealVector result = v.mapMultiply(-1d);
Iterator<Entry> it = sparseIterator(); Iterator<Entry> it = sparseIterator();
@ -297,10 +299,10 @@ public abstract class RealVector {
* *
* @param v Vector with which dot product should be computed * @param v Vector with which dot product should be computed
* @return the scalar dot product between this instance and {@code v}. * @return the scalar dot product between this instance and {@code v}.
* @throws org.apache.commons.math3.exception.DimensionMismatchException * @throws DimensionMismatchException if {@code v} is not the same size as
* if {@code v} is not the same size as this vector. * {@code this} vector.
*/ */
public double dotProduct(RealVector v) { public double dotProduct(RealVector v) throws DimensionMismatchException {
checkVectorDimensions(v); checkVectorDimensions(v);
double d = 0; double d = 0;
final int n = getDimension(); final int n = getDimension();
@ -321,7 +323,8 @@ public abstract class RealVector {
* @throws DimensionMismatchException if the dimensions of {@code this} and * @throws DimensionMismatchException if the dimensions of {@code this} and
* {@code v} do not match * {@code v} do not match
*/ */
public double cosine(RealVector v) throws MathArithmeticException { public double cosine(RealVector v) throws DimensionMismatchException,
MathArithmeticException {
final double norm = getNorm(); final double norm = getNorm();
final double vNorm = v.getNorm(); final double vNorm = v.getNorm();
@ -337,8 +340,8 @@ public abstract class RealVector {
* *
* @param v Vector by which instance elements must be divided. * @param v Vector by which instance elements must be divided.
* @return a vector containing this[i] / v[i] for all i. * @return a vector containing this[i] / v[i] for all i.
* @throws org.apache.commons.math3.exception.DimensionMismatchException * @throws DimensionMismatchException if {@code v} is not the same size as
* if {@code v} is not the same size as this vector. * {@code this} vector.
* @deprecated As of version 3.1, this method is deprecated, and will be * @deprecated As of version 3.1, this method is deprecated, and will be
* removed in version 4.0. This decision follows the discussion reported in * removed in version 4.0. This decision follows the discussion reported in
* <a href="https://issues.apache.org/jira/browse/MATH-803?focusedCommentId=13399150#comment-13399150">MATH-803</a>. * <a href="https://issues.apache.org/jira/browse/MATH-803?focusedCommentId=13399150#comment-13399150">MATH-803</a>.
@ -350,15 +353,16 @@ public abstract class RealVector {
* the sake of efficiency). * the sake of efficiency).
*/ */
@Deprecated @Deprecated
public abstract RealVector ebeDivide(RealVector v); public abstract RealVector ebeDivide(RealVector v)
throws DimensionMismatchException;
/** /**
* Element-by-element multiplication. * Element-by-element multiplication.
* *
* @param v Vector by which instance elements must be multiplied * @param v Vector by which instance elements must be multiplied
* @return a vector containing this[i] * v[i] for all i. * @return a vector containing this[i] * v[i] for all i.
* @throws org.apache.commons.math3.exception.DimensionMismatchException * @throws DimensionMismatchException if {@code v} is not the same size as
* if {@code v} is not the same size as this vector. * {@code this} vector.
* @deprecated As of version 3.1, this method is deprecated, and will be * @deprecated As of version 3.1, this method is deprecated, and will be
* removed in version 4.0. This decision follows the discussion reported in * removed in version 4.0. This decision follows the discussion reported in
* <a href="https://issues.apache.org/jira/browse/MATH-803?focusedCommentId=13399150#comment-13399150">MATH-803</a>. * <a href="https://issues.apache.org/jira/browse/MATH-803?focusedCommentId=13399150#comment-13399150">MATH-803</a>.
@ -370,7 +374,8 @@ public abstract class RealVector {
* the sake of efficiency). * the sake of efficiency).
*/ */
@Deprecated @Deprecated
public abstract RealVector ebeMultiply(RealVector v); public abstract RealVector ebeMultiply(RealVector v)
throws DimensionMismatchException;
/** /**
* Distance between two vectors. * Distance between two vectors.
@ -380,13 +385,13 @@ public abstract class RealVector {
* *
* @param v Vector to which distance is requested. * @param v Vector to which distance is requested.
* @return the distance between two vectors. * @return the distance between two vectors.
* @throws org.apache.commons.math3.exception.DimensionMismatchException * @throws DimensionMismatchException if {@code v} is not the same size as
* if {@code v} is not the same size as this vector. * {@code this} vector.
* @see #getL1Distance(RealVector) * @see #getL1Distance(RealVector)
* @see #getLInfDistance(RealVector) * @see #getLInfDistance(RealVector)
* @see #getNorm() * @see #getNorm()
*/ */
public double getDistance(RealVector v) { public double getDistance(RealVector v) throws DimensionMismatchException {
checkVectorDimensions(v); checkVectorDimensions(v);
double d = 0; double d = 0;
Iterator<Entry> it = iterator(); Iterator<Entry> it = iterator();
@ -467,10 +472,11 @@ public abstract class RealVector {
* *
* @param v Vector to which distance is requested. * @param v Vector to which distance is requested.
* @return the distance between two vectors. * @return the distance between two vectors.
* @throws org.apache.commons.math3.exception.DimensionMismatchException * @throws DimensionMismatchException if {@code v} is not the same size as
* if {@code v} is not the same size as this vector. * {@code this} vector.
*/ */
public double getL1Distance(RealVector v) { public double getL1Distance(RealVector v)
throws DimensionMismatchException {
checkVectorDimensions(v); checkVectorDimensions(v);
double d = 0; double d = 0;
Iterator<Entry> it = iterator(); Iterator<Entry> it = iterator();
@ -489,13 +495,14 @@ public abstract class RealVector {
* *
* @param v Vector to which distance is requested. * @param v Vector to which distance is requested.
* @return the distance between two vectors. * @return the distance between two vectors.
* @throws org.apache.commons.math3.exception.DimensionMismatchException * @throws DimensionMismatchException if {@code v} is not the same size as
* if {@code v} is not the same size as this vector. * {@code this} vector.
* @see #getDistance(RealVector) * @see #getDistance(RealVector)
* @see #getL1Distance(RealVector) * @see #getL1Distance(RealVector)
* @see #getLInfNorm() * @see #getLInfNorm()
*/ */
public double getLInfDistance(RealVector v) { public double getLInfDistance(RealVector v)
throws DimensionMismatchException {
checkVectorDimensions(v); checkVectorDimensions(v);
double d = 0; double d = 0;
Iterator<Entry> it = iterator(); Iterator<Entry> it = iterator();
@ -663,12 +670,13 @@ public abstract class RealVector {
* *
* @param v vector onto which instance must be projected. * @param v vector onto which instance must be projected.
* @return projection of the instance onto {@code v}. * @return projection of the instance onto {@code v}.
* @throws MathArithmeticException if {@code this} or {@code v} is the null
* vector
* @throws DimensionMismatchException if {@code v} is not the same size as * @throws DimensionMismatchException if {@code v} is not the same size as
* this vector. * {@code this} vector.
* @throws MathArithmeticException if {@code this} or {@code v} is the null
* vector
*/ */
public RealVector projection(final RealVector v) throws MathArithmeticException { public RealVector projection(final RealVector v)
throws DimensionMismatchException, MathArithmeticException {
final double norm2 = v.dotProduct(v); final double norm2 = v.dotProduct(v);
if (norm2 == 0.0) { if (norm2 == 0.0) {
throw new MathArithmeticException(LocalizedFormats.ZERO_NORM); throw new MathArithmeticException(LocalizedFormats.ZERO_NORM);
@ -841,10 +849,11 @@ public abstract class RealVector {
* @param y Vector with which {@code this} is linearly combined. * @param y Vector with which {@code this} is linearly combined.
* @return a vector containing {@code a * this[i] + b * y[i]} for all * @return a vector containing {@code a * this[i] + b * y[i]} for all
* {@code i}. * {@code i}.
* @throws org.apache.commons.math3.exception.DimensionMismatchException * @throws DimensionMismatchException if {@code y} is not the same size as
* if {@code y} is not the same size as this vector. * {@code this} vector.
*/ */
public RealVector combine(double a, double b, RealVector y) { public RealVector combine(double a, double b, RealVector y)
throws DimensionMismatchException {
return copy().combineToSelf(a, b, y); return copy().combineToSelf(a, b, y);
} }
@ -857,10 +866,11 @@ public abstract class RealVector {
* @param y Vector with which {@code this} is linearly combined. * @param y Vector with which {@code this} is linearly combined.
* @return {@code this}, with components equal to * @return {@code this}, with components equal to
* {@code a * this[i] + b * y[i]} for all {@code i}. * {@code a * this[i] + b * y[i]} for all {@code i}.
* @throws org.apache.commons.math3.exception.DimensionMismatchException * @throws DimensionMismatchException if {@code y} is not the same size as
* if {@code y} is not the same size as this vector. * {@code this} vector.
*/ */
public RealVector combineToSelf(double a, double b, RealVector y) { public RealVector combineToSelf(double a, double b, RealVector y)
throws DimensionMismatchException {
checkVectorDimensions(y); checkVectorDimensions(y);
for (int i = 0; i < getDimension(); i++) { for (int i = 0; i < getDimension(); i++) {
final double xi = getEntry(i); final double xi = getEntry(i);
@ -898,11 +908,12 @@ public abstract class RealVector {
* @param end the index of the last entry to be visited (inclusive) * @param end the index of the last entry to be visited (inclusive)
* @return the value returned by {@link RealVectorPreservingVisitor#end()} * @return the value returned by {@link RealVectorPreservingVisitor#end()}
* at the end of the walk * at the end of the walk
* @throws org.apache.commons.math3.exception.OutOfRangeException if * @throws NumberIsTooSmallException if {@code end < start}.
* the indices are not valid. * @throws OutOfRangeException if the indices are not valid.
*/ */
public double walkInDefaultOrder(final RealVectorPreservingVisitor visitor, public double walkInDefaultOrder(final RealVectorPreservingVisitor visitor,
final int start, final int end) { final int start, final int end)
throws NumberIsTooSmallException, OutOfRangeException {
checkIndices(start, end); checkIndices(start, end);
visitor.start(getDimension(), start, end); visitor.start(getDimension(), start, end);
for (int i = start; i <= end; i++) { for (int i = start; i <= end; i++) {
@ -937,11 +948,12 @@ public abstract class RealVector {
* @param end the index of the last entry to be visited (inclusive) * @param end the index of the last entry to be visited (inclusive)
* @return the value returned by {@link RealVectorPreservingVisitor#end()} * @return the value returned by {@link RealVectorPreservingVisitor#end()}
* at the end of the walk * at the end of the walk
* @throws org.apache.commons.math3.exception.OutOfRangeException if * @throws NumberIsTooSmallException if {@code end < start}.
* the indices are not valid. * @throws OutOfRangeException if the indices are not valid.
*/ */
public double walkInOptimizedOrder(final RealVectorPreservingVisitor visitor, public double walkInOptimizedOrder(final RealVectorPreservingVisitor visitor,
final int start, final int end) { final int start, final int end)
throws NumberIsTooSmallException, OutOfRangeException {
return walkInDefaultOrder(visitor, start, end); return walkInDefaultOrder(visitor, start, end);
} }
@ -972,11 +984,12 @@ public abstract class RealVector {
* @param end the index of the last entry to be visited (inclusive) * @param end the index of the last entry to be visited (inclusive)
* @return the value returned by {@link RealVectorChangingVisitor#end()} * @return the value returned by {@link RealVectorChangingVisitor#end()}
* at the end of the walk * at the end of the walk
* @throws org.apache.commons.math3.exception.OutOfRangeException if * @throws NumberIsTooSmallException if {@code end < start}.
* the indices are not valid. * @throws OutOfRangeException if the indices are not valid.
*/ */
public double walkInDefaultOrder(final RealVectorChangingVisitor visitor, public double walkInDefaultOrder(final RealVectorChangingVisitor visitor,
final int start, final int end) { final int start, final int end)
throws NumberIsTooSmallException, OutOfRangeException {
checkIndices(start, end); checkIndices(start, end);
visitor.start(getDimension(), start, end); visitor.start(getDimension(), start, end);
for (int i = start; i <= end; i++) { for (int i = start; i <= end; i++) {
@ -1011,11 +1024,12 @@ public abstract class RealVector {
* @param end the index of the last entry to be visited (inclusive) * @param end the index of the last entry to be visited (inclusive)
* @return the value returned by {@link RealVectorChangingVisitor#end()} * @return the value returned by {@link RealVectorChangingVisitor#end()}
* at the end of the walk * at the end of the walk
* @throws org.apache.commons.math3.exception.OutOfRangeException if * @throws NumberIsTooSmallException if {@code end < start}.
* the indices are not valid. * @throws OutOfRangeException if the indices are not valid.
*/ */
public double walkInOptimizedOrder(final RealVectorChangingVisitor visitor, public double walkInOptimizedOrder(final RealVectorChangingVisitor visitor,
final int start, final int end) { final int start, final int end)
throws NumberIsTooSmallException, OutOfRangeException {
return walkInDefaultOrder(visitor, start, end); return walkInDefaultOrder(visitor, start, end);
} }
@ -1088,7 +1102,7 @@ public abstract class RealVector {
*/ */
@Override @Override
public boolean equals(Object other) { public boolean equals(Object other) {
throw new UnsupportedOperationException(); throw new MathUnsupportedOperationException();
} }
/** /**
@ -1097,7 +1111,7 @@ public abstract class RealVector {
*/ */
@Override @Override
public int hashCode() { public int hashCode() {
throw new UnsupportedOperationException(); throw new MathUnsupportedOperationException();
} }
/** /**
@ -1272,13 +1286,15 @@ public abstract class RealVector {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public RealVector add(RealVector w) { public RealVector add(RealVector w)
throws DimensionMismatchException {
return v.add(w); return v.add(w);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public RealVector subtract(RealVector w) { public RealVector subtract(RealVector w)
throws DimensionMismatchException {
return v.subtract(w); return v.subtract(w);
} }
@ -1332,25 +1348,29 @@ public abstract class RealVector {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public RealVector ebeMultiply(RealVector w) { public RealVector ebeMultiply(RealVector w)
throws DimensionMismatchException {
return v.ebeMultiply(w); return v.ebeMultiply(w);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public RealVector ebeDivide(RealVector w) { public RealVector ebeDivide(RealVector w)
throws DimensionMismatchException {
return v.ebeDivide(w); return v.ebeDivide(w);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public double dotProduct(RealVector w) { public double dotProduct(RealVector w)
throws DimensionMismatchException {
return v.dotProduct(w); return v.dotProduct(w);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public double cosine(RealVector w) throws MathArithmeticException { public double cosine(RealVector w)
throws DimensionMismatchException, MathArithmeticException {
return v.cosine(w); return v.cosine(w);
} }
@ -1374,19 +1394,22 @@ public abstract class RealVector {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public double getDistance(RealVector w) { public double getDistance(RealVector w)
throws DimensionMismatchException {
return v.getDistance(w); return v.getDistance(w);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public double getL1Distance(RealVector w) { public double getL1Distance(RealVector w)
throws DimensionMismatchException {
return v.getL1Distance(w); return v.getL1Distance(w);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public double getLInfDistance(RealVector w) { public double getLInfDistance(RealVector w)
throws DimensionMismatchException {
return v.getLInfDistance(w); return v.getLInfDistance(w);
} }
@ -1410,7 +1433,7 @@ public abstract class RealVector {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public double getEntry(int index) { public double getEntry(int index) throws OutOfRangeException {
return v.getEntry(index); return v.getEntry(index);
} }
@ -1446,7 +1469,8 @@ public abstract class RealVector {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public RealVector getSubVector(int index, int n) { public RealVector getSubVector(int index, int n)
throws OutOfRangeException, NotPositiveException {
return v.getSubVector(index, n); return v.getSubVector(index, n);
} }
@ -1482,7 +1506,8 @@ public abstract class RealVector {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public RealVector combine(double a, double b, RealVector y) { public RealVector combine(double a, double b, RealVector y)
throws DimensionMismatchException {
return v.combine(a, b, y); return v.combine(a, b, y);
} }
@ -1496,13 +1521,13 @@ public abstract class RealVector {
class UnmodifiableEntry extends Entry { class UnmodifiableEntry extends Entry {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public double getValue() { public double getValue() {
return v.getEntry(getIndex()); return v.getEntry(getIndex());
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public void setValue(double value) { public void setValue(double value) {
throw new MathUnsupportedOperationException(); throw new MathUnsupportedOperationException();
} }
} }