I1 - type of first inputI2 - type of second inputO - type of outputpublic interface BinaryOp<I1,I2,O> extends UnaryOp<I1,O>, BinaryInput<I1,I2>
Binary ops come in three major flavors: BinaryComputerOp,
BinaryFunctionOp and BinaryInplaceOp. Additional hybrid types
union these flavors in various combinations: BinaryHybridCF,
BinaryHybridCI1, BinaryHybridCI, BinaryHybridCFI1 and
BinaryHybridCFI.
A binary op may be treated as a UnaryOp by holding the second input
constant, or treated as a NullaryOp by holding both inputs constant.
SpecialOp.Flavor| Modifier and Type | Method and Description |
|---|---|
default int |
getArity()
Gets the op's number of special input parameters.
|
default BinaryOp<I1,I2,O> |
getIndependentInstance()
Gets a reference to an instance of this object which can be used
simultaneously from a second thread while this instance is being used from
"its" thread.
|
default void |
run() |
O |
run(I1 input1,
I2 input2,
O output)
Executes the operation in a type-safe but flexible way.
|
candidates, filterArity, opops, setEnvironmentinitializeO run(I1 input1, I2 input2, O output)
The exact behavior depends on the type of special op.
input1 - first argument to the operationinput2 - second argument to the operationoutput - reference where the operation's result will be storedBinaryComputerOp.run(Object, Object, Object),
BinaryFunctionOp.run(Object, Object, Object),
BinaryInplaceOp.run(Object, Object, Object),
BinaryHybridCF.run(Object, Object, Object)default int getArity()
SpecialOp
Note that this value may be larger than intuition might dictate in certain
scenarios, because UnaryOp extends NullaryOp, and
BinaryOp extends UnaryOp. This allows higher-order ops to
be treated as lower-order by holding the extra input parameters constant.
But it also means that e.g. a BinaryComputerOp which is locally
typed as UnaryComputerOp will report its arity as 2 rather than 1
as one might expect.
default void run()
default BinaryOp<I1,I2,O> getIndependentInstance()
ThreadableIt is expected that subclasses which override this method will narrow the return type appropriately. We do not enforce this at compile time via recursive generics due to their complexity: they introduce a host of typing difficulties.
getIndependentInstance in interface NullaryOp<O>getIndependentInstance in interface SpecialOpgetIndependentInstance in interface ThreadablegetIndependentInstance in interface UnaryOp<I1,O>Copyright © 2014–2022 ImageJ. All rights reserved.