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

set methods to package private;

moved javadoc to the public class
parent 08d11d9e
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,11 @@ package teetime.framework;
*/
public abstract class AbstractCompositeStage {
/**
* Default capacity for pipes
*/
private static final int DEFAULT_CAPACITY = 4;
private final ConfigurationContext context;
public AbstractCompositeStage(final ConfigurationContext context) {
......@@ -38,14 +43,42 @@ public abstract class AbstractCompositeStage {
return context;
}
/**
* Execute this method, to add a stage to the configuration, which should be executed in a own thread.
*
* @param stage
* A arbitrary stage, which will be added to the configuration and executed in a thread.
*/
protected final void addThreadableStage(final Stage stage) {
context.addThreadableStage(stage);
}
/**
* Connects two ports with a pipe with a default capacity of currently {@value #DEFAULT_CAPACITY}.
*
* @param sourcePort
* {@link OutputPort} of the sending stage
* @param targetPort
* {@link InputPort} of the sending stage
* @param <T>
* the type of elements to be sent
*/
protected final <T> void connectPorts(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) {
context.connectPorts(sourcePort, targetPort);
context.connectPorts(sourcePort, targetPort, DEFAULT_CAPACITY);
}
/**
* Connects to ports with a pipe of a certain capacity
*
* @param sourcePort
* {@link OutputPort} of the sending stage
* @param targetPort
* {@link InputPort} of the sending stage
* @param capacity
* the pipe is set to this capacity, if the value is greater than 0. If it is 0, than the pipe is unbounded, thus growing of the pipe is enabled.
* @param <T>
* the type of elements to be sent
*/
protected final <T> void connectPorts(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort, final int capacity) {
context.connectPorts(sourcePort, targetPort, capacity);
}
......
......@@ -31,8 +31,6 @@ import teetime.framework.pipe.InstantiationPipe;
*/
public final class ConfigurationContext {
private static final int DEFAULT_CAPACITY = 4;
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationContext.class);
private final Set<Stage> threadableStages = new HashSet<Stage>();
......@@ -44,10 +42,7 @@ public final class ConfigurationContext {
}
/**
* Execute this method, to add a stage to the configuration, which should be executed in a own thread.
*
* @param stage
* A arbitrary stage, which will be added to the configuration and executed in a thread.
* @see AbstractCompositeStage#addThreadableStage(Stage)
*/
final void addThreadableStage(final Stage stage) {
if (!this.threadableStages.add(stage)) {
......@@ -56,30 +51,7 @@ public final class ConfigurationContext {
}
/**
* Connects two ports with a pipe with a default capacity of currently {@value #DEFAULT_CAPACITY}.
*
* @param sourcePort
* {@link OutputPort} of the sending stage
* @param targetPort
* {@link InputPort} of the sending stage
* @param <T>
* the type of elements to be sent
*/
final <T> void connectPorts(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) {
connectPorts(sourcePort, targetPort, DEFAULT_CAPACITY);
}
/**
* Connects to ports with a pipe of a certain capacity
*
* @param sourcePort
* {@link OutputPort} of the sending stage
* @param targetPort
* {@link InputPort} of the sending stage
* @param capacity
* the pipe is set to this capacity, if the value is greater than 0. If it is 0, than the pipe is unbounded, thus growing of the pipe is enabled.
* @param <T>
* the type of elements to be sent
* @see AbstractCompositeStage#connectPorts(OutputPort, InputPort, int)
*/
final <T> void connectPorts(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort, final int capacity) {
if (sourcePort.getOwningStage().getInputPorts().length == 0 && !threadableStages.contains(sourcePort.getOwningStage())) {
......
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