Class OpReduction


  • public class OpReduction
    extends Object
    One powerful feature of SciJava Ops is the ability to transform individual Ops to match user requests. In this way, SciJava Ops can satisfy many Op calls with just one implementation.

    Another transformation is called "reduction". This type of transformation allows marked "Nullable" parameters to be omitted from Op requests, in a right-to-left order. For example, if the rightmost parameter to an Op is marked as Nullable, then it can be provided, or omitted, in Op signatures. If the rightmost two parameters are both marked as Nullable, then both can be provided, both can be omitted, or only the rightmost parameter can be omitted.

    Within Ops declaring Nullable parameters, omitted parameters are given null arguments. The Op is thus responsible for null-checking any parameters it declares as Nullable.

    Below, we can see how this works by calling the above Method Op, normally requiring three parameters, with only two parameters.

    • Constructor Detail

      • OpReduction

        public OpReduction()
    • Method Detail

      • nullableMethod

        public static Double nullableMethod​(Double in1,
                                            Double in2,
                                            Double in3)
        An Method annotated to be an Op.
        Parameters:
        in1 - the first input
        in2 - the second input. OPTIONAL.
        in3 - the third input. OPTIONAL.
        Returns:
        the sum of the passed numbers.
        Implementation Note:
        op names="tutorial.reduce"
      • main

        public static void main​(String... args)