Package org.djutils.eval
Class F2
java.lang.Object
org.djutils.eval.F2
- All Implemented Interfaces:
org.djutils.base.Identifiable
,Function
F2.java. Minimal implementation of two-argument Function with description.
Copyright (c) 2023-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.
- Author:
- Peter Knoppers
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static interface
Interface for two-argument functions. -
Field Summary
Modifier and TypeFieldDescription(package private) final F2.TwoArgumentFunction
The zero argument function.(package private) final String
Id of the function.(package private) final org.djutils.metadata.MetaData
Type of the parameters of this function (also contains name and description). -
Constructor Summary
ConstructorDescriptionF2
(String id, org.djutils.metadata.MetaData metaData, F2.TwoArgumentFunction f2) Construct a new two-argument function. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.djutils.eval.Function
getDescription, getName
-
Field Details
-
id
Id of the function. -
metaData
final org.djutils.metadata.MetaData metaDataType of the parameters of this function (also contains name and description). -
f2
The zero argument function.
-
-
Constructor Details
-
F2
F2(String id, org.djutils.metadata.MetaData metaData, F2.TwoArgumentFunction f2) Construct a new two-argument function.- Parameters:
id
- String; name of the function as it must be written in expressionsmetaData
- MetaData; meta data of the functionf2
- TwoArgumentFunction; two argument function
-
-
Method Details
-
getId
- Specified by:
getId
in interfaceorg.djutils.base.Identifiable
-
getMetaData
public org.djutils.metadata.MetaData getMetaData()Description copied from interface:Function
Specifies the types of the arguments expected by the function.- Specified by:
getMetaData
in interfaceFunction
- Returns:
- MetaData; specification of the arguments expected by the function
-
function
Description copied from interface:Function
The function itself.- Specified by:
function
in interfaceFunction
- Parameters:
arguments
- Object[]; the arguments of the function- Returns:
- Object; the result of the function (must currently be either some type of DoubleScalar or Boolean).
- Throws:
RuntimeException
- thrown when the function is unable to produce a result
-