|
@@ -1,14 +1,26 @@
|
|
|
package bk;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.Stack;
|
|
|
+import java.util.List;
|
|
|
|
|
|
import javax.swing.JTree;
|
|
|
|
|
|
-import animation.AlgorithmStage;
|
|
|
-import animation.BackwardAction;
|
|
|
+import animation.CodeLine;
|
|
|
+import animation.ControlFlow;
|
|
|
+import animation.Memory;
|
|
|
import animation.PseudoCodeNode;
|
|
|
-import animation.PseudoCodeNode.CodeAction;
|
|
|
+import animation.Memory.MemoryType;
|
|
|
+import animation.Memory.ReadOnlyMemory;
|
|
|
+import bk.LayoutType;
|
|
|
+import codelines.DeclareVariable;
|
|
|
+import codelines.ForEachLoop;
|
|
|
+import codelines.ForLoop;
|
|
|
+import codelines.FunctionCall;
|
|
|
+import codelines.FunctionDefinition;
|
|
|
+import codelines.IfLoop;
|
|
|
+import codelines.Comment;
|
|
|
+import codelines.SetVariable;
|
|
|
+import codelines.WhileLoop;
|
|
|
import graph.LayeredGraphEdge;
|
|
|
import graph.LayeredGraphNode;
|
|
|
import lib.TextLayoutHelper;
|
|
@@ -19,651 +31,216 @@ import lib.TextLayoutHelper;
|
|
|
* @author kolja and eren
|
|
|
*
|
|
|
*/
|
|
|
-public class ConflictDetection implements AlgorithmStage {
|
|
|
-
|
|
|
- private LayeredGraphNode graph;
|
|
|
- private Stack<BackwardAction> actions;
|
|
|
-
|
|
|
- private int i;
|
|
|
- private int l1;
|
|
|
- private int k0;
|
|
|
- private int k1;
|
|
|
- private int l;
|
|
|
- private int k;
|
|
|
- private int hidden_k;
|
|
|
- /**
|
|
|
- * line number in Carstens' pseudocode listing 3.1
|
|
|
- */
|
|
|
- private int pseudo_line;
|
|
|
- private PseudoCodeNode lines[];
|
|
|
- private boolean breakPoint;
|
|
|
- private boolean skip;
|
|
|
- private ArrayList< PseudoCodeNode > subgraphNodes;
|
|
|
- private ArrayList< ConflictDetection > subgraphAlgs;
|
|
|
- private int vIndex;
|
|
|
- private boolean insideSubgraph;
|
|
|
-
|
|
|
- public ConflictDetection(LayeredGraphNode graph) {
|
|
|
- this.graph = graph;
|
|
|
- actions = new Stack<>();
|
|
|
- i = 0; // will be increased before first iteration
|
|
|
- l1 = -1; // will be increased before first iteration
|
|
|
- k0 = 0;
|
|
|
- k1 = 0;
|
|
|
- l = 0;
|
|
|
- k = 0;
|
|
|
- hidden_k = 0;
|
|
|
- pseudo_line = 1;
|
|
|
- breakPoint = false;
|
|
|
- skip = false;
|
|
|
- subgraphAlgs = new ArrayList<>();
|
|
|
- subgraphNodes = new ArrayList<>();
|
|
|
- vIndex = 0;
|
|
|
- insideSubgraph = false;
|
|
|
- for( @SuppressWarnings("unused") LayeredGraphNode n : graph.getContainedNodes() )
|
|
|
- {
|
|
|
- subgraphAlgs.add( null );
|
|
|
- subgraphNodes.add( null );
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Override
|
|
|
- public StageStatus forwardStep() {
|
|
|
- int old_line = pseudo_line;
|
|
|
- int old_k = k;
|
|
|
- int old_k0 = k0;
|
|
|
- int old_k1 = k1;
|
|
|
- int old_l = l;
|
|
|
- int old_l1 = l1;
|
|
|
- int old_hidden_k = hidden_k;
|
|
|
-
|
|
|
- switch (pseudo_line) {
|
|
|
- case 1:
|
|
|
- i++;
|
|
|
- actions.push(() -> {
|
|
|
- i--;
|
|
|
- pseudo_line = old_line;
|
|
|
- selectNodes(pseudo_line);
|
|
|
- });
|
|
|
- if (i <= graph.getContainedLayers().size() - 2) {
|
|
|
- pseudo_line++;
|
|
|
- } else {
|
|
|
- pseudo_line = 16;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- k0 = 0;
|
|
|
- l = 0;
|
|
|
- l1 = -1; // will be increased before first iteration
|
|
|
- pseudo_line++;
|
|
|
- actions.push(() -> {
|
|
|
- pseudo_line = old_line;
|
|
|
- k0 = old_k0;
|
|
|
- l = old_l;
|
|
|
- l1 = old_l1;
|
|
|
- selectNodes(pseudo_line);
|
|
|
- });
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- l1++;
|
|
|
- actions.push(() -> {
|
|
|
- l1--;
|
|
|
- pseudo_line = old_line;
|
|
|
- selectNodes(pseudo_line);
|
|
|
- });
|
|
|
- if (l1 < graph.getContainedLayers().get(i + 1).size()) {
|
|
|
- pseudo_line += 1;
|
|
|
- } else {
|
|
|
- pseudo_line = 1;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- actions.push(() -> {
|
|
|
- pseudo_line = old_line;
|
|
|
- selectNodes(pseudo_line);
|
|
|
- });
|
|
|
- if (graph.getContainedLayers().get(i + 1).size() == l1 || incidentToInnerSegmentBetweenLiPlusOneAndLi()) {
|
|
|
- pseudo_line++;
|
|
|
- } else {
|
|
|
- pseudo_line = 3;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 5:
|
|
|
- actions.push(() -> {
|
|
|
- k1 = old_k1;
|
|
|
- pseudo_line = old_line;
|
|
|
- selectNodes(pseudo_line);
|
|
|
- });
|
|
|
- k1 = graph.getContainedLayers().get(i).size() - 1;
|
|
|
- pseudo_line++;
|
|
|
- break;
|
|
|
- case 6:
|
|
|
- actions.push(() -> {
|
|
|
- pseudo_line = old_line;
|
|
|
- selectNodes(pseudo_line);
|
|
|
- });
|
|
|
- if (incidentToInnerSegmentBetweenLiPlusOneAndLi()) {
|
|
|
- pseudo_line++;
|
|
|
- } else {
|
|
|
- pseudo_line = 9;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 7:
|
|
|
- actions.push(() -> {
|
|
|
- k1 = old_k1;
|
|
|
- pseudo_line = old_line;
|
|
|
- selectNodes(pseudo_line);
|
|
|
- });
|
|
|
- k1 = graph.getContainedLayers().get(i).indexOf(
|
|
|
- graph.getContainedLayers().get(i + 1).get(l1).getSortedIncomingEdges().get(0).getSources().get(0));
|
|
|
- pseudo_line = 9;
|
|
|
- break;
|
|
|
- case 9:
|
|
|
- actions.push(() -> {
|
|
|
- hidden_k = old_hidden_k;
|
|
|
- pseudo_line = old_line;
|
|
|
- selectNodes(pseudo_line);
|
|
|
- });
|
|
|
- if (l <= l1) {
|
|
|
- pseudo_line++;
|
|
|
- hidden_k = 0; // will not be increased before first iteration
|
|
|
- k = graph.getContainedLayers().get(i).indexOf(graph.getContainedLayers().get(i + 1).get(l)
|
|
|
- .getSortedIncomingEdges().get(hidden_k).getSources().get(0));
|
|
|
- } else {
|
|
|
- pseudo_line = 15;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 10:
|
|
|
- actions.push(() -> {
|
|
|
- k = old_k;
|
|
|
- pseudo_line = old_line;
|
|
|
- selectNodes(pseudo_line);
|
|
|
- });
|
|
|
- if (hidden_k < graph.getContainedLayers().get(i + 1).get(l).getSortedIncomingEdges().size()) {
|
|
|
- k = graph.getContainedLayers().get(i).indexOf(graph.getContainedLayers().get(i + 1).get(l)
|
|
|
- .getSortedIncomingEdges().get(hidden_k).getSources().get(0));
|
|
|
- pseudo_line++;
|
|
|
- } else {
|
|
|
- pseudo_line = 13;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 11:
|
|
|
- actions.push(() -> {
|
|
|
- hidden_k--;
|
|
|
- graph.getContainedLayers().get(i + 1).get(l).getSortedIncomingEdges().get(hidden_k).setConflicted(false,
|
|
|
- null);
|
|
|
- pseudo_line = old_line;
|
|
|
- selectNodes(pseudo_line);
|
|
|
- });
|
|
|
- if (k < k0 || k > k1) {
|
|
|
- graph.getContainedLayers().get(i + 1).get(l).getSortedIncomingEdges().get(hidden_k).setConflicted(true,
|
|
|
- null);
|
|
|
- }
|
|
|
- hidden_k++;
|
|
|
- pseudo_line = 10;
|
|
|
- break;
|
|
|
- case 13:
|
|
|
- actions.push(() -> {
|
|
|
- l--;
|
|
|
- pseudo_line = old_line;
|
|
|
- selectNodes(pseudo_line);
|
|
|
- });
|
|
|
- l++;
|
|
|
- pseudo_line = 9;
|
|
|
- break;
|
|
|
- case 15:
|
|
|
- actions.push(() -> {
|
|
|
- k0 = old_k0;
|
|
|
- pseudo_line = old_line;
|
|
|
- selectNodes(pseudo_line);
|
|
|
- });
|
|
|
- k0 = k1;
|
|
|
- pseudo_line = 3;
|
|
|
- break;
|
|
|
- case 16:
|
|
|
- if( vIndex < graph.getContainedNodes().size() )
|
|
|
- {
|
|
|
- while( vIndex < graph.getContainedNodes().size() && graph.getContainedNodes().get( vIndex ).getContainedNodes().size() == 0 )
|
|
|
- vIndex++;
|
|
|
- if( vIndex < graph.getContainedNodes().size() )
|
|
|
- {
|
|
|
- LayeredGraphNode current = graph.getContainedNodes().get( vIndex );
|
|
|
- current.setSelected( null );
|
|
|
- if( current.getContainedNodes().size() > 0 )
|
|
|
- {
|
|
|
- insideSubgraph = true;
|
|
|
- breakPoint = false;
|
|
|
- boolean sel = subgraphNodes.get( vIndex ).isSelected();
|
|
|
- CodeAction ac = subgraphNodes.get( vIndex ).setSelected( true );
|
|
|
- if( !sel )
|
|
|
- breakPoint |= ac == CodeAction.STOP;
|
|
|
- do {
|
|
|
- switch( subgraphAlgs.get( vIndex ).forwardStep() )
|
|
|
- {
|
|
|
- case BREAKPOINT:
|
|
|
- return StageStatus.BREAKPOINT;
|
|
|
- case UNFINISHED:
|
|
|
- break;
|
|
|
- case FINISHED:
|
|
|
- insideSubgraph = false;
|
|
|
- subgraphNodes.get( vIndex ).setSelected( false );
|
|
|
- vIndex++;
|
|
|
- ac = null;
|
|
|
- break;
|
|
|
- }
|
|
|
- } while( ac == CodeAction.SKIP && !breakPoint );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if( vIndex >= graph.getContainedNodes().size() )
|
|
|
- {
|
|
|
- for( PseudoCodeNode p : lines )
|
|
|
- {
|
|
|
- if( p != null )
|
|
|
- p.setSelected( false );
|
|
|
- }
|
|
|
- return StageStatus.FINISHED;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- selectNodes(pseudo_line);
|
|
|
- if( breakPoint )
|
|
|
- return StageStatus.BREAKPOINT;
|
|
|
- if( skip )
|
|
|
- return forwardStep();
|
|
|
- return StageStatus.UNFINISHED;
|
|
|
- }
|
|
|
-
|
|
|
- private void selectNodes(int next_line) {
|
|
|
- if( pseudo_line < 16 )
|
|
|
- {
|
|
|
- if (next_line >= 3 && l < graph.getContainedLayers().get(i + 1).size()) {
|
|
|
- graph.getContainedLayers().get(i + 1).get(l).setSelected(null);
|
|
|
- }
|
|
|
-
|
|
|
- if (next_line >= 4) {
|
|
|
- graph.getContainedLayers().get(i + 1).get(l1).setSelected(null);
|
|
|
- }
|
|
|
-
|
|
|
- if (next_line >= 3) {
|
|
|
- graph.getContainedLayers().get(i).get(k0).setSelected(null);
|
|
|
- }
|
|
|
+public class ConflictDetection {
|
|
|
|
|
|
- if (next_line >= 6) {
|
|
|
- graph.getContainedLayers().get(i).get(k1).setSelected(null);
|
|
|
- }
|
|
|
-
|
|
|
- if (next_line == 10 || next_line == 11) {
|
|
|
- graph.getContainedLayers().get(i).get(k).setSelected(null);
|
|
|
- }
|
|
|
- }
|
|
|
- breakPoint = false;
|
|
|
- skip = false;
|
|
|
- for( PseudoCodeNode p : lines )
|
|
|
- {
|
|
|
- if( p != null )
|
|
|
- p.setSelected( false );
|
|
|
- }
|
|
|
- markCode( lines[ next_line - 1 ] );
|
|
|
- }
|
|
|
-
|
|
|
- private int getCodeDepth( PseudoCodeNode n )
|
|
|
- {
|
|
|
- if( n == lines[ 0 ].getParent() )
|
|
|
- return 0;
|
|
|
- return 1 + getCodeDepth( (PseudoCodeNode)n.getParent() );
|
|
|
+ public static String buildDebugString( Memory m ) {
|
|
|
+ if( m.isSomewhereDefined( "l", MemoryType.LOCAL ) && m.isSomewhereDefined( "i", MemoryType.LOCAL ) &&
|
|
|
+ m.<Integer>read( "l", MemoryType.LOCAL ) < m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL).getContainedLayers().get( m.<Integer>read( "i", MemoryType.LOCAL ) + 1 ).size() )
|
|
|
+ m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL).getContainedLayers().get(m.<Integer>read( "i", MemoryType.LOCAL ) + 1).get(m.<Integer>read( "l", MemoryType.LOCAL )).setSelected(null);
|
|
|
+
|
|
|
+ if( m.isSomewhereDefined( "i", MemoryType.LOCAL ) && m.isSomewhereDefined( "l1", MemoryType.LOCAL ) &&
|
|
|
+ m.<Integer>read( "l1", MemoryType.LOCAL ) < m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL).getContainedLayers().get(m.<Integer>read( "i", MemoryType.LOCAL ) + 1).size() ) {
|
|
|
+ m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL).getContainedLayers().get(m.<Integer>read( "i", MemoryType.LOCAL ) + 1).get(m.<Integer>read( "l1", MemoryType.LOCAL )).setSelected(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ if( m.isSomewhereDefined( "i", MemoryType.LOCAL ) && m.isSomewhereDefined( "k0", MemoryType.LOCAL ) &&
|
|
|
+ m.<Integer>read( "k0", MemoryType.LOCAL ) < m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL).getContainedLayers().get(m.read( "i", MemoryType.LOCAL )).size()) {
|
|
|
+ m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL).getContainedLayers().get(m.read( "i", MemoryType.LOCAL )).get(m.<Integer>read( "k0", MemoryType.LOCAL )).setSelected(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ if( m.isSomewhereDefined( "i", MemoryType.LOCAL ) && m.isSomewhereDefined( "k1", MemoryType.LOCAL ) &&
|
|
|
+ m.<Integer>read( "k1", MemoryType.LOCAL ) < m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL).getContainedLayers().get(m.read( "i", MemoryType.LOCAL )).size() ) {
|
|
|
+ m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL).getContainedLayers().get(m.read( "i", MemoryType.LOCAL )).get(m.<Integer>read( "k1", MemoryType.LOCAL )).setSelected(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ if( m.isSomewhereDefined( "n", MemoryType.LOCAL ) )
|
|
|
+ {
|
|
|
+ m.<LayeredGraphNode>read( "n", MemoryType.LOCAL ).setSelected( null );
|
|
|
+ }
|
|
|
+ String info = "| i | l | l1 | k0 | k1 | v | n |\n";
|
|
|
+ info += "|----|----|----|----|----|-----|-----|\n";
|
|
|
+ String i = "null";
|
|
|
+ String l = "null";
|
|
|
+ String l1 = "null";
|
|
|
+ String k0 = "null";
|
|
|
+ String k1 = "null";
|
|
|
+ String v = "null";
|
|
|
+ String n = "null";
|
|
|
+ if( m.isSomewhereDefined( "i", MemoryType.LOCAL ) )
|
|
|
+ i = "" + m.<Integer>read( "i", MemoryType.LOCAL );
|
|
|
+ if( m.isSomewhereDefined( "l", MemoryType.LOCAL ) )
|
|
|
+ l = "" + m.<Integer>read( "l", MemoryType.LOCAL );
|
|
|
+ if( m.isSomewhereDefined( "l1", MemoryType.LOCAL ) )
|
|
|
+ l1 = "" + m.<Integer>read( "l1", MemoryType.LOCAL );
|
|
|
+ if( m.isSomewhereDefined( "k0", MemoryType.LOCAL ) )
|
|
|
+ k0 = "" + m.<Integer>read( "k0", MemoryType.LOCAL );
|
|
|
+ if( m.isSomewhereDefined( "k1", MemoryType.LOCAL ) )
|
|
|
+ k1 = "" + m.<Integer>read( "k1", MemoryType.LOCAL );
|
|
|
+ if( m.isSomewhereDefined( "v", MemoryType.LOCAL ) && m.<LayeredGraphEdge>read( "v", MemoryType.LOCAL ).getSources().get( 0 ).getName() != null )
|
|
|
+ v = "" + m.<LayeredGraphEdge>read( "v", MemoryType.LOCAL ).getSources().get( 0 ).getName();
|
|
|
+ if( m.isSomewhereDefined( "n", MemoryType.LOCAL ) && m.<LayeredGraphNode>read( "n", MemoryType.LOCAL ).getName() != null )
|
|
|
+ n = "" + m.<LayeredGraphNode>read( "n", MemoryType.LOCAL ).getName();
|
|
|
+ info += "|" + TextLayoutHelper.strToLen( i, 4 ) +
|
|
|
+ "|" + TextLayoutHelper.strToLen( l, 4 ) +
|
|
|
+ "|" + TextLayoutHelper.strToLen( l1, 4 ) +
|
|
|
+ "|" + TextLayoutHelper.strToLen( k0, 4 ) +
|
|
|
+ "|" + TextLayoutHelper.strToLen( k1, 4 ) +
|
|
|
+ "|" + TextLayoutHelper.strToLen( v, 5 ) +
|
|
|
+ "|" + TextLayoutHelper.strToLen( n, 5 ) + "|\n";
|
|
|
+ return info;
|
|
|
}
|
|
|
|
|
|
- private void markCode( PseudoCodeNode n )
|
|
|
- {
|
|
|
- if( n == lines[ 0 ].getRoot() )
|
|
|
- return;
|
|
|
- if( !n.hasSelectedSubnode() )
|
|
|
- {
|
|
|
- CodeAction action = n.setSelected( true );
|
|
|
- breakPoint |= action == CodeAction.STOP;
|
|
|
- skip |= action == CodeAction.SKIP;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- CodeAction action = n.setSelected( true );
|
|
|
- skip |= action == CodeAction.SKIP;
|
|
|
- }
|
|
|
- if( n == lines[ 0 ] )
|
|
|
- return;
|
|
|
- markCode( (PseudoCodeNode)n.getParent() );
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public StageStatus backwardStep() {
|
|
|
- if( pseudo_line == 16 )
|
|
|
- {
|
|
|
- while( vIndex >= graph.getContainedNodes().size() || ( vIndex >= 0 && graph.getContainedNodes().get( vIndex ).getContainedNodes().size() == 0 ) )
|
|
|
- vIndex--;
|
|
|
- if( vIndex >= 0 )
|
|
|
- {
|
|
|
- LayeredGraphNode current = graph.getContainedNodes().get( vIndex );
|
|
|
- current.setSelected( null );
|
|
|
- if( subgraphAlgs.get( vIndex ) != null )
|
|
|
- {
|
|
|
- insideSubgraph = true;
|
|
|
- breakPoint = false;
|
|
|
- boolean selected = subgraphNodes.get( vIndex ).isSelected();
|
|
|
- CodeAction action = subgraphNodes.get( vIndex ).setSelected( true );
|
|
|
- if( !selected )
|
|
|
- breakPoint |= action == CodeAction.STOP;
|
|
|
- do {
|
|
|
- switch( subgraphAlgs.get( vIndex ).backwardStep() )
|
|
|
- {
|
|
|
- case BREAKPOINT:
|
|
|
- return StageStatus.BREAKPOINT;
|
|
|
- case UNFINISHED:
|
|
|
- break;
|
|
|
- case FINISHED:
|
|
|
- insideSubgraph = false;
|
|
|
- subgraphNodes.get( vIndex ).setSelected( false );
|
|
|
- vIndex--;
|
|
|
- action = null;
|
|
|
- break;
|
|
|
- }
|
|
|
- } while( !breakPoint && action == CodeAction.SKIP );
|
|
|
- }
|
|
|
- }
|
|
|
- if( vIndex < 0 )
|
|
|
- {
|
|
|
- vIndex = 0;
|
|
|
- if (actions.size() == 0) {
|
|
|
- for( PseudoCodeNode p : lines )
|
|
|
- {
|
|
|
- if( p != null )
|
|
|
- p.setSelected( false );
|
|
|
- }
|
|
|
- return StageStatus.FINISHED;
|
|
|
- }
|
|
|
- actions.pop().reverse();
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (actions.size() == 0) {
|
|
|
- for( PseudoCodeNode p : lines )
|
|
|
- {
|
|
|
- if( p != null )
|
|
|
- p.setSelected( false );
|
|
|
- }
|
|
|
- return StageStatus.FINISHED;
|
|
|
- }
|
|
|
- actions.pop().reverse();
|
|
|
- }
|
|
|
- if( breakPoint )
|
|
|
- return StageStatus.BREAKPOINT;
|
|
|
- if( skip )
|
|
|
- return forwardStep();
|
|
|
- return StageStatus.UNFINISHED;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public PseudoCodeNode createPseudocodeTree(JTree tree) {
|
|
|
- PseudoCodeNode root = new PseudoCodeNode(TextLayoutHelper.setupPseudoCodeStage("Preprocessing (mark type 1 conflicts)"), tree);
|
|
|
- lines = new PseudoCodeNode[16];
|
|
|
- String vars[] = { "i", "L", "k0", "l", "l1", "k1", "k", "v" };
|
|
|
- lines[ 0 ] = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "for i=1 to |L|-2 do", vars ), tree );
|
|
|
- root.add( lines[ 0 ] );
|
|
|
- lines[ 1 ] = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "k0 = 0; l = 0;", vars ), tree );
|
|
|
- lines[ 0 ].add( lines[ 1 ] );
|
|
|
- lines[ 2 ] = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "for l1=0 to |L[i+1]|-1 do", vars ), tree );
|
|
|
- lines[ 0 ].add( lines[ 2 ] );
|
|
|
- lines[ 3 ] = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "if l1==|L[i+1]|-1 or L[i+1][l1] incident to inner segment between L[i+1] and L[i] then", vars ), tree );
|
|
|
- lines[ 2 ].add( lines[ 3 ] );
|
|
|
- lines[ 4 ] = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "k1 = |L[i]|-1;", vars ), tree );
|
|
|
- lines[ 3 ].add( lines[ 4 ] );
|
|
|
- lines[ 5 ] = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "if L[i+1][l1] incident to inner segment between L[i+1] and L[i] then", vars ), tree );
|
|
|
- lines[ 3 ].add( lines[ 5 ] );
|
|
|
- lines[ 6 ] = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "k1 = pos(pred(L[i+1][l1])[0]);", vars ), tree );
|
|
|
- lines[ 5 ].add( lines[ 6 ] );
|
|
|
- lines[ 8 ] = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "while l <= l1 do", vars ), tree );
|
|
|
- lines[ 3 ].add( lines[ 8 ] );
|
|
|
- lines[ 9 ] = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "foreach v in pred(L[i+1][l]) do", vars ), tree );
|
|
|
- lines[ 8 ].add( lines[ 9 ] );
|
|
|
- lines[ 10 ] = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "if k < k0 or k > k1 then mark segment (v,L[i+1][l]);", vars ), tree );
|
|
|
- lines[ 9 ].add( lines[ 10 ] );
|
|
|
- lines[ 12 ] = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "l = l+1;", vars ), tree );
|
|
|
- lines[ 8 ].add( lines[ 12 ] );
|
|
|
- lines[ 14 ] = new PseudoCodeNode( TextLayoutHelper.setupPseudoCode( "k0 = k1;", vars ), tree );
|
|
|
- lines[ 3 ].add( lines[ 14 ] );
|
|
|
- lines[ 15 ] = new PseudoCodeNode( TextLayoutHelper.setupPseudoCodeStage( "mark conflicts in subgraphs" ), tree );
|
|
|
- root.add( lines[ 15 ] );
|
|
|
- for( int i = 0; i < graph.getContainedNodes().size(); i++ )
|
|
|
- {
|
|
|
- LayeredGraphNode current = graph.getContainedNodes().get( i );
|
|
|
- if( current.getContainedNodes().size() > 0 )
|
|
|
- {
|
|
|
- ConflictDetection extcalc = new ConflictDetection( current );
|
|
|
- PseudoCodeNode subNode = extcalc.createPseudocodeTree( tree );
|
|
|
- lines[ 15 ].add( subNode );
|
|
|
- subgraphAlgs.set( i, extcalc );
|
|
|
- subgraphNodes.set( i, subNode );
|
|
|
- }
|
|
|
- }
|
|
|
+ public static PseudoCodeNode mark_conflicts(JTree tree) {
|
|
|
+ String vars[] = { "i", "L", "k0", "l", "l1", "k1", "v", "graph", "n" };
|
|
|
+ String params[] = { "graph" };
|
|
|
+ PseudoCodeNode root = new PseudoCodeNode( "function mark_conflicts( graph )", vars, tree, new FunctionDefinition( params ) );
|
|
|
+ PseudoCodeNode text = new PseudoCodeNode( "-- mark conflicts in subgraphs --", vars, tree, new Comment() );
|
|
|
+ root.add( text );
|
|
|
+ PseudoCodeNode foreach = new PseudoCodeNode( "foreach n in graph.getContainedNodes() do", vars, tree, new ForEachLoop<LayeredGraphNode>( "n" ) {
|
|
|
+ @Override
|
|
|
+ protected List<LayeredGraphNode> list(ReadOnlyMemory m) {
|
|
|
+ return m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL ).getContainedNodes();
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ root.add( foreach );
|
|
|
+ PseudoCodeNode ifNode = new PseudoCodeNode( "if n has subgraph then", vars, tree, new IfLoop() {
|
|
|
+ @Override
|
|
|
+ protected boolean condition(ReadOnlyMemory m) {
|
|
|
+ return m.<LayeredGraphNode>read( "n", MemoryType.LOCAL ).getContainedLayers().size() > 0;
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ foreach.add( ifNode );
|
|
|
+ PseudoCodeNode call = new PseudoCodeNode( "call mark_conflicts( n );", vars, tree, new FunctionCall( root, new String[]{ "n" } ) );
|
|
|
+ ifNode.add( call );
|
|
|
+ text = new PseudoCodeNode( "-- mark conflicts in graph --", vars, tree, new Comment() );
|
|
|
+ root.add( text );
|
|
|
+ PseudoCodeNode init = new PseudoCodeNode( "L = graph.getContainedLayers();", vars, tree, new DeclareVariable<ArrayList<ArrayList<LayeredGraphNode>>>( "L" ) {
|
|
|
+ @Override
|
|
|
+ protected ArrayList<ArrayList<LayeredGraphNode>> value(ReadOnlyMemory m) {
|
|
|
+ return m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL ).getContainedLayers();
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ root.add( init );
|
|
|
+ PseudoCodeNode outerLoop = new PseudoCodeNode( "for i=1 to |L|-2 do", vars, tree, new ForLoop( "i" ) {
|
|
|
+ @Override
|
|
|
+ protected int minimum( ReadOnlyMemory m ) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ protected int maximum( ReadOnlyMemory m ) {
|
|
|
+ return m.<ArrayList<ArrayList<LayeredGraphNode>>>read( "L", MemoryType.LOCAL ).size() - 2;
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ root.add( outerLoop );
|
|
|
+ PseudoCodeNode line = new PseudoCodeNode( "k0 = 0; l = 0;", vars, tree, new CodeLine() {
|
|
|
+ @Override
|
|
|
+ public ControlFlow runForward(Memory m) {
|
|
|
+ m.declare( "k0", 0, MemoryType.LOCAL );
|
|
|
+ m.declare( "l", 0, MemoryType.LOCAL );
|
|
|
+ actions.push( (Memory mem) -> {
|
|
|
+ mem.undeclare( "k0", MemoryType.LOCAL );
|
|
|
+ mem.undeclare( "l", MemoryType.LOCAL );
|
|
|
+ } );
|
|
|
+ return new ControlFlow( ControlFlow.STEP_OVER );
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ outerLoop.add( line );
|
|
|
+ PseudoCodeNode innerLoop = new PseudoCodeNode( "for l1=0 to |L[i+1]|-1 do", vars, tree, new ForLoop( "l1" ) {
|
|
|
+ @Override
|
|
|
+ protected int minimum(ReadOnlyMemory m) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ protected int maximum(ReadOnlyMemory m) {
|
|
|
+ return m.<ArrayList<ArrayList<LayeredGraphNode>>>read( "L", MemoryType.LOCAL ).get( m.<Integer>read( "i", MemoryType.LOCAL ) + 1 ).size() - 1;
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ outerLoop.add( innerLoop );
|
|
|
+ ifNode = new PseudoCodeNode( "if l1==|L[i+1]|-1 or L[i+1][l1] incident to inner segment between L[i+1] and L[i] then", vars, tree, new IfLoop() {
|
|
|
+ @Override
|
|
|
+ protected boolean condition(ReadOnlyMemory m) {
|
|
|
+ return m.<Integer>read( "l1", MemoryType.LOCAL ) == m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL ).getContainedLayers().get( m.<Integer>read( "i", MemoryType.LOCAL ) + 1).size() - 1 ||
|
|
|
+ incidentToInnerSegmentBetweenLiPlusOneAndLi( m );
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ innerLoop.add( ifNode );
|
|
|
+ line = new PseudoCodeNode( "k1 = |L[i]|-1;", vars, tree, new DeclareVariable<Integer>( "k1" ) {
|
|
|
+ @Override
|
|
|
+ protected Integer value(ReadOnlyMemory m) {
|
|
|
+ return (int)m.<ArrayList<ArrayList<LayeredGraphNode>>>read( "L", MemoryType.LOCAL ).get( m.read( "i", MemoryType.LOCAL ) ).size() - 1;
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ ifNode.add( line );
|
|
|
+ PseudoCodeNode innerIfNode = new PseudoCodeNode( "if L[i+1][l1] incident to inner segment between L[i+1] and L[i] then", vars, tree, new IfLoop() {
|
|
|
+ @Override
|
|
|
+ protected boolean condition(ReadOnlyMemory m) {
|
|
|
+ return incidentToInnerSegmentBetweenLiPlusOneAndLi( m );
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ ifNode.add( innerIfNode );
|
|
|
+
|
|
|
+ line = new PseudoCodeNode( "k1 = pos(pred(L[i+1][l1])[0]);", vars, tree, new SetVariable<Integer>( "k1" ) {
|
|
|
+ @Override
|
|
|
+ protected Integer value(ReadOnlyMemory m) {
|
|
|
+ return (int)m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL ).getContainedLayers().get( m.read( "i", MemoryType.LOCAL ) ).indexOf(
|
|
|
+ m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL ).getContainedLayers().get( m.<Integer>read( "i", MemoryType.LOCAL ) + 1 ).get( m.read( "l1", MemoryType.LOCAL ) ).getSortedIncomingEdges().get( 0 ).getSources().get( 0 ) );
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ innerIfNode.add( line );
|
|
|
+ PseudoCodeNode whileLoop = new PseudoCodeNode( "while l <= l1 do", vars, tree, new WhileLoop() {
|
|
|
+ @Override
|
|
|
+ protected boolean condition( ReadOnlyMemory m ) {
|
|
|
+ return m.<Integer>read( "l", MemoryType.LOCAL ) <= m.<Integer>read( "l1", MemoryType.LOCAL );
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ ifNode.add( whileLoop );
|
|
|
+ foreach = new PseudoCodeNode( "foreach v in pred(L[i+1][l]) do", vars, tree, new ForEachLoop<LayeredGraphEdge>( "v" ) {
|
|
|
+ @Override
|
|
|
+ protected List<LayeredGraphEdge> list(ReadOnlyMemory m) {
|
|
|
+ return m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL ).getContainedLayers().get( m.<Integer>read( "i", MemoryType.LOCAL ) + 1 ).get( m.read( "l", MemoryType.LOCAL ) ).getIncomingEdges();
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ whileLoop.add( foreach );
|
|
|
+ innerIfNode = new PseudoCodeNode( "if pos(v) < k0 or pos(v) > k1 then", vars, tree, new IfLoop() {
|
|
|
+ @Override
|
|
|
+ protected boolean condition(ReadOnlyMemory m) {
|
|
|
+ int k = m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL ).getContainedLayers().get( m.read( "i", MemoryType.LOCAL ) ).indexOf( m.<LayeredGraphEdge>read( "v", MemoryType.LOCAL ).getSources().get( 0 ) );
|
|
|
+ return k < m.<Integer>read( "k0", MemoryType.LOCAL ) || k > m.<Integer>read( "k1", MemoryType.LOCAL );
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ foreach.add( innerIfNode );
|
|
|
+ line = new PseudoCodeNode( "mark segment (v,L[i+1][l]);", vars, tree, new CodeLine() {
|
|
|
+ @Override
|
|
|
+ public ControlFlow runForward(Memory m) {
|
|
|
+ LayeredGraphEdge e = m.read( "v", MemoryType.LOCAL );
|
|
|
+ boolean old = e.isConflicted( LayoutType.TOP_BOTTOM_LEFT );
|
|
|
+ e.setConflicted( true, null );
|
|
|
+ actions.add( (Memory mem) -> {
|
|
|
+ e.setConflicted( old, null );
|
|
|
+ });
|
|
|
+ return new ControlFlow( ControlFlow.STEP_OVER );
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ innerIfNode.add( line );
|
|
|
+ line = new PseudoCodeNode( "l = l+1;", vars, tree, new SetVariable<Integer>( "l" ) {
|
|
|
+ @Override
|
|
|
+ protected Integer value(ReadOnlyMemory m) {
|
|
|
+ return (int)m.<Integer>read( "l", MemoryType.LOCAL ) + 1;
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ whileLoop.add( line );
|
|
|
+ line = new PseudoCodeNode( "k0 = k1;", vars, tree, new SetVariable<Integer>( "k0" ) {
|
|
|
+ @Override
|
|
|
+ protected Integer value(ReadOnlyMemory m) {
|
|
|
+ return (int)m.<Integer>read( "k1", MemoryType.LOCAL );
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ ifNode.add( line );
|
|
|
return root;
|
|
|
}
|
|
|
-
|
|
|
- @Override
|
|
|
- public StageStatus forwardStepOver() {
|
|
|
- if( !insideSubgraph )
|
|
|
- {
|
|
|
- int depth = getCodeDepth( lines[ pseudo_line - 1 ] );
|
|
|
- do
|
|
|
- {
|
|
|
- switch( forwardStep() )
|
|
|
- {
|
|
|
- case BREAKPOINT:
|
|
|
- return StageStatus.BREAKPOINT;
|
|
|
- case FINISHED:
|
|
|
- return StageStatus.FINISHED;
|
|
|
- case UNFINISHED:
|
|
|
- break;
|
|
|
- }
|
|
|
- } while( depth < getCodeDepth( lines[ pseudo_line - 1 ] ) );
|
|
|
- return StageStatus.UNFINISHED;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- boolean breakpoint = false;
|
|
|
- boolean selected = subgraphNodes.get( vIndex ).isSelected();
|
|
|
- CodeAction action = subgraphNodes.get( vIndex ).setSelected( true );
|
|
|
- if( !selected )
|
|
|
- breakpoint |= action == CodeAction.STOP;
|
|
|
- do {
|
|
|
- switch( subgraphAlgs.get( vIndex ).forwardStepOver() )
|
|
|
- {
|
|
|
- case BREAKPOINT:
|
|
|
- return StageStatus.BREAKPOINT;
|
|
|
- case UNFINISHED:
|
|
|
- if( breakpoint )
|
|
|
- return StageStatus.BREAKPOINT;
|
|
|
- return StageStatus.UNFINISHED;
|
|
|
- case FINISHED:
|
|
|
- insideSubgraph = false;
|
|
|
- subgraphNodes.get( vIndex ).setSelected( false );
|
|
|
- action = null;
|
|
|
- break;
|
|
|
- }
|
|
|
- } while( !breakpoint && action == CodeAction.SKIP );
|
|
|
- return StageStatus.UNFINISHED;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public StageStatus forwardStepOut() {
|
|
|
- if( !insideSubgraph )
|
|
|
- {
|
|
|
- int depth = getCodeDepth( lines[ pseudo_line - 1 ] );
|
|
|
- do
|
|
|
- {
|
|
|
- switch( forwardStep() )
|
|
|
- {
|
|
|
- case BREAKPOINT:
|
|
|
- return StageStatus.BREAKPOINT;
|
|
|
- case FINISHED:
|
|
|
- return StageStatus.FINISHED;
|
|
|
- case UNFINISHED:
|
|
|
- break;
|
|
|
- }
|
|
|
- } while( depth <= getCodeDepth( lines[ pseudo_line - 1 ] ) );
|
|
|
- return StageStatus.UNFINISHED;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- boolean breakpoint = false;
|
|
|
- boolean selected = subgraphNodes.get( vIndex ).isSelected();
|
|
|
- CodeAction action = subgraphNodes.get( vIndex ).setSelected( true );
|
|
|
- if( !selected )
|
|
|
- breakpoint |= action == CodeAction.STOP;
|
|
|
- do {
|
|
|
- switch( subgraphAlgs.get( vIndex ).forwardStepOut() )
|
|
|
- {
|
|
|
- case BREAKPOINT:
|
|
|
- return StageStatus.BREAKPOINT;
|
|
|
- case UNFINISHED:
|
|
|
- if( breakpoint )
|
|
|
- return StageStatus.BREAKPOINT;
|
|
|
- return StageStatus.UNFINISHED;
|
|
|
- case FINISHED:
|
|
|
- insideSubgraph = false;
|
|
|
- subgraphNodes.get( vIndex ).setSelected( false );
|
|
|
- action = null;
|
|
|
- break;
|
|
|
- }
|
|
|
- } while( !breakpoint && action == CodeAction.SKIP );
|
|
|
- return StageStatus.UNFINISHED;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public StageStatus backwardStepOver() {
|
|
|
- if( !insideSubgraph )
|
|
|
- {
|
|
|
- int depth = getCodeDepth( lines[ pseudo_line - 1 ] );
|
|
|
- do
|
|
|
- {
|
|
|
- switch( backwardStep() )
|
|
|
- {
|
|
|
- case BREAKPOINT:
|
|
|
- return StageStatus.BREAKPOINT;
|
|
|
- case FINISHED:
|
|
|
- return StageStatus.FINISHED;
|
|
|
- case UNFINISHED:
|
|
|
- break;
|
|
|
- }
|
|
|
- } while( depth < getCodeDepth( lines[ pseudo_line - 1 ] ) );
|
|
|
- return StageStatus.UNFINISHED;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- boolean breakpoint = false;
|
|
|
- boolean selected = subgraphNodes.get( vIndex ).isSelected();
|
|
|
- CodeAction action = subgraphNodes.get( vIndex ).setSelected( true );
|
|
|
- if( !selected )
|
|
|
- breakpoint |= action == CodeAction.STOP;
|
|
|
- do {
|
|
|
- switch( subgraphAlgs.get( vIndex ).backwardStepOver() )
|
|
|
- {
|
|
|
- case BREAKPOINT:
|
|
|
- return StageStatus.BREAKPOINT;
|
|
|
- case UNFINISHED:
|
|
|
- LayeredGraphNode current = graph.getContainedNodes().get( vIndex );
|
|
|
- current.setSelected( null );
|
|
|
- if( breakpoint )
|
|
|
- return StageStatus.BREAKPOINT;
|
|
|
- return StageStatus.UNFINISHED;
|
|
|
- case FINISHED:
|
|
|
- insideSubgraph = false;
|
|
|
- subgraphNodes.get( vIndex ).setSelected( false );
|
|
|
- action = null;
|
|
|
- break;
|
|
|
- }
|
|
|
- } while( !breakpoint && action == CodeAction.SKIP );
|
|
|
- return StageStatus.UNFINISHED;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public StageStatus backwardStepOut() {
|
|
|
- if( !insideSubgraph )
|
|
|
- {
|
|
|
- int depth = getCodeDepth( lines[ pseudo_line - 1 ] );
|
|
|
- do
|
|
|
- {
|
|
|
- switch( backwardStep() )
|
|
|
- {
|
|
|
- case BREAKPOINT:
|
|
|
- return StageStatus.BREAKPOINT;
|
|
|
- case FINISHED:
|
|
|
- return StageStatus.FINISHED;
|
|
|
- case UNFINISHED:
|
|
|
- break;
|
|
|
- }
|
|
|
- } while( depth <= getCodeDepth( lines[ pseudo_line - 1 ] ) );
|
|
|
- return StageStatus.UNFINISHED;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- boolean breakpoint = false;
|
|
|
- boolean selected = subgraphNodes.get( vIndex ).isSelected();
|
|
|
- CodeAction action = subgraphNodes.get( vIndex ).setSelected( true );
|
|
|
- if( !selected )
|
|
|
- breakpoint |= action == CodeAction.STOP;
|
|
|
- do {
|
|
|
- switch( subgraphAlgs.get( vIndex ).backwardStepOut() )
|
|
|
- {
|
|
|
- case BREAKPOINT:
|
|
|
- return StageStatus.BREAKPOINT;
|
|
|
- case UNFINISHED:
|
|
|
- LayeredGraphNode current = graph.getContainedNodes().get( vIndex );
|
|
|
- current.setSelected( null );
|
|
|
- if( breakpoint )
|
|
|
- return StageStatus.BREAKPOINT;
|
|
|
- return StageStatus.UNFINISHED;
|
|
|
- case FINISHED:
|
|
|
- insideSubgraph = false;
|
|
|
- subgraphNodes.get( vIndex ).setSelected( false );
|
|
|
- action = null;
|
|
|
- break;
|
|
|
- }
|
|
|
- } while( !breakpoint && action == CodeAction.SKIP );
|
|
|
- return StageStatus.UNFINISHED;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public String getDebugString() {
|
|
|
- String info = "| i | l | l1 | k0 | k1 | k |\n";
|
|
|
- info += "|----|----|----|----|----|----|\n";
|
|
|
- info += "|" + TextLayoutHelper.strToLen( "" + i, 4 ) +
|
|
|
- "|" + TextLayoutHelper.strToLen( "" + l, 4 ) +
|
|
|
- "|" + TextLayoutHelper.strToLen( "" + l1, 4 ) +
|
|
|
- "|" + TextLayoutHelper.strToLen( "" + k0, 4 ) +
|
|
|
- "|" + TextLayoutHelper.strToLen( "" + k1, 4 ) +
|
|
|
- "|" + TextLayoutHelper.strToLen( "" + k, 4 ) + "|\n";
|
|
|
- if( insideSubgraph && vIndex < graph.getContainedNodes().size() )
|
|
|
- {
|
|
|
- info += "Subgraph of " + graph.getContainedNodes().get( vIndex ).getName() + ":\n";
|
|
|
- String tmp = subgraphAlgs.get( vIndex ).getDebugString();
|
|
|
- info += tmp;
|
|
|
- return info;
|
|
|
- }
|
|
|
- return info;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * part of line 4 and 6 in the pseudocode
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- private boolean incidentToInnerSegmentBetweenLiPlusOneAndLi() {
|
|
|
- LayeredGraphNode curr = graph.getContainedLayers().get(i + 1).get(l1);
|
|
|
+
|
|
|
+ private static boolean incidentToInnerSegmentBetweenLiPlusOneAndLi( ReadOnlyMemory m ) {
|
|
|
+ LayeredGraphNode curr = m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL ).getContainedLayers().get( m.<Integer>read( "i", MemoryType.LOCAL ) + 1 ).get( m.read( "l1", MemoryType.LOCAL ) );
|
|
|
for (LayeredGraphEdge e : curr.getIncomingEdges()) {
|
|
|
if (e.isDummyEdge()) {
|
|
|
return true;
|