diff --git a/src/main/java/teetime/framework/A0UnconnectedPort.java b/src/main/java/teetime/framework/A0UnconnectedPort.java deleted file mode 100644 index 0ffe8960192b76e4d5da9a4222e557a18d97c53f..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/framework/A0UnconnectedPort.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (C) 2015 Christian Wulf, Nelson Tavares de Sousa (http://christianwulf.github.io/teetime) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package teetime.framework; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import teetime.framework.Traverser.VisitorBehavior; -import teetime.framework.pipe.DummyPipe; - -/** - * Connects unconnected ports to a dummy pipe - */ -class A0UnconnectedPort implements ITraverserVisitor { - - private static final Logger LOGGER = LoggerFactory.getLogger(A0UnconnectedPort.class); - - @Override - public VisitorBehavior visit(final Stage stage) { - return VisitorBehavior.CONTINUE; - } - - @Override - public VisitorBehavior visit(final AbstractPort<?> port) { - if (port.getPipe() == null) { - if (LOGGER.isInfoEnabled()) { - LOGGER.info("Unconnected output port: " + port + ". Connecting with a dummy output port."); - } - port.setPipe(DummyPipe.INSTANCE); - return VisitorBehavior.STOP; - } - return VisitorBehavior.CONTINUE; - } -} diff --git a/src/main/java/teetime/framework/OutputPort.java b/src/main/java/teetime/framework/OutputPort.java index 9418549a47fc31ef86dca6351e58b15a5d91753a..7bdb677d051222714f339b8674ea6194cec3fe57 100644 --- a/src/main/java/teetime/framework/OutputPort.java +++ b/src/main/java/teetime/framework/OutputPort.java @@ -15,6 +15,7 @@ */ package teetime.framework; +import teetime.framework.pipe.DummyPipe; import teetime.framework.signal.ISignal; import teetime.framework.signal.TerminatingSignal; @@ -31,6 +32,7 @@ public class OutputPort<T> extends AbstractPort<T> { OutputPort(final Class<T> type, final Stage owningStage, final String portName) { super(type, owningStage, portName); + setPipe(DummyPipe.INSTANCE); } /** diff --git a/src/main/java/teetime/framework/ThreadService.java b/src/main/java/teetime/framework/ThreadService.java index 5bdca3824a8de924172670b9c43984a619de7990..3197606ed3e6eaa18bf8b6e6c070b859d3465d74 100644 --- a/src/main/java/teetime/framework/ThreadService.java +++ b/src/main/java/teetime/framework/ThreadService.java @@ -78,12 +78,9 @@ class ThreadService extends AbstractService<ThreadService> { } // TODO use decorator pattern to combine all analyzes so that only one traverser pass is necessary - A0UnconnectedPort portVisitor = new A0UnconnectedPort(); - Traverser traversor = new Traverser(portVisitor, Direction.BOTH); - traversor.traverse(startStage); A1ThreadableStageCollector stageCollector = new A1ThreadableStageCollector(); - traversor = new Traverser(stageCollector, Direction.BOTH); + Traverser traversor = new Traverser(stageCollector, Direction.BOTH); traversor.traverse(startStage); Set<Stage> newThreadableStages = stageCollector.getThreadableStages();