Package org.protelis.lang.datatype
Class Fields
- java.lang.Object
-
- org.protelis.lang.datatype.Fields
-
public final class Fields extends java.lang.ObjectUtility class forField.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T,R>
Field<R>apply(java.util.function.BiFunction<T,java.lang.Object[],R> fun, boolean fieldTarget, int[] fieldIndices, T target, java.lang.Object... args)static Field<java.lang.Object>apply(java.util.function.BinaryOperator<java.lang.Object> fun, int[] fields, java.lang.Object a, java.lang.Object b)static <R> Field<R>apply(java.util.function.Function<java.lang.Object[],R> fun, boolean fieldTarget, int[] fieldIndexes, java.lang.Object target, java.lang.Object... args)static <R> Field<R>apply(java.util.function.Function<java.lang.Object[],R> fun, int[] fieldIndexes, java.lang.Object... args)static <R> Field<R>apply(TriFunction<java.lang.Object,java.lang.Object,java.lang.Object,R> fun, int[] fields, java.lang.Object a, java.lang.Object b, java.lang.Object c)static Field<java.lang.Object>applyWithSingleParam(java.util.function.UnaryOperator<java.lang.Object> fun, int[] fields, java.lang.Object a)
-
-
-
Method Detail
-
applyWithSingleParam
public static Field<java.lang.Object> applyWithSingleParam(java.util.function.UnaryOperator<java.lang.Object> fun, int[] fields, java.lang.Object a)
- Parameters:
fun- theUnaryOperatorto applyfields- an array of integers containing the indexes of the arguments that are fieldsa- the single parameter- Returns:
- the result of the execution of fun(a)
-
apply
public static Field<java.lang.Object> apply(java.util.function.BinaryOperator<java.lang.Object> fun, int[] fields, java.lang.Object a, java.lang.Object b)
- Parameters:
fun- the 2-ary function to apply, in form of aBinaryOperatorfields- an array of integers containing the indexes of the arguments that are fieldsa- the first parameterb- the second parameter- Returns:
- the result of the execution of fun(a, b)
-
apply
public static <R> Field<R> apply(TriFunction<java.lang.Object,java.lang.Object,java.lang.Object,R> fun, int[] fields, java.lang.Object a, java.lang.Object b, java.lang.Object c)
- Type Parameters:
R- result field type- Parameters:
fun- theTriFunctionto applyfields- an array of integers containing the indexes of the arguments that are fieldsa- the first parameterb- the second parameterc- the third parameter- Returns:
- the result of the execution of fun(a, b, c)
-
apply
public static <R> Field<R> apply(java.util.function.Function<java.lang.Object[],R> fun, int[] fieldIndexes, java.lang.Object... args)
- Type Parameters:
R- result field type- Parameters:
fun- the function to apply.fieldIndexes- the indexes of which among the arguments are fieldsargs- the arguments- Returns:
- a new field resulting from the application of the
Functionto the target and the arguments
-
apply
public static <R> Field<R> apply(java.util.function.Function<java.lang.Object[],R> fun, boolean fieldTarget, int[] fieldIndexes, java.lang.Object target, java.lang.Object... args)
- Type Parameters:
R- result field type- Parameters:
fun- the function to apply.fieldTarget- true if the target is a fieldfieldIndexes- the indexes of which among the arguments are fieldstarget- the object this method will be invoked onargs- the arguments- Returns:
- a new field resulting from the application of the
Functionto the target and the arguments
-
apply
public static <T,R> Field<R> apply(java.util.function.BiFunction<T,java.lang.Object[],R> fun, boolean fieldTarget, int[] fieldIndices, T target, java.lang.Object... args)
- Type Parameters:
T- input field typeR- result field type- Parameters:
fun- the function to apply. It must accept as a first argument the data type carried by the target, and an Object array as second argument (namely, it is a vararg)fieldTarget- true if the target is a fieldfieldIndices- the indexes of which among the arguments are fieldstarget- the object this method will be invoked onargs- the arguments- Returns:
- a new field resulting from the application of the
BiFunctionto the target and the arguments
-
-