|
@@ -0,0 +1,61 @@
|
|
|
|
+package Algorithms.Animated.BK;
|
|
|
|
+
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+
|
|
|
|
+import Algorithms.Animated.AlgorithmStage;
|
|
|
|
+import Algorithms.Animated.BackwardAction;
|
|
|
|
+import Model.LayeredGraphNode;
|
|
|
|
+
|
|
|
|
+public class ConflictDetection implements AlgorithmStage {
|
|
|
|
+
|
|
|
|
+ private LayeredGraphNode graph;
|
|
|
|
+ private ArrayList< BackwardAction > actions;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ private int i;
|
|
|
|
+ private int l;
|
|
|
|
+ private int l1;
|
|
|
|
+ private int k0;
|
|
|
|
+
|
|
|
|
+ ConflictDetection( LayeredGraphNode graph )
|
|
|
|
+ {
|
|
|
|
+ this.graph = graph;
|
|
|
|
+ actions = new ArrayList<>();
|
|
|
|
+ i = 1;
|
|
|
|
+ k0 = 0;
|
|
|
|
+ l = 0;
|
|
|
|
+ l1 = 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public StageStatus forwardStep() {
|
|
|
|
+ //if( l1 == graph.getContainedLayers().get( i + 1 ).size() - 1 || )
|
|
|
|
+ return calcNextStatus();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private StageStatus calcNextStatus()
|
|
|
|
+ {
|
|
|
|
+ l1++;
|
|
|
|
+ if( l1 >= graph.getContainedLayers().get( i + 1 ).size() )
|
|
|
|
+ {
|
|
|
|
+ i++;
|
|
|
|
+ if( i >= graph.getContainedLayers().size() - 2 )
|
|
|
|
+ {
|
|
|
|
+ i--;
|
|
|
|
+ l1--;
|
|
|
|
+ return StageStatus.FINISHED;
|
|
|
|
+ }
|
|
|
|
+ l1 = 0;
|
|
|
|
+ k0 = 0;
|
|
|
|
+ l = 0;
|
|
|
|
+ }
|
|
|
|
+ return StageStatus.UNFINISHED;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public StageStatus backwardStep() {
|
|
|
|
+ // TODO Auto-generated method stub
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|