Skip to content
Snippets Groups Projects
Commit 489e784b authored by Christian Wulf's avatar Christian Wulf
Browse files

fixed #67 Use a Set instead of Map<T, Void> in AbstractStage

parent 57eb0d3f
No related branches found
No related tags found
No related merge requests found
package teetime.framework; package teetime.framework;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -32,7 +32,7 @@ public abstract class AbstractStage implements IStage { ...@@ -32,7 +32,7 @@ public abstract class AbstractStage implements IStage {
/** A cached instance of <code>outputPortList</code> to avoid creating an iterator each time iterating it */ /** A cached instance of <code>outputPortList</code> to avoid creating an iterator each time iterating it */
protected OutputPort<?>[] cachedOutputPorts; protected OutputPort<?>[] cachedOutputPorts;
private final Map<ISignal, Void> visited = new HashMap<ISignal, Void>(); private final Set<ISignal> triggeredSignals = new HashSet<ISignal>();
private boolean shouldTerminate; private boolean shouldTerminate;
public AbstractStage() { public AbstractStage() {
...@@ -104,12 +104,12 @@ public abstract class AbstractStage implements IStage { ...@@ -104,12 +104,12 @@ public abstract class AbstractStage implements IStage {
} }
protected boolean alreadyVisited(final ISignal signal, final InputPort<?> inputPort) { protected boolean alreadyVisited(final ISignal signal, final InputPort<?> inputPort) {
if (this.visited.containsKey(signal)) { if (this.triggeredSignals.contains(signal)) {
this.logger.trace("Got signal: " + signal + " again from input port: " + inputPort); this.logger.trace("Got signal: " + signal + " again from input port: " + inputPort);
return true; return true;
} else { } else {
this.logger.trace("Got signal: " + signal + " from input port: " + inputPort); this.logger.trace("Got signal: " + signal + " from input port: " + inputPort);
this.visited.put(signal, null); this.triggeredSignals.add(signal);
return false; return false;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment