浏览代码

fehler in sortedOutgoing Edges behoben

Kolja Strohm 7 年之前
父节点
当前提交
88259fd0c8
共有 2 个文件被更改,包括 8 次插入3 次删除
  1. 7 2
      src/Algorithms/Animated/BK/BlockCalc.java
  2. 1 1
      src/Model/LayeredNode.java

+ 7 - 2
src/Algorithms/Animated/BK/BlockCalc.java

@@ -95,7 +95,11 @@ public class BlockCalc implements AlgorithmStage {
 		{
 		    if( current.getAlignedTo( layout ) == current )
 		    {
-                LayeredGraphNode u = incommingEdges.get( m - 1 ).getSources().get( 0 );
+                LayeredGraphNode u = null;
+                if( layout == LayoutType.TOP_BOTTOM_LEFT || layout == LayoutType.TOP_BOTTOM_RIGHT )
+                    u = incommingEdges.get( m - 1 ).getSources().get( 0 );
+                if( layout == LayoutType.BOTTOM_TOP_LEFT || layout == LayoutType.BOTTOM_TOP_RIGHT )
+                    u = incommingEdges.get( m - 1 ).getTargets().get( 0 );
                 ArrayList<LayeredGraphEdge> conflicts = incommingEdges.get( m - 1 ).calcConflictedEdges();
 		        if( !incommingEdges.get( m - 1 ).isConflicted() && r < graph.getContainedLayers().get( calcBeforeLayerIndex() ).indexOf( u ) + 1 )
 		        {
@@ -117,11 +121,12 @@ public class BlockCalc implements AlgorithmStage {
 		            current.setAlignTo( current.getRoot( layout ), layout );
 		            r = graph.getContainedLayers().get( calcBeforeLayerIndex() ).indexOf( u ) + 1;
 		            int oldStep = step++;
+		            final LayeredGraphNode uf = u;
 		            backwards.add( 0, () -> {
 		                System.out.println( "Stepping Backwards... (Step " + oldStep + ")" );
 			        	for( int i = 0; i < conflicts.size(); i++ )
 			        		conflicts.get( i ).setConflicted( oldConflicts.get( i ) );
-		                u.setAlignTo( oldAlignU, layout );
+			        	uf.setAlignTo( oldAlignU, layout );
 		                current.setColor( oldColorCurrent, layout );
 		                current.setRoot( oldRootCurrent, layout );
 		                current.setAlignTo( oldAlignCurrent, layout );

+ 1 - 1
src/Model/LayeredNode.java

@@ -674,7 +674,7 @@ public class LayeredNode implements LayeredGraphNode {
         {
         	for( LayeredGraphEdge e : unsorted )
             {
-                if( e.getSources().contains( node ) )
+                if( e.getTargets().contains( node ) )
                 	result.add( e );
             }
         }