Skip to content
Snippets Groups Projects
Commit b74d1fab authored by Nelson Tavares de Sousa's avatar Nelson Tavares de Sousa
Browse files

not working yet; new exception fails on various tests

parent f3cd95a7
No related branches found
No related tags found
No related merge requests found
...@@ -73,6 +73,7 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught ...@@ -73,6 +73,7 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught
private final IPipeFactory interBoundedThreadPipeFactory = new SpScPipeFactory(); private final IPipeFactory interBoundedThreadPipeFactory = new SpScPipeFactory();
private final IPipeFactory interUnboundedThreadPipeFactory = new UnboundedSpScPipeFactory(); private final IPipeFactory interUnboundedThreadPipeFactory = new UnboundedSpScPipeFactory();
private final IPipeFactory intraThreadPipeFactory = new SingleElementPipeFactory(); private final IPipeFactory intraThreadPipeFactory = new SingleElementPipeFactory();
private Integer connected = new Integer(0);
/** /**
* Creates a new {@link Analysis} that skips validating the port connections and uses the default listener. * Creates a new {@link Analysis} that skips validating the port connections and uses the default listener.
...@@ -208,6 +209,9 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught ...@@ -208,6 +209,9 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught
colors.put(threadableStage, i); // Markiere den threadHead colors.put(threadableStage, i); // Markiere den threadHead
colorAndConnectStages(i, colors, threadableStage); colorAndConnectStages(i, colors, threadableStage);
} }
if (configuration.getConnections().size() != connected) {
throw new IllegalStateException("remaining " + (configuration.getConnections().size() - connected) + " connections");
}
} }
public void colorAndConnectStages(final Integer i, final Map<Stage, Integer> colors, final Stage threadableStage) { public void colorAndConnectStages(final Integer i, final Map<Stage, Integer> colors, final Stage threadableStage) {
...@@ -228,11 +232,14 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught ...@@ -228,11 +232,14 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught
} }
} else { } else {
if (colors.containsKey(targetStage)) { if (colors.containsKey(targetStage)) {
throw new IllegalStateException("Crossing threads"); if (colors.get(targetStage).equals(i)) {
throw new IllegalStateException("Crossing threads"); // One stage is connected to a stage of another thread (not the "headstage")
}
} }
intraThreadPipeFactory.create(connection.getSourcePort(), connection.getTargetPort()); intraThreadPipeFactory.create(connection.getSourcePort(), connection.getTargetPort());
colors.put(targetStage, i); colors.put(targetStage, i);
} }
connected++;
// configuration.getConnections().remove(connection); remove connection to increase performance // configuration.getConnections().remove(connection); remove connection to increase performance
colorAndConnectStages(i, colors, targetStage); colorAndConnectStages(i, colors, targetStage);
} }
......
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