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

moved from LinkedLists to HashSets

parent b8dd46cf
No related branches found
No related tags found
No related merge requests found
...@@ -109,7 +109,7 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught ...@@ -109,7 +109,7 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught
// BETTER validate concurrently // BETTER validate concurrently
private void validateStages() { private void validateStages() {
final List<Stage> threadableStageJobs = this.configuration.getThreadableStageJobs(); final Set<Stage> threadableStageJobs = this.configuration.getThreadableStageJobs();
for (Stage stage : threadableStageJobs) { for (Stage stage : threadableStageJobs) {
// // portConnectionValidator.validate(stage); // // portConnectionValidator.validate(stage);
// } // }
...@@ -134,7 +134,7 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught ...@@ -134,7 +134,7 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught
instantiatePipes(); instantiatePipes();
final List<Stage> threadableStageJobs = this.configuration.getThreadableStageJobs(); final Set<Stage> threadableStageJobs = this.configuration.getThreadableStageJobs();
if (threadableStageJobs.isEmpty()) { if (threadableStageJobs.isEmpty()) {
throw new IllegalStateException("No stage was added using the addThreadableStage(..) method. Add at least one stage."); throw new IllegalStateException("No stage was added using the addThreadableStage(..) method. Add at least one stage.");
} }
...@@ -177,7 +177,7 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught ...@@ -177,7 +177,7 @@ public final class Analysis<T extends AnalysisConfiguration> implements Uncaught
} }
private void instantiatePipes() { private void instantiatePipes() {
List<Stage> threadableStageJobs = configuration.getThreadableStageJobs(); Set<Stage> threadableStageJobs = configuration.getThreadableStageJobs();
for (Connection connection : configuration.getConnections()) { for (Connection connection : configuration.getConnections()) {
if (threadableStageJobs.contains(connection.getTargetPort().getOwningStage())) { if (threadableStageJobs.contains(connection.getTargetPort().getOwningStage())) {
if (connection.getCapacity() != 0) { if (connection.getCapacity() != 0) {
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
*/ */
package teetime.framework; package teetime.framework;
import java.util.LinkedList; import java.util.HashSet;
import java.util.List; import java.util.Set;
import teetime.framework.pipe.IPipe; import teetime.framework.pipe.IPipe;
import teetime.framework.pipe.IPipeFactory; import teetime.framework.pipe.IPipeFactory;
...@@ -31,8 +31,8 @@ import teetime.util.Connection; ...@@ -31,8 +31,8 @@ import teetime.util.Connection;
*/ */
public abstract class AnalysisConfiguration { public abstract class AnalysisConfiguration {
private final List<Stage> threadableStageJobs = new LinkedList<Stage>(); private final Set<Stage> threadableStageJobs = new HashSet<Stage>();
private final List<Connection<?>> connections = new LinkedList<Connection<?>>(); private final Set<Connection<?>> connections = new HashSet<Connection<?>>();
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
private static final PipeFactoryRegistry PIPE_FACTORY_REGISTRY = PipeFactoryRegistry.INSTANCE; private static final PipeFactoryRegistry PIPE_FACTORY_REGISTRY = PipeFactoryRegistry.INSTANCE;
...@@ -50,7 +50,7 @@ public abstract class AnalysisConfiguration { ...@@ -50,7 +50,7 @@ public abstract class AnalysisConfiguration {
*/ */
private final static IPipeFactory interUnboundedThreadFactory = PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTER, PipeOrdering.QUEUE_BASED, true); private final static IPipeFactory interUnboundedThreadFactory = PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTER, PipeOrdering.QUEUE_BASED, true);
List<Stage> getThreadableStageJobs() { Set<Stage> getThreadableStageJobs() {
return this.threadableStageJobs; return this.threadableStageJobs;
} }
...@@ -180,7 +180,7 @@ public abstract class AnalysisConfiguration { ...@@ -180,7 +180,7 @@ public abstract class AnalysisConfiguration {
* *
* @return a list of pairs of Out- and InputPorts, which are connected * @return a list of pairs of Out- and InputPorts, which are connected
*/ */
protected List<Connection<?>> getConnections() { protected Set<Connection<?>> getConnections() {
return connections; return connections;
} }
......
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