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

refactored AbstractCompositeStage (name and non-abstract)

parent 8752ff9c
Branches
Tags
No related merge requests found
Showing
with 19 additions and 17 deletions
......@@ -40,7 +40,6 @@ import teetime.util.framework.port.PortRemovedListener;
* Represents a minimal Stage, with some pre-defined methods.
* Implemented stages need to adapt all abstract methods with own implementations.
*/
@SuppressWarnings("PMD.AbstractNaming")
public abstract class AbstractStage {
private static final ConcurrentMap<String, Integer> INSTANCES_COUNTER = new ConcurrentHashMap<String, Integer>();
......@@ -100,7 +99,6 @@ public abstract class AbstractStage {
return newId;
}
@SuppressWarnings("PMD.DefaultPackage")
static void clearInstanceCounters() {
INSTANCES_COUNTER.clear();
}
......@@ -208,7 +206,6 @@ public abstract class AbstractStage {
* @param inputPort
* The port which received the signal
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
final void onSignal(final ISignal signal, final InputPort<?> inputPort) {
Class<? extends ISignal> signalClass = signal.getClass();
......
......@@ -19,19 +19,24 @@ import teetime.framework.pipe.InstantiationPipe;
/**
* Represents a minimal stage that composes several other stages.
* In order to work with this class, you need to extend from it and work from within the extending class.
*
* @since 2.0
*
* @author Christian Wulf, Nelson Tavares de Sousa
*
*/
public abstract class AbstractCompositeStage {
public class CompositeStage {
/**
* Default capacity for pipes
*/
private static final int DEFAULT_CAPACITY = 4;
protected CompositeStage() {
// prohibit instantiation of this class
}
/**
* Connects two ports with a pipe with a default capacity of currently {@value #DEFAULT_CAPACITY}.
*
......
......@@ -26,7 +26,7 @@ import teetime.framework.exceptionHandling.TerminatingExceptionListenerFactory;
* @since 2.0
*
*/
public class Configuration extends AbstractCompositeStage {
public class Configuration extends CompositeStage {
private final AbstractExceptionListenerFactory<?> factory;
private final ConfigurationContext context;
......
......@@ -18,7 +18,7 @@ package teetime.stage.io;
import java.util.ArrayList;
import java.util.List;
import teetime.framework.AbstractCompositeStage;
import teetime.framework.CompositeStage;
import teetime.framework.InputPort;
import teetime.framework.OutputPort;
import teetime.framework.AbstractStage;
......@@ -26,7 +26,7 @@ import teetime.stage.EveryXthStage;
import teetime.stage.basic.distributor.Distributor;
import teetime.stage.basic.distributor.strategy.CopyByReferenceStrategy;
public final class EveryXthPrinter<T> extends AbstractCompositeStage {
public final class EveryXthPrinter<T> extends CompositeStage {
private final Distributor<T> distributor;
private final List<AbstractStage> lastStages = new ArrayList<AbstractStage>();
......
......@@ -15,7 +15,7 @@
*/
package teetime.stage.string;
import teetime.framework.AbstractCompositeStage;
import teetime.framework.CompositeStage;
import teetime.framework.InputPort;
import teetime.framework.OutputPort;
import teetime.stage.MappingCounter;
......@@ -31,7 +31,7 @@ import teetime.stage.util.CountingMap;
* @author Nelson Tavares de Sousa
*
*/
public final class WordCounter extends AbstractCompositeStage implements ITaskFarmDuplicable<String, CountingMap<String>> {
public final class WordCounter extends CompositeStage implements ITaskFarmDuplicable<String, CountingMap<String>> {
private final Tokenizer tokenizer;
private final MappingCounter<String> mapCounter;
......
......@@ -19,7 +19,7 @@ import teetime.framework.InputPort;
import teetime.framework.OutputPort;
/**
* Any {@link teetime.framework.AbstractStage AbstractStage} or {@link teetime.framework.AbstractCompositeStage AbstractCompositeStage} implementing this interface
* Any {@link teetime.framework.AbstractStage AbstractStage} or {@link teetime.framework.CompositeStage AbstractCompositeStage} implementing this interface
* can be used by a Task Farm as an enclosed stage. The enclosed
* stage may not have more than one input or output port each.
*
......
......@@ -18,7 +18,7 @@ package teetime.stage.taskfarm;
import java.util.LinkedList;
import java.util.List;
import teetime.framework.AbstractCompositeStage;
import teetime.framework.CompositeStage;
import teetime.framework.InputPort;
import teetime.framework.OutputPort;
import teetime.stage.basic.distributor.dynamic.DynamicDistributor;
......@@ -41,7 +41,7 @@ import teetime.stage.taskfarm.monitoring.SingleTaskFarmMonitoringService;
* @param <T>
* Type of the parallelized stage
*/
public final class TaskFarmStage<I, O, T extends ITaskFarmDuplicable<I, O>> extends AbstractCompositeStage {
public final class TaskFarmStage<I, O, T extends ITaskFarmDuplicable<I, O>> extends CompositeStage {
/** currently existing worker stages **/
private final List<ITaskFarmDuplicable<I, O>> enclosedStageInstances = new LinkedList<ITaskFarmDuplicable<I, O>>();
......
......@@ -15,7 +15,7 @@
*/
package teetime.framework;
class CompositeCounterIncrementer extends AbstractCompositeStage {
class CompositeCounterIncrementer extends CompositeStage {
private final InputPort<CounterContainer> inputPort;
private final OutputPort<CounterContainer> outputPort;
......
......@@ -26,7 +26,7 @@ import teetime.stage.basic.merger.Merger;
* @param <T>
* the element type of the producer
*/
class CompositeProducerStage<T> extends AbstractCompositeStage {
class CompositeProducerStage<T> extends CompositeStage {
private final Merger<T> merger;
......
......@@ -40,7 +40,7 @@ import teetime.testutil.AssertHelper;
* @author Christian Wulf
*
*/
public class AbstractCompositeStageTest {
public class CompositeStageTest {
@Before
public void before() {
......
......@@ -18,7 +18,7 @@ package teetime.stage.taskfarm;
import java.util.LinkedList;
import java.util.List;
import teetime.framework.AbstractCompositeStage;
import teetime.framework.CompositeStage;
import teetime.framework.Configuration;
import teetime.framework.InputPort;
import teetime.framework.OutputPort;
......@@ -54,7 +54,7 @@ public class TaskFarmStageTestConfiguration extends Configuration {
connectPorts(taskFarmStage.getOutputPort(), sink.getInputPort());
}
private static class CompositeTestStage extends AbstractCompositeStage implements ITaskFarmDuplicable<Long, String> {
private static class CompositeTestStage extends CompositeStage implements ITaskFarmDuplicable<Long, String> {
private final PlusOneInStringStage pOne = new PlusOneInStringStage();
private final StringDuplicationStage sDup = new StringDuplicationStage();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment