Package org.djutils.eval
Class F1
java.lang.Object
org.djutils.eval.F1
- All Implemented Interfaces:
org.djutils.base.Identifiable,Function
F1.java. Minimal implementation of one-argument Function with description.
Copyright (c) 2023-2025 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
Nested ClassesModifier and TypeClassDescription(package private) static interfaceInterface for one argument functions. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final F1.OneArgumentFunctionThe zero argument function.(package private) final StringId of the function.(package private) final org.djutils.metadata.MetaDataType of the parameters of this function (also contains name and description).(package private) final Class<?>Type of the result of this function. -
Constructor Summary
ConstructorsConstructorDescriptionF1(String id, Class<?> resultClass, org.djutils.metadata.MetaData metaData, F1.OneArgumentFunction f1) Construct a new one-argument function. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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). -
resultClass
Type of the result of this function. -
f1
The zero argument function.
-
-
Constructor Details
-
F1
F1(String id, Class<?> resultClass, org.djutils.metadata.MetaData metaData, F1.OneArgumentFunction f1) Construct a new one-argument function.- Parameters:
id- name of the function as it must be written in expressionsresultClass- the type of the result of the functionmetaData- meta data of the functionf1- one argument function
-
-
Method Details
-
getId
- Specified by:
getIdin interfaceorg.djutils.base.Identifiable
-
getMetaData
public org.djutils.metadata.MetaData getMetaData()Description copied from interface:FunctionSpecifies the types of the arguments expected by the function.- Specified by:
getMetaDatain interfaceFunction- Returns:
- specification of the arguments expected by the function
-
function
Description copied from interface:FunctionThe function itself.- Specified by:
functionin interfaceFunction- Parameters:
arguments- the arguments of the function- Returns:
- 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
-