public final class OpUtils extends Object
Modifier and Type | Method and Description |
---|---|
static Object[] |
args(Object[] latter,
Object... former) |
static String |
getNamespace(String opName)
Gets the namespace portion of the given op name.
|
static String |
getOpName(CommandInfo info)
Gets the string name of an op.
|
static List<ModuleItem<?>> |
inputs(ModuleInfo info)
|
static String |
matchInfo(List<OpCandidate> candidates,
List<OpCandidate> matches)
Gets a string with an analysis of a particular match request failure.
|
static String |
opCall(CommandInfo info)
Returns a method call for the given
Op using its name and the
correct count of parameters. |
static String |
opString(ModuleInfo info)
Gets a string describing the given op.
|
static String |
opString(ModuleInfo info,
ModuleItem<?> special)
Gets a string describing the given op, highlighting the specific parameter.
|
static String |
opString(String name,
Object... args)
Gets a string describing the given op request.
|
static List<ModuleItem<?>> |
outputs(ModuleInfo info)
Gets the given
ModuleInfo 's list of outputs. |
static String |
simpleString(CommandInfo info)
Similar to
opString(ModuleInfo) but prints a cleaner,
more abstract representation of the Op method call in the format
return <= baseOp(param1, param2) . |
static String |
stripNamespace(String opName)
Gets the simple portion (without namespace) of the given op name.
|
static Op |
unwrap(Module module,
Collection<? extends Type> types)
Unwraps the delegate object of the given
Module , ensuring it is an
instance of the specified type(s). |
static Op |
unwrap(Module module,
OpRef ref)
|
public static List<ModuleItem<?>> inputs(ModuleInfo info)
public static List<ModuleItem<?>> outputs(ModuleInfo info)
ModuleInfo
's list of outputs.public static String getNamespace(String opName)
public static String stripNamespace(String opName)
public static Op unwrap(Module module, OpRef ref)
Module
, ensuring it is an
instance whose type matches the specified OpRef
.module
- The module to unwrap.ref
- The OpRef
defining the op's type restrictions.Op
.IllegalStateException
- if the op does not conform to the expected
types.public static Op unwrap(Module module, Collection<? extends Type> types)
Module
, ensuring it is an
instance of the specified type(s).module
- The module to unwrap.types
- Required types for the op.Op
.IllegalStateException
- if the op does not conform to the expected
types.public static String opString(String name, Object... args)
name
- The op's name.args
- The op's input arguments.public static String opString(ModuleInfo info)
info
- The ModuleInfo
metadata which describes the op.public static String opString(ModuleInfo info, ModuleItem<?> special)
info
- The ModuleInfo
metadata which describes the op.special
- A parameter of particular interest when describing the op.public static String simpleString(CommandInfo info)
opString(ModuleInfo)
but prints a cleaner,
more abstract representation of the Op method call in the format
return <= baseOp(param1, param2)
. Intended to be presented to users
as the limited information reduces utility for debugging.public static String opCall(CommandInfo info)
public static String matchInfo(List<OpCandidate> candidates, List<OpCandidate> matches)
This method is used to generate informative exception messages when no matches, or too many matches, are found.
candidates
- The list of already-analyzed candidates from which a
match was desired.matches
- The list of matching candidates with attached Module
instances.OpMatchingService.filterMatches(List)
public static String getOpName(CommandInfo info)
Copyright © 2014–2022 ImageJ. All rights reserved.