|
33 | 33 |
|
34 | 34 | import java.util.Map; |
35 | 35 |
|
| 36 | +import org.scijava.display.DisplayPostprocessor; |
| 37 | +import org.scijava.module.process.ModulePostprocessor; |
| 38 | +import org.scijava.module.process.ModulePreprocessor; |
| 39 | +import org.scijava.widget.InputHarvester; |
| 40 | + |
36 | 41 | /** |
37 | 42 | * A module is an encapsulated piece of functionality with inputs and outputs. |
38 | 43 | * <p> |
@@ -126,15 +131,71 @@ public interface Module extends Runnable { |
126 | 131 | void setOutputs(Map<String, Object> outputs); |
127 | 132 |
|
128 | 133 | /** |
129 | | - * Gets the resolution status of the input with the given name. A "resolved" |
130 | | - * input is known to have a final, valid value for use with the module. |
| 134 | + * Gets the resolution status of the input with the given name. |
| 135 | + * |
| 136 | + * @see #resolveInput(String) |
| 137 | + */ |
| 138 | + boolean isInputResolved(String name); |
| 139 | + |
| 140 | + /** |
| 141 | + * Gets the resolution status of the output with the given name. |
| 142 | + * |
| 143 | + * @see #resolveOutput(String) |
| 144 | + */ |
| 145 | + boolean isOutputResolved(String name); |
| 146 | + |
| 147 | + /** |
| 148 | + * Marks the input with the given name as resolved. A "resolved" input is |
| 149 | + * known to have a final, valid value for use with the module. |
| 150 | + * <p> |
| 151 | + * {@link ModulePreprocessor}s in the module execution chain that populate |
| 152 | + * input values (e.g. {@link InputHarvester} plugins) will typically skip over |
| 153 | + * inputs which have already been resolved. |
| 154 | + * </p> |
| 155 | + */ |
| 156 | + void resolveInput(String name); |
| 157 | + |
| 158 | + /** |
| 159 | + * Marks the output with the given name as resolved. A "resolved" output has |
| 160 | + * been handled by the framework somehow, typically displayed to the user. |
| 161 | + * <p> |
| 162 | + * {@link ModulePostprocessor}s in the module execution chain that handle |
| 163 | + * output values (e.g. the {@link DisplayPostprocessor}) will typically skip |
| 164 | + * over outputs which have already been resolved. |
| 165 | + * </p> |
| 166 | + */ |
| 167 | + void resolveOutput(String name); |
| 168 | + |
| 169 | + /** |
| 170 | + * Marks the input with the given name as unresolved. |
| 171 | + * |
| 172 | + * @see #resolveInput(String) |
131 | 173 | */ |
132 | | - boolean isResolved(String name); |
| 174 | + void unresolveInput(String name); |
| 175 | + |
| 176 | + /** |
| 177 | + * Marks the output with the given name as unresolved. |
| 178 | + * |
| 179 | + * @see #resolveOutput(String) |
| 180 | + */ |
| 181 | + void unresolveOutput(String name); |
| 182 | + |
| 183 | + // -- Deprecated -- |
| 184 | + |
| 185 | + /** @deprecated Use {@link #isInputResolved(String)} instead. */ |
| 186 | + @Deprecated |
| 187 | + default boolean isResolved(final String name) { |
| 188 | + return isInputResolved(name); |
| 189 | + } |
133 | 190 |
|
134 | 191 | /** |
135 | | - * Sets the resolution status of the input with the given name. A "resolved" |
136 | | - * input is known to have a final, valid value for use with the module. |
| 192 | + * @deprecated Use {@link #resolveInput(String)} and |
| 193 | + * {@link #unresolveInput(String)} instead. |
137 | 194 | */ |
138 | | - void setResolved(String name, boolean resolved); |
| 195 | + @Deprecated |
| 196 | + default void setResolved(final String name, final boolean resolved) { |
| 197 | + if (resolved) resolveInput(name); |
| 198 | + else unresolveInput(name); |
| 199 | + } |
139 | 200 |
|
140 | 201 | } |
0 commit comments