Skip to content

Commit ab41c9a

Browse files
committed
Specify 'manualPush' in constructor instead of setter.
Signed-off-by: Squareys <[email protected]>
1 parent feeafa9 commit ab41c9a

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

org.knime.scijava.commands/src/org/knime/scijava/commands/module/DefaultNodeModule.java

+15-15
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class DefaultNodeModule implements NodeModule {
4848

4949
private final Map<ModuleItem<?>, DataType> outputMapping;
5050

51-
private final NodeModuleOutputChangedListener outputListener;
51+
private NodeModuleOutputChangedListener outputListener;
5252

5353
private final LogService logService;
5454

@@ -78,7 +78,7 @@ public DefaultNodeModule(final Context context, final ModuleInfo info,
7878
this.inputMapping = inputMapping;
7979
this.outputMapping = outputMapping;
8080
this.module = ms.createModule(info);
81-
this.outputListener = new NodeModuleOutputChangedListener();
81+
this.outputListener = new NodeModuleOutputChangedListener(false);
8282
this.logService = new KNIMELogService(logger);
8383

8484
preProcess(params);
@@ -109,9 +109,9 @@ private void preProcess(final Map<String, Object> params) {
109109
/* MultiOutputListener */
110110
final String name = item.getName();
111111

112+
outputListener = new NodeModuleOutputChangedListener(true);
112113
module.setInput(name, outputListener);
113114
module.resolveInput(name);
114-
outputListener.enableManualPush(true);
115115
} else if (LogService.class.equals(item.getType())) {
116116
/* LogService */
117117
final String name = item.getName();
@@ -158,7 +158,18 @@ private class NodeModuleOutputChangedListener
158158
private CellOutput output;
159159

160160
/* true if the modules handles pushes itself, false otherwise */
161-
private boolean manualPush = false;
161+
private final boolean manualPush = false;
162+
163+
/**
164+
* Constructor.
165+
*
166+
* @param manualPush
167+
* if <code>true</code>, signals that the module handles
168+
* pushing rows.
169+
*/
170+
NodeModuleOutputChangedListener(final boolean manualPush) {
171+
this.manualPush = manualPush;
172+
}
162173

163174
@Override
164175
public void notifyListener() {
@@ -213,16 +224,5 @@ public void flush() {
213224
notifyListener();
214225
}
215226
}
216-
217-
/**
218-
* Enable/Disable manual push.
219-
*
220-
* @param b
221-
* if <code>true</code>, signals that the module handles
222-
* pushing rows.
223-
*/
224-
public void enableManualPush(final boolean b) {
225-
manualPush = b;
226-
}
227227
}
228228
}

0 commit comments

Comments
 (0)