- All Superinterfaces:
DoubleUnaryOperator,RealValuedFunctVAOps
- All Known Subinterfaces:
NamedFunctionOps
- All Known Implementing Classes:
BezierPolynomial,BSpline,CubicBezierSpline1,CubicSpline,CubicSpline1,CubicSpline2,LeastSquaresFit,LeastSquaresFit.BSpline,LeastSquaresFit.FunctionBasis,LeastSquaresFit.Linear,LeastSquaresFit.NonLinear,LeastSquaresFit.Polynomial,Polynomial,RealValuedFunction,SimFunction
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public interface RealValuedFunctOps
extends DoubleUnaryOperator, RealValuedFunctVAOps
Interface representing a real-valued function.
This interface provides a single method associated with
a real-valued function: methods that compute a function's domain
and its derivatives are missing.
This class was created before the Java interface
DoubleUnaryOperator was defined and consequently this
class was modified to extend DoubleUnaryOperator. Any implementation
that overrides applyAsDouble(double) must
ensure that applyAsDouble(double) and
valueAt(double) return the same value.
-
Method Summary
Modifier and TypeMethodDescriptiondefault DoubleUnaryOperatorandThen(DoubleUnaryOperator after) Returns a composed operator that first applies this operator to its input, and then applies the after operator to the result.default RealValuedFunctOpsandThen(RealValuedFunctOps after) Returns a composed function that first applies this function to its input, and then applies theafterfunction to the result.default doubleapplyAsDouble(double arg) default DoubleUnaryOperatorcompose(DoubleUnaryOperator before) Returns a composed function that first applies the before function to its input, and then applies this function to the result.default RealValuedFunctOpscompose(RealValuedFunctOps before) Returns a composed function that first applies thebeforefunction to its input, and then applies this function to the result.static RealValuedFunctionidentity()Get the identity function f(x) = x.default intGet the maximum number of arguments allowed in calls toRealValuedFunctVAOps.valueAt(double...).default intGet the minimum number of arguments allowed in calls toRealValuedFunctVAOps.valueAt(double...).doublevalueAt(double arg) Compute the value of a function f for a given argument.default doublevalueAt(double... args) Compute the value of a function f for the given arguments.
-
Method Details
-
valueAt
double valueAt(double arg) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Compute the value of a function f for a given argument.- Parameters:
arg- the argument- Returns:
- the value of the function for the specified argument
- Throws:
IllegalArgumentException- the function's argument was out of rangeUnsupportedOperationException- the operation is not supported.IllegalStateException- the function was not fully initialized.
-
valueAt
default double valueAt(double... args) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Description copied from interface:RealValuedFunctVAOpsCompute the value of a function f for the given arguments.- Specified by:
valueAtin interfaceRealValuedFunctVAOps- Parameters:
args- the arguments- Returns:
- the value of the function for the specified argument
- Throws:
IllegalArgumentException- the function's argument was out of rangeUnsupportedOperationException- the operation is not supported.IllegalStateException- the function was not fully initialized.
-
minArgLength
default int minArgLength()Description copied from interface:RealValuedFunctVAOpsGet the minimum number of arguments allowed in calls toRealValuedFunctVAOps.valueAt(double...).- Specified by:
minArgLengthin interfaceRealValuedFunctVAOps- Returns:
- the minimum number of arguments.
-
maxArgLength
default int maxArgLength()Description copied from interface:RealValuedFunctVAOpsGet the maximum number of arguments allowed in calls toRealValuedFunctVAOps.valueAt(double...).- Specified by:
maxArgLengthin interfaceRealValuedFunctVAOps- Returns:
- the maximum number of arguments.
-
identity
Get the identity function f(x) = x.Note this just returns RealValuedFunction.xFunction but is provided by analogy with the interface
Function.- Returns:
- a function that returns its value
-
applyAsDouble
default double applyAsDouble(double arg) - Specified by:
applyAsDoublein interfaceDoubleUnaryOperator
-
andThen
Returns a composed function that first applies this function to its input, and then applies theafterfunction to the result. If evaluation of either function throws an exception, it is relayed to the caller of the composed function.- Parameters:
after- the function to apply to the result of calling this function- Returns:
- a composed function that applies this function and then
applies the
afterfunction - Throws:
NullPointerException- ifafteris null- See Also:
-
andThen
Returns a composed operator that first applies this operator to its input, and then applies the after operator to the result. If evaluation of either operator throws an exception, it is relayed to the caller of the composed operator.- Specified by:
andThenin interfaceDoubleUnaryOperator- Parameters:
after- the operator to apply after this operator is applied- Returns:
- a composed operator that first applies this operator and then applies the after operator
- Throws:
NullPointerException- ifbeforeis null
-
compose
Returns a composed function that first applies thebeforefunction to its input, and then applies this function to the result. If evaluation of either function throws an exception, it is relayed to the caller of the composed function.- Parameters:
before- the function to call to obtain the argument passed to this function- Returns:
- a composed function that first calls the
beforefunction and passes the results to this function - Throws:
NullPointerException- ifbeforeis null
-
compose
Returns a composed function that first applies the before function to its input, and then applies this function to the result. If evaluation of either function throws an exception, it is relayed to the caller of the composed function.- Specified by:
composein interfaceDoubleUnaryOperator- Parameters:
before- the function to call to obtain the argument passed to this function- Returns:
- a composed function that first calls the before function and passes the results to this function
- Throws:
NullPointerException- ifbeforeis null
-