- 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 DoubleUnaryOperator
andThen
(DoubleUnaryOperator after) Returns a composed operator that first applies this operator to its input, and then applies the after operator to the result.default RealValuedFunctOps
andThen
(RealValuedFunctOps after) Returns a composed function that first applies this function to its input, and then applies theafter
function to the result.default double
applyAsDouble
(double arg) default DoubleUnaryOperator
compose
(DoubleUnaryOperator before) Returns a composed function that first applies the before function to its input, and then applies this function to the result.default RealValuedFunctOps
compose
(RealValuedFunctOps before) Returns a composed function that first applies thebefore
function to its input, and then applies this function to the result.static RealValuedFunction
identity()
Get the identity function f(x) = x.default int
Get the maximum number of arguments allowed in calls toRealValuedFunctVAOps.valueAt(double...)
.default int
Get the minimum number of arguments allowed in calls toRealValuedFunctVAOps.valueAt(double...)
.double
valueAt
(double arg) Compute the value of a function f for a given argument.default double
valueAt
(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:RealValuedFunctVAOps
Compute the value of a function f for the given arguments.- Specified by:
valueAt
in 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:RealValuedFunctVAOps
Get the minimum number of arguments allowed in calls toRealValuedFunctVAOps.valueAt(double...)
.- Specified by:
minArgLength
in interfaceRealValuedFunctVAOps
- Returns:
- the minimum number of arguments.
-
maxArgLength
default int maxArgLength()Description copied from interface:RealValuedFunctVAOps
Get the maximum number of arguments allowed in calls toRealValuedFunctVAOps.valueAt(double...)
.- Specified by:
maxArgLength
in 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:
applyAsDouble
in interfaceDoubleUnaryOperator
-
andThen
Returns a composed function that first applies this function to its input, and then applies theafter
function 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
after
function - Throws:
NullPointerException
- ifafter
is 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:
andThen
in 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
- ifbefore
is null
-
compose
Returns a composed function that first applies thebefore
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.- 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
- ifbefore
is 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:
compose
in 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
- ifbefore
is null
-