1 /*
2 * SPDX-FileCopyrightText: none
3 * SPDX-License-Identifier: CC0-1.0
4 */
5
6 package dev.metaschema.core.metapath.function;
7
8 import java.util.List;
9
10 import dev.metaschema.core.metapath.DynamicContext;
11 import dev.metaschema.core.metapath.MetapathException;
12 import dev.metaschema.core.metapath.item.IItem;
13 import dev.metaschema.core.metapath.item.ISequence;
14 import edu.umd.cs.findbugs.annotations.NonNull;
15 import edu.umd.cs.findbugs.annotations.Nullable;
16
17 /**
18 * This functional interface provides a dispatch method for executing a function
19 * call.
20 */
21 @FunctionalInterface
22 public interface IFunctionExecutor {
23 /**
24 * Execute the provided function using the provided arguments, dynamic context,
25 * and focus.
26 *
27 * @param function
28 * the signature of the function
29 * @param arguments
30 * the function arguments
31 * @param dynamicContext
32 * the dynamic evaluation context
33 * @param focus
34 * the current focus
35 * @return a sequence containing the result of the execution
36 * @throws MetapathException
37 * if an error occurred while executing the function
38 */
39 @NonNull
40 ISequence<?> execute(
41 @NonNull IFunction function,
42 @NonNull List<ISequence<?>> arguments,
43 @NonNull DynamicContext dynamicContext,
44 @Nullable IItem focus);
45 }