Class AbstractModule
- java.lang.Object
-
- org.scijava.module.AbstractModule
-
- Direct Known Subclasses:
CommandModule,DefaultMutableModule,ModuleCommand,ScriptModule
public abstract class AbstractModule extends Object implements Module
Abstract superclass ofModuleimplementations.By default, input and output values are stored in
HashMaps.- Author:
- Curtis Rueden
-
-
Constructor Summary
Constructors Constructor Description AbstractModule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Performs necessary cleanup in response to cancellation of the module execution.ObjectgetDelegateObject()Gets the object containing the module's actual implementation.ObjectgetInput(String name)Gets the value of the input with the given name.Map<String,Object>getInputs()Gets a table of input values.ObjectgetOutput(String name)Gets the value of the output with the given name.Map<String,Object>getOutputs()Gets a table of output values.voidinitialize()Initializes the module.booleanisInputResolved(String name)Gets the resolution status of the input with the given name.booleanisOutputResolved(String name)Gets the resolution status of the output with the given name.voidpreview()Computes a preview of the module's execution results, if available.voidresolveInput(String name)Marks the input with the given name as resolved.voidresolveOutput(String name)Marks the output with the given name as resolved.voidsetInput(String name, Object value)Sets the value of the input with the given name.voidsetInputs(Map<String,Object> inputs)Sets input values according to the given table.voidsetOutput(String name, Object value)Sets the value of the output with the given name.voidsetOutputs(Map<String,Object> outputs)Sets output values according to the given table.voidunresolveInput(String name)Marks the input with the given name as unresolved.voidunresolveOutput(String name)Marks the output with the given name as unresolved.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.scijava.module.Module
getInfo, isResolved, setResolved
-
-
-
-
Method Detail
-
preview
public void preview()
Description copied from interface:ModuleComputes a preview of the module's execution results, if available. A preview is a quick approximation of the results that would be obtained by actually executing the module withRunnable.run(). Not all modules support previews.- Specified by:
previewin interfaceModule- See Also:
ModuleInfo.canPreview()
-
cancel
public void cancel()
Description copied from interface:ModulePerforms necessary cleanup in response to cancellation of the module execution. This is useful in conjunction withModule.preview()to undo any changes made as a result of the preview.- Specified by:
cancelin interfaceModule- See Also:
ModuleInfo.canCancel()
-
initialize
public void initialize() throws MethodCallExceptionDescription copied from interface:ModuleInitializes the module.First, the module's global initializer method (if any) is called, followed by each individual
ModuleIteminitializer method (i.e.,ModuleItem.initialize(Module)).- Specified by:
initializein interfaceModule- Throws:
MethodCallException- See Also:
ModuleInfo.getInitializer(),ModuleItem.initialize(Module)
-
getDelegateObject
public Object getDelegateObject()
Description copied from interface:ModuleGets the object containing the module's actual implementation. By definition, this is an object whose fully qualified class name is given bygetInfo().getDelegateClassName(). This object must possess all callback methods specified byModuleItem.getCallback().The nature of this method is implementation-specific; e.g., a
CommandModulewill return its associatedCommand. For modules that are not plugins, the result may be something else. If you are implementing this interface directly, a good rule of thumb is to returnthis.- Specified by:
getDelegateObjectin interfaceModule
-
getInput
public Object getInput(String name)
Description copied from interface:ModuleGets the value of the input with the given name.
-
getOutput
public Object getOutput(String name)
Description copied from interface:ModuleGets the value of the output with the given name.
-
getInputs
public Map<String,Object> getInputs()
Description copied from interface:ModuleGets a table of input values.
-
getOutputs
public Map<String,Object> getOutputs()
Description copied from interface:ModuleGets a table of output values.- Specified by:
getOutputsin interfaceModule
-
setInput
public void setInput(String name, Object value)
Description copied from interface:ModuleSets the value of the input with the given name.
-
setOutput
public void setOutput(String name, Object value)
Description copied from interface:ModuleSets the value of the output with the given name.
-
setInputs
public void setInputs(Map<String,Object> inputs)
Description copied from interface:ModuleSets input values according to the given table.
-
setOutputs
public void setOutputs(Map<String,Object> outputs)
Description copied from interface:ModuleSets output values according to the given table.- Specified by:
setOutputsin interfaceModule
-
isInputResolved
public boolean isInputResolved(String name)
Description copied from interface:ModuleGets the resolution status of the input with the given name.- Specified by:
isInputResolvedin interfaceModule- See Also:
Module.resolveInput(String)
-
isOutputResolved
public boolean isOutputResolved(String name)
Description copied from interface:ModuleGets the resolution status of the output with the given name.- Specified by:
isOutputResolvedin interfaceModule- See Also:
Module.resolveOutput(String)
-
resolveInput
public void resolveInput(String name)
Description copied from interface:ModuleMarks the input with the given name as resolved. A "resolved" input is known to have a final, valid value for use with the module.ModulePreprocessors in the module execution chain that populate input values (e.g.InputHarvesterplugins) will typically skip over inputs which have already been resolved.- Specified by:
resolveInputin interfaceModule
-
resolveOutput
public void resolveOutput(String name)
Description copied from interface:ModuleMarks the output with the given name as resolved. A "resolved" output has been handled by the framework somehow, typically displayed to the user.ModulePostprocessors in the module execution chain that handle output values (e.g. theDisplayPostprocessor) will typically skip over outputs which have already been resolved.- Specified by:
resolveOutputin interfaceModule
-
unresolveInput
public void unresolveInput(String name)
Description copied from interface:ModuleMarks the input with the given name as unresolved.- Specified by:
unresolveInputin interfaceModule- See Also:
Module.resolveInput(String)
-
unresolveOutput
public void unresolveOutput(String name)
Description copied from interface:ModuleMarks the output with the given name as unresolved.- Specified by:
unresolveOutputin interfaceModule- See Also:
Module.resolveOutput(String)
-
-