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

some renaming

parent b17f61f2
No related branches found
No related tags found
No related merge requests found
Showing
with 44 additions and 44 deletions
......@@ -23,11 +23,11 @@ package teetime.framework;
*
*
*/
public abstract class AbstractCompositeStage extends Network {
public abstract class AbstractStageComposition extends Configuration {
private final AnalysisContext context;
private final ConfigurationContext context;
public AbstractCompositeStage(final AnalysisContext context) {
public AbstractStageComposition(final ConfigurationContext context) {
this.context = context;
}
......@@ -46,7 +46,7 @@ public abstract class AbstractCompositeStage extends Network {
context.addThreadableStage(stage);
}
protected AnalysisContext getContext() {
protected ConfigurationContext getContext() {
return context;
}
......
......@@ -35,7 +35,7 @@ import teetime.util.Pair;
/**
* Represents an Analysis to which stages can be added and executed later.
* This needs a {@link AnalysisContext},
* This needs a {@link ConfigurationContext},
* in which the adding and configuring of stages takes place.
* To start the analysis {@link #executeBlocking()} needs to be executed.
* This class will automatically create threads and join them without any further commitment.
......@@ -43,9 +43,9 @@ import teetime.util.Pair;
* @author Christian Wulf, Nelson Tavares de Sousa
*
* @param <T>
* the type of the {@link AnalysisContext}
* the type of the {@link ConfigurationContext}
*/
public final class Analysis<T extends AnalysisContext> implements UncaughtExceptionHandler {
public final class Analysis<T extends ConfigurationContext> implements UncaughtExceptionHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(Analysis.class);
......
......@@ -36,14 +36,14 @@ class AnalysisInstantiation {
private final IPipeFactory interUnboundedThreadPipeFactory = new UnboundedSpScPipeFactory();
private final IPipeFactory intraThreadPipeFactory = new SingleElementPipeFactory();
private final AnalysisContext configuration;
private final ConfigurationContext configuration;
public AnalysisInstantiation(final AnalysisContext configuration) {
public AnalysisInstantiation(final ConfigurationContext configuration) {
this.configuration = configuration;
}
@SuppressWarnings("rawtypes")
Integer colorAndConnectStages(final Integer i, final Map<Stage, Integer> colors, final Stage threadableStage, final AnalysisContext configuration) {
Integer colorAndConnectStages(final Integer i, final Map<Stage, Integer> colors, final Stage threadableStage, final ConfigurationContext configuration) {
Integer createdConnections = new Integer(0);
Set<Stage> threadableStageJobs = configuration.getThreadableStages();
for (OutputPort outputPort : threadableStage.getOutputPorts()) {
......
package teetime.framework;
public abstract class Network {
public abstract class Configuration {
protected abstract <T> void connectPorts(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort, final int capacity);
......
......@@ -29,7 +29,7 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication;
* Represents a configuration of connected stages, which is needed to run a analysis.
* Stages can be added by executing {@link #addThreadableStage(Stage)}.
*/
public abstract class AnalysisContext extends Network {
public abstract class ConfigurationContext extends Configuration {
private final Set<Stage> threadableStages = new HashSet<Stage>();
......
......@@ -20,7 +20,7 @@ import java.util.Arrays;
import java.util.List;
import teetime.framework.Analysis;
import teetime.framework.AnalysisContext;
import teetime.framework.ConfigurationContext;
import teetime.framework.AnalysisException;
import teetime.framework.Stage;
import teetime.framework.StageState;
......@@ -78,12 +78,12 @@ public final class StageTester {
*
*/
public void start() {
final AnalysisContext configuration = new Configuration(inputHolders, stage, outputHolders);
final Analysis<AnalysisContext> analysis = new Analysis<AnalysisContext>(configuration);
final ConfigurationContext configuration = new Configuration(inputHolders, stage, outputHolders);
final Analysis<ConfigurationContext> analysis = new Analysis<ConfigurationContext>(configuration);
analysis.executeBlocking();
}
private final class Configuration extends AnalysisContext {
private final class Configuration extends ConfigurationContext {
public Configuration(final List<InputHolder<?>> inputHolders, final Stage stage, final List<OutputHolder<?>> outputHolders) {
for (InputHolder<?> inputHolder : inputHolders) {
......
......@@ -18,8 +18,8 @@ package teetime.stage.io;
import java.util.ArrayList;
import java.util.List;
import teetime.framework.AbstractCompositeStage;
import teetime.framework.AnalysisContext;
import teetime.framework.AbstractStageComposition;
import teetime.framework.ConfigurationContext;
import teetime.framework.InputPort;
import teetime.framework.OutputPort;
import teetime.framework.Stage;
......@@ -27,12 +27,12 @@ import teetime.stage.EveryXthStage;
import teetime.stage.basic.distributor.CopyByReferenceStrategy;
import teetime.stage.basic.distributor.Distributor;
public final class EveryXthPrinter<T> extends AbstractCompositeStage {
public final class EveryXthPrinter<T> extends AbstractStageComposition {
private final Distributor<T> distributor;
private final List<Stage> lastStages = new ArrayList<Stage>();
public EveryXthPrinter(final int threshold, final AnalysisContext context) {
public EveryXthPrinter(final int threshold, final ConfigurationContext context) {
super(context);
distributor = new Distributor<T>(new CopyByReferenceStrategy());
EveryXthStage<T> everyXthStage = new EveryXthStage<T>(threshold);
......
......@@ -17,8 +17,8 @@ package teetime.stage.string;
import java.util.ArrayList;
import teetime.framework.AbstractCompositeStage;
import teetime.framework.AnalysisContext;
import teetime.framework.AbstractStageComposition;
import teetime.framework.ConfigurationContext;
import teetime.framework.InputPort;
import teetime.framework.OutputPort;
import teetime.framework.Stage;
......@@ -34,7 +34,7 @@ import teetime.stage.util.CountingMap;
* @author Nelson Tavares de Sousa
*
*/
public final class WordCounter extends AbstractCompositeStage {
public final class WordCounter extends AbstractStageComposition {
// This fields are needed for the methods to work.
private final Tokenizer tokenizer = new Tokenizer(" ");
......@@ -42,7 +42,7 @@ public final class WordCounter extends AbstractCompositeStage {
private final ArrayList<Stage> lastStages = new ArrayList<Stage>();
// The connection of the different stages is realized within the construction of a instance of this class.
public WordCounter(final AnalysisContext context) {
public WordCounter(final ConfigurationContext context) {
super(context);
this.lastStages.add(this.mapCounter);
final ToLowerCase toLowerCase = new ToLowerCase();
......
......@@ -17,7 +17,7 @@ package teetime.examples.cipher;
import java.io.File;
import teetime.framework.AnalysisContext;
import teetime.framework.ConfigurationContext;
import teetime.stage.CipherStage;
import teetime.stage.CipherStage.CipherMode;
import teetime.stage.InitialElementProducer;
......@@ -26,7 +26,7 @@ import teetime.stage.ZipByteArray.ZipMode;
import teetime.stage.io.ByteArrayFileWriter;
import teetime.stage.io.File2ByteArray;
public class CipherConfiguration extends AnalysisContext {
public class CipherConfiguration extends ConfigurationContext {
public CipherConfiguration(final String inputFile, final String outputFile, final String password) {
final File input = new File(inputFile);
......
......@@ -22,7 +22,7 @@ import org.junit.Assert;
import org.junit.Test;
import teetime.framework.Analysis;
import teetime.framework.AnalysisContext;
import teetime.framework.ConfigurationContext;
import com.google.common.io.Files;
......@@ -43,7 +43,7 @@ public class CipherTest {
final String outputFile = "src/test/resources/data/output.txt";
final String password = "Password";
final AnalysisContext configuration = new CipherConfiguration(inputFile, outputFile, password);
final ConfigurationContext configuration = new CipherConfiguration(inputFile, outputFile, password);
final Analysis analysis = new Analysis(configuration);
analysis.executeBlocking();
......
......@@ -17,7 +17,7 @@ package teetime.examples.tokenizer;
import java.io.File;
import teetime.framework.AnalysisContext;
import teetime.framework.ConfigurationContext;
import teetime.stage.ByteArray2String;
import teetime.stage.CipherStage;
import teetime.stage.CipherStage.CipherMode;
......@@ -28,7 +28,7 @@ import teetime.stage.ZipByteArray.ZipMode;
import teetime.stage.io.File2ByteArray;
import teetime.stage.string.Tokenizer;
public class TokenizerConfiguration extends AnalysisContext {
public class TokenizerConfiguration extends ConfigurationContext {
private final Counter<String> counter;
......
......@@ -70,7 +70,7 @@ public class AnalysisTest {
assertThat(watch.getDurationInMs() + ABSOLUTE_MAX_ERROR_IN_MS, is(greaterThanOrEqualTo(DELAY_IN_MS)));
}
private static class TestConfig extends AnalysisContext {
private static class TestConfig extends ConfigurationContext {
public final DelayAndTerminate delay;
public TestConfig() {
......@@ -112,7 +112,7 @@ public class AnalysisTest {
assertThat(intraAnalysis.getConfiguration().init.getOwningThread(), is(intraAnalysis.getConfiguration().sink.getOwningThread()));
}
private class AnalysisTestConfig extends AnalysisContext {
private class AnalysisTestConfig extends ConfigurationContext {
public InitialElementProducer<Object> init = new InitialElementProducer<Object>();
public Sink<Object> sink = new Sink<Object>();
......@@ -136,7 +136,7 @@ public class AnalysisTest {
new Analysis<InvalidTestConfig>(configuration);
}
private class InvalidTestConfig extends AnalysisContext {
private class InvalidTestConfig extends ConfigurationContext {
public InitialElementProducer<Object> init = new InitialElementProducer<Object>();
public InstanceOfFilter<Object, Object> iof = new InstanceOfFilter<Object, Object>(Object.class);
public Sink<Object> sink = new Sink<Object>();
......@@ -153,11 +153,11 @@ public class AnalysisTest {
@Test
public void automaticallyAddHeadStages() {
AutomaticallyConfig context = new AutomaticallyConfig();
new Analysis<AnalysisContext>(context).executeBlocking();
new Analysis<ConfigurationContext>(context).executeBlocking();
assertTrue(context.executed);
}
private class AutomaticallyConfig extends AnalysisContext {
private class AutomaticallyConfig extends ConfigurationContext {
public boolean executed;
......
......@@ -21,7 +21,7 @@ import java.util.List;
import teetime.stage.CollectorSink;
import teetime.stage.InitialElementProducer;
public class RunnableConsumerStageTestConfiguration extends AnalysisContext {
public class RunnableConsumerStageTestConfiguration extends ConfigurationContext {
private final List<Integer> collectedElements = new ArrayList<Integer>();
private final CollectorSink<Integer> collectorSink;
......
......@@ -53,7 +53,7 @@ public class StageTest {
assertEquals(tc.init.exceptionHandler, tc.delay.exceptionHandler);
}
private static class TestConfig extends AnalysisContext {
private static class TestConfig extends ConfigurationContext {
public final DelayAndTerminate delay;
public InitialElementProducer<String> init;
......
......@@ -53,7 +53,7 @@ public class TraversorTest {
}
// WordCounterConfiguration
private class TestConfiguration extends AnalysisContext {
private class TestConfiguration extends ConfigurationContext {
public final CountingMapMerger<String> result = new CountingMapMerger<String>();
public final InitialElementProducer<File> init;
......
......@@ -21,7 +21,7 @@ import teetime.stage.InitialElementProducer;
import teetime.stage.Relay;
import teetime.stage.basic.Delay;
class WaitStrategyConfiguration extends AnalysisContext {
class WaitStrategyConfiguration extends ConfigurationContext {
private Delay<Object> delay;
private CollectorSink<Object> collectorSink;
......
......@@ -19,7 +19,7 @@ import teetime.stage.CollectorSink;
import teetime.stage.InitialElementProducer;
import teetime.stage.Relay;
class YieldStrategyConfiguration extends AnalysisContext {
class YieldStrategyConfiguration extends ConfigurationContext {
private CollectorSink<Object> collectorSink;
......
......@@ -15,9 +15,9 @@
*/
package teetime.framework.exceptionHandling;
import teetime.framework.AnalysisContext;
import teetime.framework.ConfigurationContext;
public class ExceptionTestConfiguration extends AnalysisContext {
public class ExceptionTestConfiguration extends ConfigurationContext {
ExceptionTestProducerStage first;
ExceptionTestConsumerStage second;
......
......@@ -30,7 +30,7 @@ import org.junit.Before;
import org.junit.Test;
import teetime.framework.Analysis;
import teetime.framework.AnalysisContext;
import teetime.framework.ConfigurationContext;
import teetime.framework.AnalysisException;
import teetime.util.Pair;
......@@ -122,7 +122,7 @@ public class InstanceOfFilterTest {
}
}
private static class InstanceOfFilterTestConfig extends AnalysisContext {
private static class InstanceOfFilterTestConfig extends ConfigurationContext {
public InstanceOfFilterTestConfig() {
InitialElementProducer<Object> elementProducer = new InitialElementProducer<Object>();
......
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