From 3cc7ec69c2d1e3e26bb8d70a88a17f29e9b630ba Mon Sep 17 00:00:00 2001
From: Nelson Tavares de Sousa <stu103017@mail.uni-kiel.de>
Date: Wed, 5 Aug 2015 15:02:50 +0200
Subject: [PATCH] set DummyPipe as default

---
 .../teetime/framework/A0UnconnectedPort.java  | 47 -------------------
 .../java/teetime/framework/OutputPort.java    |  2 +
 .../java/teetime/framework/ThreadService.java |  5 +-
 3 files changed, 3 insertions(+), 51 deletions(-)
 delete mode 100644 src/main/java/teetime/framework/A0UnconnectedPort.java

diff --git a/src/main/java/teetime/framework/A0UnconnectedPort.java b/src/main/java/teetime/framework/A0UnconnectedPort.java
deleted file mode 100644
index 0ffe8960..00000000
--- 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 9418549a..7bdb677d 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 5bdca382..3197606e 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();
-- 
GitLab