MATH-430
Removed uses of deprecated "BinaryFunction" class. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1039450 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ae78e16c8b
commit
215cebe8df
|
@ -23,7 +23,11 @@ import java.util.NoSuchElementException;
|
|||
import org.apache.commons.math.exception.MathUnsupportedOperationException;
|
||||
import org.apache.commons.math.exception.DimensionMismatchException;
|
||||
import org.apache.commons.math.exception.OutOfRangeException;
|
||||
import org.apache.commons.math.analysis.BinaryFunction;
|
||||
import org.apache.commons.math.analysis.FunctionUtils;
|
||||
import org.apache.commons.math.analysis.function.Add;
|
||||
import org.apache.commons.math.analysis.function.Multiply;
|
||||
import org.apache.commons.math.analysis.function.Divide;
|
||||
import org.apache.commons.math.analysis.function.Power;
|
||||
import org.apache.commons.math.analysis.UnivariateRealFunction;
|
||||
import org.apache.commons.math.exception.util.LocalizedFormats;
|
||||
import org.apache.commons.math.util.FastMath;
|
||||
|
@ -154,7 +158,7 @@ public abstract class AbstractRealVector implements RealVector {
|
|||
/** {@inheritDoc} */
|
||||
public RealVector mapAddToSelf(double d) {
|
||||
if (d != 0) {
|
||||
return mapToSelf(BinaryFunction.ADD.fix1stArgument(d));
|
||||
return mapToSelf(FunctionUtils.fix2ndArgument(new Add(), d));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -349,7 +353,7 @@ public abstract class AbstractRealVector implements RealVector {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
public RealVector mapMultiplyToSelf(double d){
|
||||
return mapToSelf(BinaryFunction.MULTIPLY.fix1stArgument(d));
|
||||
return mapToSelf(FunctionUtils.fix2ndArgument(new Multiply(), d));
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
@ -369,7 +373,7 @@ public abstract class AbstractRealVector implements RealVector {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
public RealVector mapDivideToSelf(double d){
|
||||
return mapToSelf(BinaryFunction.DIVIDE.fix2ndArgument(d));
|
||||
return mapToSelf(FunctionUtils.fix2ndArgument(new Divide(), d));
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
@ -379,7 +383,7 @@ public abstract class AbstractRealVector implements RealVector {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
public RealVector mapPowToSelf(double d){
|
||||
return mapToSelf(BinaryFunction.POW.fix2ndArgument(d));
|
||||
return mapToSelf(new Power(d));
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.commons.math.linear;
|
|||
import java.util.Iterator;
|
||||
|
||||
import org.apache.commons.math.analysis.UnivariateRealFunction;
|
||||
import org.apache.commons.math.exception.MathUserException;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -57,9 +56,10 @@ public interface RealVector {
|
|||
*
|
||||
* @param function Function to apply to each entry.
|
||||
* @return this vector.
|
||||
* @throws MathUserException if the function throws it.
|
||||
* @throws org.apache.commons.math.exception.MathUserException
|
||||
* if the function throws it.
|
||||
*/
|
||||
RealVector mapToSelf(UnivariateRealFunction function) throws MathUserException;
|
||||
RealVector mapToSelf(UnivariateRealFunction function);
|
||||
|
||||
/**
|
||||
* Acts as if implemented as:
|
||||
|
@ -67,11 +67,12 @@ public interface RealVector {
|
|||
* return copy().map(function);
|
||||
* </pre>
|
||||
*
|
||||
* @param function Functin to apply to each entry.
|
||||
* @param function Function to apply to each entry.
|
||||
* @return a new vector.
|
||||
* @throws MathUserException if the function throws it.
|
||||
* @throws org.apache.commons.math.exception.MathUserException
|
||||
* if the function throws it.
|
||||
*/
|
||||
RealVector map(UnivariateRealFunction function) throws MathUserException;
|
||||
RealVector map(UnivariateRealFunction function);
|
||||
|
||||
/** Class representing a modifiable entry in the vector. */
|
||||
public abstract class Entry {
|
||||
|
|
Loading…
Reference in New Issue