Skip to content
Snippets Groups Projects
Commit 035cf2e0 authored by Christian Wulf's avatar Christian Wulf
Browse files

worked on draft for Traversor

parent 1206afc2
No related branches found
No related tags found
No related merge requests found
package teetime.framework;
import teetime.framework.pipe.IPipe;
public interface StageVisitor {
public enum VisitorBehavior {
CONTINUE, STOP
}
VisitorBehavior visit(Stage stage);
VisitorBehavior visit(Stage stage, IPipe inputPipe);
}
package teetime.framework;
import java.util.HashSet;
import java.util.Set;
import teetime.framework.StageVisitor.VisitorBehavior;
import teetime.framework.pipe.IPipe;
public class Traversor {
private final StageVisitor stageVisitor;
private final Set<Stage> visitedStage = new HashSet<Stage>();
public Traversor(final StageVisitor stageVisitor) {
this.stageVisitor = stageVisitor;
}
public void traverse(final Stage stage) {
VisitorBehavior visitorBehavior = stageVisitor.visit(stage);
public void traverse(final Stage stage, final IPipe inputPipe) {
if (!visitedStage.contains(stage)) {
visitedStage.add(stage);
} else {
return;
}
VisitorBehavior visitorBehavior = stageVisitor.visit(stage, inputPipe);
if (visitorBehavior == VisitorBehavior.STOP) {
return;
}
......@@ -22,7 +32,7 @@ public class Traversor {
IPipe pipe = outputPort.getPipe();
if (null != pipe) {
Stage owningStage = pipe.getTargetPort().getOwningStage();
traverse(owningStage); // recursive call
traverse(owningStage, pipe); // recursive call
}
}
}
......
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