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

Merge remote-tracking branch 'origin/master' into prework-2.0

parents 834cbb20 6b4f4788
No related branches found
No related tags found
No related merge requests found
#FindBugs User Preferences
#Thu Jun 18 09:21:56 CEST 2015
#Mon Jun 22 16:34:51 CEST 2015
detector_threshold=2
effort=max
excludefilter0=.fbExcludeFilterFile|true
......
......@@ -4,7 +4,7 @@
<groupId>net.sourceforge.teetime</groupId>
<artifactId>teetime</artifactId>
<version>1.2-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>TeeTime</name>
......
......@@ -28,6 +28,9 @@ public abstract class AbstractCompositeStage extends Configuration {
private final ConfigurationContext context;
public AbstractCompositeStage(final ConfigurationContext context) {
if (null == context) {
throw new IllegalArgumentException("Context may not be null.");
}
this.context = context;
}
......
......@@ -82,9 +82,9 @@ public abstract class ConfigurationContext extends Configuration {
if (sourcePort.getOwningStage().getInputPorts().length == 0 && !threadableStages.contains(sourcePort.getOwningStage())) {
addThreadableStage(sourcePort.getOwningStage());
}
if (sourcePort.pipe != null) {
LOGGER.warn("Overwritting existing pipe while connecting stages " + sourcePort.getOwningStage().getId() + " and " + targetPort.getOwningStage().getId()
+ ".");
if (sourcePort.getPipe() != null || targetPort.getPipe() != null) {
LOGGER.warn("Overwriting existing pipe while connecting stages " +
sourcePort.getOwningStage().getId() + " and " + targetPort.getOwningStage().getId() + ".");
}
new InstantiationPipe(sourcePort, targetPort, capacity);
}
......
......@@ -21,13 +21,16 @@ import teetime.framework.signal.ISignal;
public class InstantiationPipe implements IPipe {
private final InputPort<?> target;
private static final String ERROR_MESSAGE = "This must not be called while executing the configuration";
private final InputPort<?> targetPort;
private final int capacity;
public <T> InstantiationPipe(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort, final int capacity) {
this.target = targetPort;
this.targetPort = targetPort;
this.capacity = capacity;
sourcePort.setPipe(this);
targetPort.setPipe(this);
}
public int getCapacity() {
......@@ -36,67 +39,67 @@ public class InstantiationPipe implements IPipe {
@Override
public InputPort<?> getTargetPort() {
return this.target;
return this.targetPort;
}
@Override
public boolean add(final Object element) {
throw new IllegalStateException("This must not be called while executing the configuration");
throw new IllegalStateException(ERROR_MESSAGE);
}
@Override
public boolean addNonBlocking(final Object element) {
throw new IllegalStateException("This must not be called while executing the configuration");
throw new IllegalStateException(ERROR_MESSAGE);
}
@Override
public boolean isEmpty() {
throw new IllegalStateException("This must not be called while executing the configuration");
throw new IllegalStateException(ERROR_MESSAGE);
}
@Override
public int size() {
throw new IllegalStateException("This must not be called while executing the configuration");
throw new IllegalStateException(ERROR_MESSAGE);
}
@Override
public Object removeLast() {
throw new IllegalStateException("This must not be called while executing the configuration");
throw new IllegalStateException(ERROR_MESSAGE);
}
@Override
public void sendSignal(final ISignal signal) {
throw new IllegalStateException("This must not be called while executing the configuration");
throw new IllegalStateException(ERROR_MESSAGE);
}
@Override
public void reportNewElement() {
throw new IllegalStateException("This must not be called while executing the configuration");
throw new IllegalStateException(ERROR_MESSAGE);
}
@Override
public boolean isClosed() {
throw new IllegalStateException("This must not be called while executing the configuration");
throw new IllegalStateException(ERROR_MESSAGE);
}
@Override
public boolean hasMore() {
throw new IllegalStateException("This must not be called while executing the configuration");
throw new IllegalStateException(ERROR_MESSAGE);
}
@Override
public void waitForStartSignal() throws InterruptedException {
throw new IllegalStateException("This must not be called while executing the configuration");
throw new IllegalStateException(ERROR_MESSAGE);
}
@Override
public void waitForInitializingSignal() throws InterruptedException {
throw new IllegalStateException("This must not be called while executing the configuration");
throw new IllegalStateException(ERROR_MESSAGE);
}
@Override
public void close() {
throw new IllegalStateException("This must not be called while executing the configuration");
throw new IllegalStateException(ERROR_MESSAGE);
}
}
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