Parcourir la source

Merge branch 'master' into TestViewSystem

# Conflicts:
#	src/bk/BKNodePlacement.java
#	src/graph/LayeredNode.java
#	src/view/NodeView.java
Eren Yilmaz il y a 6 ans
Parent
commit
0b7833dac7

+ 1 - 1
doc/chapter/2architecture.tex

@@ -12,7 +12,7 @@ The following assumptions are made for the implementation of the node placement
 Regarding the last assumption, we found an example where for a disconnected graph the algorithm behaved incorrectly.
 Regarding the last assumption, we found an example where for a disconnected graph the algorithm behaved incorrectly.
 Maybe we will get rid of this assumption later, see chapter~\ref{ch:progress}.
 Maybe we will get rid of this assumption later, see chapter~\ref{ch:progress}.
 We are currently investigating another example, where the algorithm behaves incorrectly for a connected graph.
 We are currently investigating another example, where the algorithm behaves incorrectly for a connected graph.
-These two examples are included in the appendix (figures~\ref{fig:error_disconnected_img},~\ref{fig:error_connected_img},~\ref{fig:error_disconnected}, and~\ref{fig:error_connected},).
+These two examples are included in the appendix (figures~\ref{fig:error_disconnected_img},~\ref{fig:error_connected_img},~\ref{fig:error_disconnected}, and~\ref{fig:error_connected}).
 
 
 
 
 \section{Overview}\label{sec:components}
 \section{Overview}\label{sec:components}

+ 2 - 1
doc/chapter/3ui.tex

@@ -52,7 +52,8 @@ Figure~\ref{fig:originalpapergraph} compares our results to those of Brandes and
         \includegraphics[width=0.4\linewidth]{img/bk-example-ours}
         \includegraphics[width=0.4\linewidth]{img/bk-example-ours}
         \caption[The same graph as~\ref{fig:theirs}, displayed by \appname.]{The same graph as~\ref{fig:theirs}, displayed by \appname.
         \caption[The same graph as~\ref{fig:theirs}, displayed by \appname.]{The same graph as~\ref{fig:theirs}, displayed by \appname.
         The layouts are leftmost (first column), rightmost (third column), upper (first row) and lower (third row), respectively.
         The layouts are leftmost (first column), rightmost (third column), upper (first row) and lower (third row), respectively.
-        The balanced layout is in the center.}
+        The balanced layout is in the center.
+        The narrower nodes are dummy nodes.}
         \label{fig:ours}
         \label{fig:ours}
     \end{subfigure}\\\vspace{4mm}
     \end{subfigure}\\\vspace{4mm}
     \caption[Comparison to Brandes and Köpf]{Comparison of the implementation to the results of Brandes and Köpf~\cite{brandes_fast_2001}}
     \caption[Comparison to Brandes and Köpf]{Comparison of the implementation to the results of Brandes and Köpf~\cite{brandes_fast_2001}}

+ 21 - 5
doc/chapter/4progress.tex

@@ -1,3 +1,5 @@
+\section{Features}\label{sec:features}
+
 The following features are either planned (\planned), under construction (\progress) or done (\done):
 The following features are either planned (\planned), under construction (\progress) or done (\done):
 \begin{itemize}
 \begin{itemize}
     \item[\done] Reading a graph from an input file as described in section~\ref{sec:inputFileFormat}.
     \item[\done] Reading a graph from an input file as described in section~\ref{sec:inputFileFormat}.
@@ -20,7 +22,7 @@ The following features are either planned (\planned), under construction (\progr
     \begin{itemize}
     \begin{itemize}
         \item[\done] Drawing the nodes at their current position.
         \item[\done] Drawing the nodes at their current position.
         \item[\done] Drawing the nodes in the color of their blocks.
         \item[\done] Drawing the nodes in the color of their blocks.
-        \item[\done] Drawing a colored circle to show the class assignments.
+        \item[\progress] Drawing a colored background to show the class assignments.
         \item[\done] Drawing the edges just as plain straight lines.
         \item[\done] Drawing the edges just as plain straight lines.
         \item[\done] Drawing the conflicted edges in a different color.
         \item[\done] Drawing the conflicted edges in a different color.
         \item[\done] Drawing dummy nodes differently from other nodes.
         \item[\done] Drawing dummy nodes differently from other nodes.
@@ -32,12 +34,18 @@ The following features are either planned (\planned), under construction (\progr
         \item[\done] Showing pseudocode and the position where the algorithm currently is.
         \item[\done] Showing pseudocode and the position where the algorithm currently is.
         \begin{itemize}
         \begin{itemize}
             \item[\done] Clicking on the pseudocode to set a breakpoint at (not \reserved{goto}) a specific location.
             \item[\done] Clicking on the pseudocode to set a breakpoint at (not \reserved{goto}) a specific location.
+            \item[\planned] Customizing the font size of the code.
         \end{itemize}
         \end{itemize}
-        \item[\planned] Add a legend to explain the shapes and colors.
+        \item[\planned] Showing a legend to explain the shapes and colors.
+        \item[\done] Showing tooltips when hovering over code lines and nodes in the graph that show the state of the variables.
+        \item[\planned] Hovering the mose over a node to highlight it in all layouts.
     \end{itemize}
     \end{itemize}
     \item[\done] Running the algorithm step by step manually.
     \item[\done] Running the algorithm step by step manually.
     \item[\done] Running the algorithm step by step with configurable delay (\enquote{automatic execution}).
     \item[\done] Running the algorithm step by step with configurable delay (\enquote{automatic execution}).
-    \item[\done] Running the algorithm only on the unfolded parts of the source code (\enquote{step overrun}).
+    \item[\done] Running the algorithm only on the expanded parts of the source code (\enquote{step overrun}).
+    \begin{itemize}
+        \item[\planned] Right clicking the code to expand or collapse all lines up to a specified level.
+    \end{itemize}
     \item[\done] Using debugger-like commands such as \enquote{step into}, \enquote{step over}, \enquote{step out}.
     \item[\done] Using debugger-like commands such as \enquote{step into}, \enquote{step over}, \enquote{step out}.
     \item[\done] Adding buttons and other graphical elements to support the user interface (low priority, see figure~\ref{fig:sketch}).
     \item[\done] Adding buttons and other graphical elements to support the user interface (low priority, see figure~\ref{fig:sketch}).
     Currently there is only keyboard input (cf.\ section~\ref{sec:userInterface}).
     Currently there is only keyboard input (cf.\ section~\ref{sec:userInterface}).
@@ -48,6 +56,14 @@ The following features are either planned (\planned), under construction (\progr
     \item[\done] Working with hierarchical graphs.
     \item[\done] Working with hierarchical graphs.
     \item[\done] Scaling the display with the (adjustable) window size.
     \item[\done] Scaling the display with the (adjustable) window size.
     \item[\planned] Working with disconnected graphs (cf.\ section~\ref{sec:assumptions}), either by modifying the algorithm or by processing the connected components one by one (low priority).
     \item[\planned] Working with disconnected graphs (cf.\ section~\ref{sec:assumptions}), either by modifying the algorithm or by processing the connected components one by one (low priority).
-    \item[\done] Creating ElkNode~\cite{noauthor_elk:_2018} objects from LayeredNode (\ref{sec:graph}) objects.
-    \item[\planned] Creating LayeredNode (\ref{sec:graph}) objects from ElkNode~\cite{noauthor_elk:_2018} objects (low priority).
+    \item[\done] Creating ElkNode~\cite{noauthor_elk:_2018} objects from LayeredGraphNode (\ref{sec:graph}) objects.
+    \item[\planned] Creating LayeredGraphNode (\ref{sec:graph}) objects from ElkNode~\cite{noauthor_elk:_2018} objects (low priority).
+\end{itemize}
+
+\section{Known Issues}\label{sec:knownIssues}
+The most important unsolved issues are listed here.
+For a complete list, see \url{https://koljastrohm-games.com:3000/GraphDrawer/NodeShuffler/issues}.
+\begin{itemize}
+    \item Our implementation does not behave correctly for very few graphs, see section ~\ref{sec:assumptions} and figures~\ref{fig:error_disconnected_img},~\ref{fig:error_connected_img},~\ref{fig:error_disconnected}, and~\ref{fig:error_connected}.
+    \item Swing is not thread-safe, but we are using multiple threads, so every now and then there are race conditions causing mostly \code{ArrayIndexOutOfBoundsException}s and \code{NullPointerException}s.
 \end{itemize}
 \end{itemize}

+ 2 - 0
doc/chapter/appendix.tex

@@ -19,6 +19,8 @@
         Extremal layout & Defines in which order the layers are traversed and if a node is aligned with its upper or lower median. & Leftmost lower \\
         Extremal layout & Defines in which order the layers are traversed and if a node is aligned with its upper or lower median. & Leftmost lower \\
         \rowcolor{gray!25}
         \rowcolor{gray!25}
         Automatic execution & The state of the \code{AnimationController} where it repeatedly sends step commands with a certain delay & See section~\ref{sec:userInterface} \\
         Automatic execution & The state of the \code{AnimationController} where it repeatedly sends step commands with a certain delay & See section~\ref{sec:userInterface} \\
+        Automatic backwards execution & Special case of automatic execution in backwards direction & See section~\ref{sec:userInterface} \\
+        \rowcolor{gray!25}
         step overrun & The state of the \code{AnimationController} where it repeatedly sends step commands, but only inserts a delay after steps whose line of pseudocode is currently unfolded in the pseudocode view. & See section~\ref{sec:userInterface} \\
         step overrun & The state of the \code{AnimationController} where it repeatedly sends step commands, but only inserts a delay after steps whose line of pseudocode is currently unfolded in the pseudocode view. & See section~\ref{sec:userInterface} \\
         \\\\
         \\\\
 	\end{longtable}
 	\end{longtable}

BIN
doc/img/bk-example-ours.png


BIN
doc/img/example.png


BIN
doc/img/full-application-example.png


+ 3 - 1
src/animation/AnimatedAlgorithm.java

@@ -57,7 +57,9 @@ public abstract class AnimatedAlgorithm extends Thread {
             try {
             try {
                 if( processor != null )
                 if( processor != null )
                 {
                 {
-                    switch( ac.getNextAction() )
+                    Action action = ac.getNextAction();
+                    graph.unselectGraph();
+                    switch( action )
                     {
                     {
                     case FORWARD:
                     case FORWARD:
                     	status = processor.forwardStep();
                     	status = processor.forwardStep();

+ 1 - 1
src/animation/AnimationController.java

@@ -83,8 +83,8 @@ public class AnimationController {
      */
      */
     public void setNextAction( Action a )
     public void setNextAction( Action a )
     {
     {
-        next = a;
         synchronized( this ) {
         synchronized( this ) {
+            next = a;
             notify();
             notify();
         }
         }
     }
     }

+ 7 - 7
src/animation/PseudoCodeNode.java

@@ -46,7 +46,7 @@ public class PseudoCodeNode extends DefaultMutableTreeNode {
         breakPoint = false;
         breakPoint = false;
         code = line;
         code = line;
     }
     }
-    
+
     public int getId()
     public int getId()
     {
     {
         return nodeId;
         return nodeId;
@@ -112,12 +112,12 @@ public class PseudoCodeNode extends DefaultMutableTreeNode {
     		((PseudoCodeNode)parent).expandToRoot();
     		((PseudoCodeNode)parent).expandToRoot();
         tree.expandPath( new TreePath( this.getPath() ) );
         tree.expandPath( new TreePath( this.getPath() ) );
     }
     }
-    
+
     /**
     /**
      * highlight this line of pseudocode.
      * highlight this line of pseudocode.
      * should be called when the line is entered, as it triggers breakpoints
      * should be called when the line is entered, as it triggers breakpoints
      * @param selected whether to select or deselect this line
      * @param selected whether to select or deselect this line
-     * @return false iff a breakpoint was reached and the node was set to be selected.
+     * @return if the automatic execution should continue.
      */
      */
     public CodeAction setSelected( boolean selected )
     public CodeAction setSelected( boolean selected )
     {
     {
@@ -187,14 +187,14 @@ public class PseudoCodeNode extends DefaultMutableTreeNode {
     {
     {
         return breakPoint;
         return breakPoint;
     }
     }
-    
+
     public ControlFlow forwardStep( Memory m )
     public ControlFlow forwardStep( Memory m )
     {
     {
         ControlFlow cf = code.runForward( m );
         ControlFlow cf = code.runForward( m );
         cf.setJumpBack( this );
         cf.setJumpBack( this );
         return cf;
         return cf;
     }
     }
-    
+
     public ControlFlow emptyForwardStep( Memory m )
     public ControlFlow emptyForwardStep( Memory m )
     {
     {
         code.actions.push( (Memory mem) -> {} ); // add empty reverse function
         code.actions.push( (Memory mem) -> {} ); // add empty reverse function
@@ -202,12 +202,12 @@ public class PseudoCodeNode extends DefaultMutableTreeNode {
         cf.setJumpBack( this );
         cf.setJumpBack( this );
         return cf;
         return cf;
     }
     }
-    
+
     public void backwardStep( Memory m )
     public void backwardStep( Memory m )
     {
     {
         code.runBackward( m );
         code.runBackward( m );
     }
     }
-    
+
     public String getDebugOutput( Memory m )
     public String getDebugOutput( Memory m )
     {
     {
         if( parent == null )
         if( parent == null )

+ 15 - 15
src/bk/BKNodePlacement.java

@@ -36,9 +36,9 @@ public class BKNodePlacement extends AnimatedAlgorithm {
         LAYOUT4,
         LAYOUT4,
         COMBINE
         COMBINE
     }
     }
-    
+
     private State state;
     private State state;
-    
+
     public BKNodePlacement(AnimationController controller, LayeredGraphNode graph, JFrame view) {
     public BKNodePlacement(AnimationController controller, LayeredGraphNode graph, JFrame view) {
         super(controller, graph, view);
         super(controller, graph, view);
         state = State.CONFLICTS;
         state = State.CONFLICTS;
@@ -74,10 +74,10 @@ public class BKNodePlacement extends AnimatedAlgorithm {
 				} );
 				} );
 				return new ControlFlow( mainFunction );
 				return new ControlFlow( mainFunction );
 			}
 			}
-        	
+
         } );
         } );
         root.setSelected( true );
         root.setSelected( true );
-    	
+
         PseudoCodeNode conflictDetectionFunction = ConflictDetection.mark_conflicts( tree );
         PseudoCodeNode conflictDetectionFunction = ConflictDetection.mark_conflicts( tree );
         PseudoCodeNode calcLayout = new PseudoCodeNode( "function calcLayout( layout, graph )", vars, tree, new FunctionDefinition( vars ) );
         PseudoCodeNode calcLayout = new PseudoCodeNode( "function calcLayout( layout, graph )", vars, tree, new FunctionDefinition( vars ) );
         PseudoCodeNode combine = Combine.combine( tree );
         PseudoCodeNode combine = Combine.combine( tree );
@@ -153,12 +153,12 @@ public class BKNodePlacement extends AnimatedAlgorithm {
                 }
                 }
                 for( LayeredGraphNode n : graph.getContainedNodes() )
                 for( LayeredGraphNode n : graph.getContainedNodes() )
                 {
                 {
-                    info += "|" + TextLayoutHelper.strToLen( n.getName(), 6 ) + 
-                            "|" + TextLayoutHelper.strToLen( n.getShift( type ) + "", 7 ) + 
-                            "|" + TextLayoutHelper.strToLen( n.getSink( type ).getName(), 6 ) + 
-                            "|" + TextLayoutHelper.strToLen( n.getRoot( type ).getName(), 6 ) + 
-                            "|" + TextLayoutHelper.strToLen( n.getAlign( type ).getName(), 7 ) + 
-                            "|" + TextLayoutHelper.strToLen( n.getX( type ) + "", 5 ) + 
+                    info += "|" + TextLayoutHelper.strToLen( n.getName(), 6 ) +
+                            "|" + TextLayoutHelper.strToLen( n.getShift( type ) + "", 7 ) +
+                            "|" + TextLayoutHelper.strToLen( n.getSink( type ).getName(), 6 ) +
+                            "|" + TextLayoutHelper.strToLen( n.getRoot( type ).getName(), 6 ) +
+                            "|" + TextLayoutHelper.strToLen( n.getAlign( type ).getName(), 7 ) +
+                            "|" + TextLayoutHelper.strToLen( n.getX( type ) + "", 5 ) +
                             "|" + TextLayoutHelper.strToLen( !n.isXUndefined( type ) + "", 8 ) + "|\n";
                             "|" + TextLayoutHelper.strToLen( !n.isXUndefined( type ) + "", 8 ) + "|\n";
                 }
                 }
                 return info;
                 return info;
@@ -182,11 +182,11 @@ public class BKNodePlacement extends AnimatedAlgorithm {
                 LayeredGraphNode graph = m.read( "graph", MemoryType.COMPLETE_STACK );
                 LayeredGraphNode graph = m.read( "graph", MemoryType.COMPLETE_STACK );
                 for( LayeredGraphNode n : graph.getContainedNodes() )
                 for( LayeredGraphNode n : graph.getContainedNodes() )
                 {
                 {
-                    info += "|" + TextLayoutHelper.strToLen( n.getName(), 6 ) + 
-                            "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.TOP_BOTTOM_LEFT ) + "", 6 ) + 
-                            "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.TOP_BOTTOM_RIGHT ) + "", 6 ) + 
-                            "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.BOTTOM_TOP_LEFT ) + "", 6 ) + 
-                            "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.BOTTOM_TOP_RIGHT ) + "", 6 ) + 
+                    info += "|" + TextLayoutHelper.strToLen( n.getName(), 6 ) +
+                            "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.TOP_BOTTOM_LEFT ) + "", 6 ) +
+                            "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.TOP_BOTTOM_RIGHT ) + "", 6 ) +
+                            "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.BOTTOM_TOP_LEFT ) + "", 6 ) +
+                            "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.BOTTOM_TOP_RIGHT ) + "", 6 ) +
                             "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.COMBINED ) + "", 6 ) + "|\n";
                             "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.COMBINED ) + "", 6 ) + "|\n";
                 }
                 }
                 return info;
                 return info;

+ 5 - 5
src/bk/BlockCalc.java

@@ -27,7 +27,7 @@ import graph.LayeredGraphNode;
  *
  *
  */
  */
 public class BlockCalc {
 public class BlockCalc {
-    
+
     public static PseudoCodeNode calculateBlockGraph( JTree tree, PseudoCodeNode claclLayout ) {
     public static PseudoCodeNode calculateBlockGraph( JTree tree, PseudoCodeNode claclLayout ) {
         String[] vars = { "graph", "L", "r", "neighbors", "layout", "m", "i", "k", "mids", "n" };
         String[] vars = { "graph", "L", "r", "neighbors", "layout", "m", "i", "k", "mids", "n" };
         @SuppressWarnings("serial")
         @SuppressWarnings("serial")
@@ -179,8 +179,8 @@ public class BlockCalc {
         PseudoCodeNode ifMarked = new PseudoCodeNode( "if (neighbors[m],n) not conflicted and ((r < pos(neighbors[m]) and layout.contains('RIGHT')) or (r > pos(neighbors[m]) and layout.contains('LEFT'))) then", vars, tree, new IfLoop() {
         PseudoCodeNode ifMarked = new PseudoCodeNode( "if (neighbors[m],n) not conflicted and ((r < pos(neighbors[m]) and layout.contains('RIGHT')) or (r > pos(neighbors[m]) and layout.contains('LEFT'))) then", vars, tree, new IfLoop() {
             @Override
             @Override
             protected boolean condition(ReadOnlyMemory m) {
             protected boolean condition(ReadOnlyMemory m) {
-                LayeredGraphEdge e = m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL ).findEdgeBetween( 
-                        m.<ArrayList<LayeredGraphNode>>read( "neighbors", MemoryType.LOCAL ).get( m.read( "m", MemoryType.LOCAL ) ), 
+                LayeredGraphEdge e = m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL ).findEdgeBetween(
+                        m.<ArrayList<LayeredGraphNode>>read( "neighbors", MemoryType.LOCAL ).get( m.read( "m", MemoryType.LOCAL ) ),
                         m.read( "n", MemoryType.LOCAL ) );
                         m.read( "n", MemoryType.LOCAL ) );
                 if( e == null )
                 if( e == null )
                     e = m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL ).findEdgeBetween( m.read( "n", MemoryType.LOCAL ),
                     e = m.<LayeredGraphNode>read( "graph", MemoryType.LOCAL ).findEdgeBetween( m.read( "n", MemoryType.LOCAL ),
@@ -191,8 +191,8 @@ public class BlockCalc {
                 else
                 else
                     layerBefore = m.<ArrayList<ArrayList<LayeredGraphNode>>>read( "L", MemoryType.LOCAL ).get( m.<Integer>read( "i", MemoryType.LOCAL ) + 1 );
                     layerBefore = m.<ArrayList<ArrayList<LayeredGraphNode>>>read( "L", MemoryType.LOCAL ).get( m.<Integer>read( "i", MemoryType.LOCAL ) + 1 );
                 int posU = layerBefore.indexOf( m.<ArrayList<LayeredGraphNode>>read( "neighbors", MemoryType.LOCAL ).get( m.read( "m", MemoryType.LOCAL ) ) );
                 int posU = layerBefore.indexOf( m.<ArrayList<LayeredGraphNode>>read( "neighbors", MemoryType.LOCAL ).get( m.read( "m", MemoryType.LOCAL ) ) );
-                return !e.isConflicted( LayoutType.fromString( m.read( "layout", MemoryType.LOCAL ) ) ) && 
-                        ( ( m.<Double>read( "r", MemoryType.LOCAL ) < posU && m.<String>read( "layout", MemoryType.LOCAL ).contains( "RIGHT" ) ) || 
+                return !e.isConflicted( LayoutType.fromString( m.read( "layout", MemoryType.LOCAL ) ) ) &&
+                        ( ( m.<Double>read( "r", MemoryType.LOCAL ) < posU && m.<String>read( "layout", MemoryType.LOCAL ).contains( "RIGHT" ) ) ||
                                 ( m.<Double>read( "r", MemoryType.LOCAL ) > posU && m.<String>read( "layout", MemoryType.LOCAL ).contains( "LEFT" ) ) );
                                 ( m.<Double>read( "r", MemoryType.LOCAL ) > posU && m.<String>read( "layout", MemoryType.LOCAL ).contains( "LEFT" ) ) );
             }
             }
         });
         });

+ 1 - 1
src/graph/LayeredGraphNode.java

@@ -189,7 +189,7 @@ public interface LayeredGraphNode {
   public boolean isDummyNode();
   public boolean isDummyNode();
 
 
   /**
   /**
-   * unselects the subgraph of this node
+   * unselects recursively all contained nodes in all subgraphs of this node
    */
    */
   public void unselectGraph();
   public void unselectGraph();
 
 

+ 431 - 498
src/graph/LayeredNode.java

@@ -12,8 +12,7 @@ import bk.LayoutType;
 import view.NodeView;
 import view.NodeView;
 
 
 /**
 /**
- * Die Implementation eines Knotens in einem Layered Graph.
- * Implementiert {@link LayeredGraphNode}.
+ * Die Implementation eines Knotens in einem Layered Graph. Implementiert {@link LayeredGraphNode}.
  * 
  * 
  * @author kolja
  * @author kolja
  *
  *
@@ -22,9 +21,8 @@ public class LayeredNode implements LayeredGraphNode {
     private ElkNode original;
     private ElkNode original;
     private LayeredGraphNode parent;
     private LayeredGraphNode parent;
     private boolean dummy;
     private boolean dummy;
-    
-    private class LayoutInfo
-    {
+
+    private class LayoutInfo {
         public double x;
         public double x;
         public double y;
         public double y;
         public double w;
         public double w;
@@ -32,7 +30,7 @@ public class LayeredNode implements LayeredGraphNode {
         public Color color;
         public Color color;
         public boolean selected;
         public boolean selected;
         public boolean xUndef;
         public boolean xUndef;
-        
+
         // Block Calculation
         // Block Calculation
         public LayeredGraphNode align;
         public LayeredGraphNode align;
         public LayeredGraphNode root;
         public LayeredGraphNode root;
@@ -41,9 +39,8 @@ public class LayeredNode implements LayeredGraphNode {
         public double shift;
         public double shift;
         private NodeView view;
         private NodeView view;
     }
     }
-    
-    private class CombinedLayoutInfo
-    {
+
+    private class CombinedLayoutInfo {
         public double x;
         public double x;
         public double y;
         public double y;
         public double w;
         public double w;
@@ -51,48 +48,47 @@ public class LayeredNode implements LayeredGraphNode {
         public boolean selected;
         public boolean selected;
         private NodeView view;
         private NodeView view;
     }
     }
-    
+
     private LayoutInfo[] layouts;
     private LayoutInfo[] layouts;
     private CombinedLayoutInfo combined;
     private CombinedLayoutInfo combined;
     private String name;
     private String name;
     private boolean mouseOver;
     private boolean mouseOver;
-    
+
     // for subgraph in this node
     // for subgraph in this node
-    private ArrayList< LayeredGraphEdge > edges;
-    private ArrayList< LayeredGraphNode > nodes;
-    private ArrayList< ArrayList< LayeredGraphNode > > layers;
-    
+    private ArrayList<LayeredGraphEdge> edges;
+    private ArrayList<LayeredGraphNode> nodes;
+    private ArrayList<ArrayList<LayeredGraphNode>> layers;
+
     /**
     /**
      * Konvertiert einen Graph aus dem Elk format in einen Graph, der mehr Informationen enth�lt
      * Konvertiert einen Graph aus dem Elk format in einen Graph, der mehr Informationen enth�lt
-     * @param n Der Graph, welcher konvertiert werden soll
+     *
+     * @param n
+     *            Der Graph, welcher konvertiert werden soll
      * @return Ein layered Graph, welcher im wesentlichen ein Wrapper f�r den urspr�nglichen Graphen ist
      * @return Ein layered Graph, welcher im wesentlichen ein Wrapper f�r den urspr�nglichen Graphen ist
      */
      */
-    public static LayeredGraphNode convertToLayeredGraph( ElkNode n )
-    {
-        LayeredNode ln = new LayeredNode( n, null );
-        for( ElkNode node : n.getChildren() )
-            ln.addNode( convertToLayeredGraph( node ) );
-        for( ElkEdge edge : n.getContainedEdges() )
-        {
-        	// TODO n.getProperty(Properties.LAYERPOS) reads position of node n in his layer
-            ArrayList< LayeredGraphNode > sources = new ArrayList<>();
-            ArrayList< LayeredGraphNode > targets = new ArrayList<>();
+    public static LayeredGraphNode convertToLayeredGraph(ElkNode n) {
+        LayeredNode ln = new LayeredNode(n, null);
+        for (ElkNode node : n.getChildren())
+            ln.addNode(convertToLayeredGraph(node));
+        for (ElkEdge edge : n.getContainedEdges()) {
+            // TODO n.getProperty(Properties.LAYERPOS) reads position of node n in his layer
+            ArrayList<LayeredGraphNode> sources = new ArrayList<>();
+            ArrayList<LayeredGraphNode> targets = new ArrayList<>();
             EList<ElkConnectableShape> s = edge.getSources();
             EList<ElkConnectableShape> s = edge.getSources();
             EList<ElkConnectableShape> t = edge.getTargets();
             EList<ElkConnectableShape> t = edge.getTargets();
-            for( ElkConnectableShape shape : s )
-                sources.add( ln.findNodeFromOriginal( shape ) );
-            for( ElkConnectableShape shape : t )
-                targets.add( ln.findNodeFromOriginal( shape ) );
-            ln.createEdge( edge, sources, targets );
+            for (ElkConnectableShape shape : s)
+                sources.add(ln.findNodeFromOriginal(shape));
+            for (ElkConnectableShape shape : t)
+                targets.add(ln.findNodeFromOriginal(shape));
+            ln.createEdge(edge, sources, targets);
         }
         }
         return ln;
         return ln;
     }
     }
-    
-    public LayeredNode( ElkNode original, LayeredGraphNode parent )
-    {
+
+    public LayeredNode(ElkNode original, LayeredGraphNode parent) {
         this.original = original;
         this.original = original;
         this.parent = parent;
         this.parent = parent;
-        
+
         edges = new ArrayList<>();
         edges = new ArrayList<>();
         nodes = new ArrayList<>();
         nodes = new ArrayList<>();
         layers = new ArrayList<>();
         layers = new ArrayList<>();
@@ -121,289 +117,251 @@ public class LayeredNode implements LayeredGraphNode {
         }
         }
         dummy = false;
         dummy = false;
         combined = new CombinedLayoutInfo();
         combined = new CombinedLayoutInfo();
-        if( original != null )
-        {
-	        combined.x = original.getX();
-	        combined.y = original.getX();
-	        combined.w = original.getWidth();
-	        combined.h = original.getHeight();
+        if (original != null) {
+            combined.x = original.getX();
+            combined.y = original.getX();
+            combined.w = original.getWidth();
+            combined.h = original.getHeight();
         }
         }
         combined.selected = false;
         combined.selected = false;
         mouseOver = false;
         mouseOver = false;
     }
     }
-    
+
     public void setMouseOver( boolean over ) {
     public void setMouseOver( boolean over ) {
         mouseOver = over;
         mouseOver = over;
     }
     }
-    
+
     public boolean isMouseOver() {
     public boolean isMouseOver() {
         return mouseOver;
         return mouseOver;
     }
     }
-    
-    public void setView( NodeView view, LayoutType layout )
-    {
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            this.layouts[ 0 ].view = view;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            this.layouts[ 1 ].view = view;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            this.layouts[ 2 ].view = view;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            this.layouts[ 3 ].view = view;
-        if( layout == LayoutType.COMBINED )
+
+    public void setView(NodeView view, LayoutType layout) {
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            this.layouts[0].view = view;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            this.layouts[1].view = view;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            this.layouts[2].view = view;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            this.layouts[3].view = view;
+        if (layout == LayoutType.COMBINED)
             this.combined.view = view;
             this.combined.view = view;
     }
     }
-    
-    public NodeView getView( LayoutType layout )
-    {
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            return layouts[ 0 ].view;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            return layouts[ 1 ].view;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            return layouts[ 2 ].view;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            return layouts[ 3 ].view;
-        if( layout == LayoutType.COMBINED )
+
+    public NodeView getView(LayoutType layout) {
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            return layouts[0].view;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            return layouts[1].view;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            return layouts[2].view;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            return layouts[3].view;
+        if (layout == LayoutType.COMBINED)
             return combined.view;
             return combined.view;
         return null;
         return null;
     }
     }
-    
+
     @Override
     @Override
-    public void setDummyNode( boolean dummy )
-    {
-    	this.dummy = dummy;
+    public void setDummyNode(boolean dummy) {
+        this.dummy = dummy;
     }
     }
-    
+
     @Override
     @Override
-    public boolean isDummyNode()
-    {
-    	return dummy;
+    public boolean isDummyNode() {
+        return dummy;
     }
     }
 
 
     @Override
     @Override
-    public void setShift( double shift, LayoutType layout )
-    {
-        if( layout == null )
-        {
-            this.layouts[ 0 ].shift = shift;
-            this.layouts[ 1 ].shift = shift;
-            this.layouts[ 2 ].shift = shift;
-            this.layouts[ 3 ].shift = shift;
+    public void setShift(double shift, LayoutType layout) {
+        if (layout == null) {
+            this.layouts[0].shift = shift;
+            this.layouts[1].shift = shift;
+            this.layouts[2].shift = shift;
+            this.layouts[3].shift = shift;
         }
         }
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            this.layouts[ 0 ].shift = shift;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            this.layouts[ 1 ].shift = shift;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            this.layouts[ 2 ].shift = shift;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            this.layouts[ 3 ].shift = shift;
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            this.layouts[0].shift = shift;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            this.layouts[1].shift = shift;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            this.layouts[2].shift = shift;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            this.layouts[3].shift = shift;
     }
     }
-    
+
     @Override
     @Override
-    public double getShift( LayoutType layout )
-    {
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            return this.layouts[ 0 ].shift;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            return this.layouts[ 1 ].shift;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            return this.layouts[ 2 ].shift;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            return this.layouts[ 3 ].shift;
+    public double getShift(LayoutType layout) {
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            return this.layouts[0].shift;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            return this.layouts[1].shift;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            return this.layouts[2].shift;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            return this.layouts[3].shift;
         return 0;
         return 0;
     }
     }
 
 
     @Override
     @Override
-    public void setSink( LayeredGraphNode sink, LayoutType layout )
-    {
-        if( layout == null )
-        {
-            this.layouts[ 0 ].sink = sink;
-            this.layouts[ 1 ].sink = sink;
-            this.layouts[ 2 ].sink = sink;
-            this.layouts[ 3 ].sink = sink;
+    public void setSink(LayeredGraphNode sink, LayoutType layout) {
+        if (layout == null) {
+            this.layouts[0].sink = sink;
+            this.layouts[1].sink = sink;
+            this.layouts[2].sink = sink;
+            this.layouts[3].sink = sink;
         }
         }
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            this.layouts[ 0 ].sink = sink;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            this.layouts[ 1 ].sink = sink;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            this.layouts[ 2 ].sink = sink;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            this.layouts[ 3 ].sink = sink;
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            this.layouts[0].sink = sink;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            this.layouts[1].sink = sink;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            this.layouts[2].sink = sink;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            this.layouts[3].sink = sink;
     }
     }
-    
+
     @Override
     @Override
-    public LayeredGraphNode getSink( LayoutType layout )
-    {
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            return this.layouts[ 0 ].sink;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            return this.layouts[ 1 ].sink;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            return this.layouts[ 2 ].sink;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            return this.layouts[ 3 ].sink;
+    public LayeredGraphNode getSink(LayoutType layout) {
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            return this.layouts[0].sink;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            return this.layouts[1].sink;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            return this.layouts[2].sink;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            return this.layouts[3].sink;
         return null;
         return null;
     }
     }
-    
+
     @Override
     @Override
-    public boolean isXUndefined( LayoutType layout )
-    {
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            return this.layouts[ 0 ].xUndef;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            return this.layouts[ 1 ].xUndef;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            return this.layouts[ 2 ].xUndef;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            return this.layouts[ 3 ].xUndef;
+    public boolean isXUndefined(LayoutType layout) {
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            return this.layouts[0].xUndef;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            return this.layouts[1].xUndef;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            return this.layouts[2].xUndef;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            return this.layouts[3].xUndef;
         return true;
         return true;
     }
     }
 
 
     @Override
     @Override
-    public void setAlign( LayeredGraphNode align, LayoutType layout )
-    {
-        if( layout == null )
-        {
-            this.layouts[ 0 ].align = align;
-            this.layouts[ 1 ].align = align;
-            this.layouts[ 2 ].align = align;
-            this.layouts[ 3 ].align = align;
+    public void setAlign(LayeredGraphNode align, LayoutType layout) {
+        if (layout == null) {
+            this.layouts[0].align = align;
+            this.layouts[1].align = align;
+            this.layouts[2].align = align;
+            this.layouts[3].align = align;
         }
         }
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            this.layouts[ 0 ].align = align;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            this.layouts[ 1 ].align = align;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            this.layouts[ 2 ].align = align;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            this.layouts[ 3 ].align = align;
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            this.layouts[0].align = align;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            this.layouts[1].align = align;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            this.layouts[2].align = align;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            this.layouts[3].align = align;
     }
     }
 
 
     @Override
     @Override
-    public LayeredGraphNode getAlign( LayoutType layout )
-    {
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            return this.layouts[ 0 ].align;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            return this.layouts[ 1 ].align;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            return this.layouts[ 2 ].align;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            return this.layouts[ 3 ].align;
+    public LayeredGraphNode getAlign(LayoutType layout) {
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            return this.layouts[0].align;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            return this.layouts[1].align;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            return this.layouts[2].align;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            return this.layouts[3].align;
         return null;
         return null;
     }
     }
 
 
     @Override
     @Override
-    public void setRoot( LayeredGraphNode root, LayoutType layout )
-    {
-        if( layout == null )
-        {
-            this.layouts[ 0 ].root = root;
-            this.layouts[ 1 ].root = root;
-            this.layouts[ 2 ].root = root;
-            this.layouts[ 3 ].root = root;
+    public void setRoot(LayeredGraphNode root, LayoutType layout) {
+        if (layout == null) {
+            this.layouts[0].root = root;
+            this.layouts[1].root = root;
+            this.layouts[2].root = root;
+            this.layouts[3].root = root;
         }
         }
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            this.layouts[ 0 ].root = root;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            this.layouts[ 1 ].root = root;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            this.layouts[ 2 ].root = root;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            this.layouts[ 3 ].root = root;
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            this.layouts[0].root = root;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            this.layouts[1].root = root;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            this.layouts[2].root = root;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            this.layouts[3].root = root;
     }
     }
 
 
     @Override
     @Override
-    public LayeredGraphNode getRoot( LayoutType layout )
-    {
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            return this.layouts[ 0 ].root;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            return this.layouts[ 1 ].root;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            return this.layouts[ 2 ].root;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            return this.layouts[ 3 ].root;
+    public LayeredGraphNode getRoot(LayoutType layout) {
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            return this.layouts[0].root;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            return this.layouts[1].root;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            return this.layouts[2].root;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            return this.layouts[3].root;
         return null;
         return null;
     }
     }
 
 
     @Override
     @Override
-    public void setSelected( LayoutType layout )
-    {
-        if( layout == null )
-        {
-            this.layouts[ 0 ].selected = true;
-            this.layouts[ 1 ].selected = true;
-            this.layouts[ 2 ].selected = true;
-            this.layouts[ 3 ].selected = true;
+    public void setSelected(LayoutType layout) {
+        if (layout == null) {
+            this.layouts[0].selected = true;
+            this.layouts[1].selected = true;
+            this.layouts[2].selected = true;
+            this.layouts[3].selected = true;
             combined.selected = true;
             combined.selected = true;
         }
         }
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            this.layouts[ 0 ].selected = true;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            this.layouts[ 1 ].selected = true;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            this.layouts[ 2 ].selected = true;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            this.layouts[ 3 ].selected = true;
-        if( layout == LayoutType.COMBINED )
-        	combined.selected = true;
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            this.layouts[0].selected = true;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            this.layouts[1].selected = true;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            this.layouts[2].selected = true;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            this.layouts[3].selected = true;
+        if (layout == LayoutType.COMBINED)
+            combined.selected = true;
     }
     }
-    
+
     @Override
     @Override
-    public void unselectGraph()
-    {
-        for( LayeredGraphNode n : nodes)
-        {
+    public void unselectGraph() {
+        for (LayeredGraphNode n : nodes) {
             n.unselectGraph();
             n.unselectGraph();
         }
         }
-        this.layouts[ 0 ].selected = false;
-        this.layouts[ 1 ].selected = false;
-        this.layouts[ 2 ].selected = false;
-        this.layouts[ 3 ].selected = false;
+        this.layouts[0].selected = false;
+        this.layouts[1].selected = false;
+        this.layouts[2].selected = false;
+        this.layouts[3].selected = false;
         combined.selected = false;
         combined.selected = false;
     }
     }
 
 
     @Override
     @Override
-    public boolean isSelected( LayoutType layout )
-    {
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-        {
-            boolean tmp = layouts[ 0 ].selected;
-            layouts[ 0 ].selected = false;
-            return tmp;
+    public boolean isSelected(LayoutType layout) {
+        if (layout == LayoutType.TOP_BOTTOM_LEFT) {
+            return layouts[0].selected;
         }
         }
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-        {
-            boolean tmp = layouts[ 1 ].selected;
-            layouts[ 1 ].selected = false;
-            return tmp;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT) {
+            return layouts[1].selected;
         }
         }
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-        {
-            boolean tmp = layouts[ 2 ].selected;
-            layouts[ 2 ].selected = false;
-            return tmp;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT) {
+            return layouts[2].selected;
         }
         }
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-        {
-            boolean tmp = layouts[ 3 ].selected;
-            layouts[ 3 ].selected = false;
-            return tmp;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT) {
+            return layouts[3].selected;
         }
         }
-        if( layout == LayoutType.COMBINED )
-        {
-            boolean tmp = combined.selected;
-            combined.selected = false;
-            return tmp;
+        if (layout == LayoutType.COMBINED) {
+            return combined.selected;
         }
         }
         return false;
         return false;
     }
     }
-    
+
     @Override
     @Override
     public void setColor( Color c, LayoutType layout )
     public void setColor( Color c, LayoutType layout )
     {
     {
@@ -423,42 +381,39 @@ public class LayeredNode implements LayeredGraphNode {
         if( layout == LayoutType.BOTTOM_TOP_RIGHT )
         if( layout == LayoutType.BOTTOM_TOP_RIGHT )
             this.layouts[ 3 ].color = c;
             this.layouts[ 3 ].color = c;
     }
     }
-    
-    private int calcClassSize( LayeredGraphNode sink, LayoutType layout )
-    {
-        if( parent == null )
+
+    private int calcClassSize(LayeredGraphNode sink, LayoutType layout) {
+        if (parent == null)
             return 1;
             return 1;
         int ret = 0;
         int ret = 0;
-        for( LayeredGraphNode n : parent.getContainedNodes() )
-        {
-            if( n.getRoot( layout ).getSink( layout ) == sink )
+        for (LayeredGraphNode n : parent.getContainedNodes()) {
+            if (n.getRoot(layout).getSink(layout) == sink)
                 ret++;
                 ret++;
         }
         }
         return ret;
         return ret;
     }
     }
-    
+
     @Override
     @Override
-    public Color getClassColor( LayoutType layout )
-    {
-        if( layout == LayoutType.TOP_BOTTOM_LEFT && this.layouts[ 0 ].sink == this && calcClassSize( this, layout ) == 1 )
+    public Color getClassColor(LayoutType layout) {
+        if (layout == LayoutType.TOP_BOTTOM_LEFT && this.layouts[0].sink == this && calcClassSize(this, layout) == 1)
             return Color.LIGHT_GRAY;
             return Color.LIGHT_GRAY;
-        if( layout == LayoutType.TOP_BOTTOM_LEFT && this.layouts[ 0 ].sink == this )
-            return this.layouts[ 0 ].color;
-        else if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            return this.layouts[ 0 ].sink.getClassColor( layout );
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT && this.layouts[ 1 ].sink == this && calcClassSize( this, layout ) == 1 )
+        if (layout == LayoutType.TOP_BOTTOM_LEFT && this.layouts[0].sink == this)
+            return this.layouts[0].color;
+        else if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            return this.layouts[0].sink.getClassColor(layout);
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT && this.layouts[1].sink == this && calcClassSize(this, layout) == 1)
             return Color.LIGHT_GRAY;
             return Color.LIGHT_GRAY;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT && this.layouts[ 1 ].sink == this )
-            return this.layouts[ 1 ].color;
-        else if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            return this.layouts[ 1 ].sink.getClassColor( layout );
-        if( layout == LayoutType.BOTTOM_TOP_LEFT && this.layouts[ 2 ].sink == this && calcClassSize( this, layout ) == 1 )
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT && this.layouts[1].sink == this)
+            return this.layouts[1].color;
+        else if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            return this.layouts[1].sink.getClassColor(layout);
+        if (layout == LayoutType.BOTTOM_TOP_LEFT && this.layouts[2].sink == this && calcClassSize(this, layout) == 1)
             return Color.LIGHT_GRAY;
             return Color.LIGHT_GRAY;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT && this.layouts[ 2 ].sink == this )
-            return this.layouts[ 2 ].color;
-        else if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            return this.layouts[ 2 ].sink.getClassColor( layout );
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT && this.layouts[ 3 ].sink == this && calcClassSize( this, layout ) == 1 )
+        if (layout == LayoutType.BOTTOM_TOP_LEFT && this.layouts[2].sink == this)
+            return this.layouts[2].color;
+        else if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            return this.layouts[2].sink.getClassColor(layout);
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT && this.layouts[3].sink == this && calcClassSize(this, layout) == 1)
             return Color.LIGHT_GRAY;
             return Color.LIGHT_GRAY;
         if( layout == LayoutType.BOTTOM_TOP_RIGHT && this.layouts[ 3 ].sink == this )
         if( layout == LayoutType.BOTTOM_TOP_RIGHT && this.layouts[ 3 ].sink == this )
             return this.layouts[ 3 ].color;
             return this.layouts[ 3 ].color;
@@ -468,7 +423,7 @@ public class LayeredNode implements LayeredGraphNode {
             return Color.LIGHT_GRAY;
             return Color.LIGHT_GRAY;
         return null;
         return null;
     }
     }
-    
+
     @Override
     @Override
     public Color getColor( LayoutType layout )
     public Color getColor( LayoutType layout )
     {
     {
@@ -476,23 +431,23 @@ public class LayeredNode implements LayeredGraphNode {
             return this.layouts[ 0 ].color;
             return this.layouts[ 0 ].color;
         if( layout == LayoutType.TOP_BOTTOM_LEFT && this.layouts[ 0 ].root == this && this.layouts[ 0 ].align == this )
         if( layout == LayoutType.TOP_BOTTOM_LEFT && this.layouts[ 0 ].root == this && this.layouts[ 0 ].align == this )
             return Color.LIGHT_GRAY;
             return Color.LIGHT_GRAY;
-        if( layout == LayoutType.TOP_BOTTOM_LEFT && this.layouts[ 0 ].root != this )
-            return this.layouts[ 0 ].root.getColor( layout );
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            return this.layouts[ 0 ].color;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT && this.layouts[ 1 ].root == this && this.layouts[ 1 ].align == this )
+        if (layout == LayoutType.TOP_BOTTOM_LEFT && this.layouts[0].root != this)
+            return this.layouts[0].root.getColor(layout);
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            return this.layouts[0].color;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT && this.layouts[1].root == this && this.layouts[1].align == this)
             return Color.LIGHT_GRAY;
             return Color.LIGHT_GRAY;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT && this.layouts[ 1 ].root != this )
-            return this.layouts[ 1 ].root.getColor( layout );
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            return this.layouts[ 1 ].color;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT && this.layouts[ 2 ].root == this && this.layouts[ 2 ].align == this )
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT && this.layouts[1].root != this)
+            return this.layouts[1].root.getColor(layout);
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            return this.layouts[1].color;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT && this.layouts[2].root == this && this.layouts[2].align == this)
             return Color.LIGHT_GRAY;
             return Color.LIGHT_GRAY;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT && this.layouts[ 2 ].root != this )
-            return this.layouts[ 2 ].root.getColor( layout );
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            return this.layouts[ 2 ].color;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT && this.layouts[ 3 ].root == this && this.layouts[ 3 ].align == this )
+        if (layout == LayoutType.BOTTOM_TOP_LEFT && this.layouts[2].root != this)
+            return this.layouts[2].root.getColor(layout);
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            return this.layouts[2].color;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT && this.layouts[3].root == this && this.layouts[3].align == this)
             return Color.LIGHT_GRAY;
             return Color.LIGHT_GRAY;
         if( layout == LayoutType.BOTTOM_TOP_RIGHT && this.layouts[ 3 ].root != this )
         if( layout == LayoutType.BOTTOM_TOP_RIGHT && this.layouts[ 3 ].root != this )
             return this.layouts[ 3 ].root.getColor( layout );
             return this.layouts[ 3 ].root.getColor( layout );
@@ -502,18 +457,17 @@ public class LayeredNode implements LayeredGraphNode {
             return Color.LIGHT_GRAY;
             return Color.LIGHT_GRAY;
         return null;
         return null;
     }
     }
-    
+
     @Override
     @Override
-    public void setName( String n ) {
-    	name = n;
+    public void setName(String n) {
+        name = n;
     }
     }
-    
+
     @Override
     @Override
-    public String getName()
-    {
-    	return name;
+    public String getName() {
+        return name;
     }
     }
-    
+
     @Override
     @Override
     public ElkNode getOriginalNode() {
     public ElkNode getOriginalNode() {
         return original;
         return original;
@@ -521,7 +475,7 @@ public class LayeredNode implements LayeredGraphNode {
 
 
     @Override
     @Override
     public void remove() {
     public void remove() {
-        parent.removeNode( this );
+        parent.removeNode(this);
     }
     }
 
 
     @Override
     @Override
@@ -531,104 +485,97 @@ public class LayeredNode implements LayeredGraphNode {
 
 
     @Override
     @Override
     public void setLayer(int index) {
     public void setLayer(int index) {
-        parent.setNodeLayer( this, index );
+        parent.setNodeLayer(this, index);
     }
     }
 
 
     @Override
     @Override
     public int getLayer() {
     public int getLayer() {
-        return parent.getNodeLayer( this );
+        return parent.getNodeLayer(this);
     }
     }
 
 
     @Override
     @Override
-    public void setX(double x, boolean def, LayoutType layout ) {
-        if( layout == null )
-        {
-            layouts[ 0 ].x = x;
-            layouts[ 1 ].x = x;
-            layouts[ 2 ].x = x;
-            layouts[ 3 ].x = x;
+    public void setX(double x, boolean def, LayoutType layout) {
+        if (layout == null) {
+            layouts[0].x = x;
+            layouts[1].x = x;
+            layouts[2].x = x;
+            layouts[3].x = x;
             combined.x = x;
             combined.x = x;
         }
         }
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-        {
-            layouts[ 0 ].xUndef = !def;
-            layouts[ 0 ].x = x;
+        if (layout == LayoutType.TOP_BOTTOM_LEFT) {
+            layouts[0].xUndef = !def;
+            layouts[0].x = x;
         }
         }
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-        {
-            layouts[ 1 ].xUndef = !def;
-            layouts[ 1 ].x = x;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT) {
+            layouts[1].xUndef = !def;
+            layouts[1].x = x;
         }
         }
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-        {
-            layouts[ 2 ].xUndef = !def;
-            layouts[ 2 ].x = x;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT) {
+            layouts[2].xUndef = !def;
+            layouts[2].x = x;
         }
         }
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-        {
-            layouts[ 3 ].xUndef = !def;
-            layouts[ 3 ].x = x;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT) {
+            layouts[3].xUndef = !def;
+            layouts[3].x = x;
         }
         }
-        if( layout == LayoutType.COMBINED )
+        if (layout == LayoutType.COMBINED)
             combined.x = x;
             combined.x = x;
     }
     }
 
 
     @Override
     @Override
-    public void setY(double y, LayoutType layout ) {
-        if( layout == null )
-        {
-            layouts[ 0 ].y = y;
-            layouts[ 1 ].y = y;
-            layouts[ 2 ].y = y;
-            layouts[ 3 ].y = y;
+    public void setY(double y, LayoutType layout) {
+        if (layout == null) {
+            layouts[0].y = y;
+            layouts[1].y = y;
+            layouts[2].y = y;
+            layouts[3].y = y;
             combined.y = y;
             combined.y = y;
         }
         }
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            layouts[ 0 ].y = y;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            layouts[ 1 ].y = y;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            layouts[ 2 ].y = y;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            layouts[ 3 ].y = y;
-        if( layout == LayoutType.COMBINED )
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            layouts[0].y = y;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            layouts[1].y = y;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            layouts[2].y = y;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            layouts[3].y = y;
+        if (layout == LayoutType.COMBINED)
             combined.y = y;
             combined.y = y;
     }
     }
 
 
     @Override
     @Override
-    public double getX( LayoutType layout ) {
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            return this.layouts[ 0 ].x;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            return this.layouts[ 1 ].x;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            return this.layouts[ 2 ].x;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            return this.layouts[ 3 ].x;
-        if( layout == LayoutType.COMBINED )
+    public double getX(LayoutType layout) {
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            return this.layouts[0].x;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            return this.layouts[1].x;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            return this.layouts[2].x;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            return this.layouts[3].x;
+        if (layout == LayoutType.COMBINED)
             return combined.x;
             return combined.x;
         return 0;
         return 0;
     }
     }
 
 
     @Override
     @Override
-    public double getY( LayoutType layout ) {
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            return this.layouts[ 0 ].y;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            return this.layouts[ 1 ].y;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            return this.layouts[ 2 ].y;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            return this.layouts[ 3 ].y;
-        if( layout == LayoutType.COMBINED )
+    public double getY(LayoutType layout) {
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            return this.layouts[0].y;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            return this.layouts[1].y;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            return this.layouts[2].y;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            return this.layouts[3].y;
+        if (layout == LayoutType.COMBINED)
             return combined.y;
             return combined.y;
         return 0;
         return 0;
     }
     }
 
 
     @Override
     @Override
-    public double getWidth( LayoutType layout ) {
-        if( nodes.size() > 0 )
-        {
+    public double getWidth(LayoutType layout) {
+        if (nodes.size() > 0) {
             double max = 0;
             double max = 0;
             double min = Double.POSITIVE_INFINITY;
             double min = Double.POSITIVE_INFINITY;
             for( LayeredGraphNode n : nodes )
             for( LayeredGraphNode n : nodes )
@@ -637,26 +584,26 @@ public class LayeredNode implements LayeredGraphNode {
                     max = n.getX(layout) + n.getWidth(layout);
                     max = n.getX(layout) + n.getWidth(layout);
                 min = Math.min( n.getX(layout), min);
                 min = Math.min( n.getX(layout), min);
             }
             }
-            if( layout == LayoutType.TOP_BOTTOM_LEFT )
-                return Math.max( max - min, layouts[ 0 ].w );
-            if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-                return Math.max( max - min, layouts[ 1 ].w );
-            if( layout == LayoutType.BOTTOM_TOP_LEFT )
-                return Math.max( max - min, layouts[ 2 ].w );
-            if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-                return Math.max( max - min, layouts[ 3 ].w );
-            if( layout == LayoutType.COMBINED )
-                return Math.max( max - min, combined.w );
-        }
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            return layouts[ 0 ].w;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            return layouts[ 1 ].w;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            return layouts[ 2 ].w;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            return layouts[ 3 ].w;
-        if( layout == LayoutType.COMBINED )
+            if (layout == LayoutType.TOP_BOTTOM_LEFT)
+                return Math.max(max - min, layouts[0].w);
+            if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+                return Math.max(max - min, layouts[1].w);
+            if (layout == LayoutType.BOTTOM_TOP_LEFT)
+                return Math.max(max - min, layouts[2].w);
+            if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+                return Math.max(max - min, layouts[3].w);
+            if (layout == LayoutType.COMBINED)
+                return Math.max(max - min, combined.w);
+        }
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            return layouts[0].w;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            return layouts[1].w;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            return layouts[2].w;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            return layouts[3].w;
+        if (layout == LayoutType.COMBINED)
             return combined.w;
             return combined.w;
         return 0;
         return 0;
     }
     }
@@ -682,134 +629,126 @@ public class LayeredNode implements LayeredGraphNode {
             if( layout == LayoutType.COMBINED )
             if( layout == LayoutType.COMBINED )
                 return Math.max( max, combined.h );
                 return Math.max( max, combined.h );
         }
         }
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            return layouts[ 0 ].h;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            return layouts[ 1 ].h;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            return layouts[ 2 ].h;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            return layouts[ 3 ].h;
-        if( layout == LayoutType.COMBINED )
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            return layouts[0].h;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            return layouts[1].h;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            return layouts[2].h;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            return layouts[3].h;
+        if (layout == LayoutType.COMBINED)
             return combined.h;
             return combined.h;
         return 0;
         return 0;
     }
     }
-    
+
     @Override
     @Override
-    public void setWidth( double w, LayoutType layout )
-    {
-        if( layout == null )
-        {
-            this.layouts[ 0 ].w = w;
-            this.layouts[ 1 ].w = w;
-            this.layouts[ 2 ].w = w;
-            this.layouts[ 3 ].w = w;
+    public void setWidth(double w, LayoutType layout) {
+        if (layout == null) {
+            this.layouts[0].w = w;
+            this.layouts[1].w = w;
+            this.layouts[2].w = w;
+            this.layouts[3].w = w;
             combined.w = w;
             combined.w = w;
         }
         }
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            this.layouts[ 0 ].w = w;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            this.layouts[ 1 ].w = w;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            this.layouts[ 2 ].w = w;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            this.layouts[ 3 ].w = w;
-        if( layout == LayoutType.COMBINED )
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            this.layouts[0].w = w;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            this.layouts[1].w = w;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            this.layouts[2].w = w;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            this.layouts[3].w = w;
+        if (layout == LayoutType.COMBINED)
             combined.w = w;
             combined.w = w;
     }
     }
-    
+
     @Override
     @Override
-    public void setHeight( double h, LayoutType layout )
-    {
-        if( layout == null )
-        {
-            this.layouts[ 0 ].h = h;
-            this.layouts[ 1 ].h = h;
-            this.layouts[ 2 ].h = h;
-            this.layouts[ 3 ].h = h;
+    public void setHeight(double h, LayoutType layout) {
+        if (layout == null) {
+            this.layouts[0].h = h;
+            this.layouts[1].h = h;
+            this.layouts[2].h = h;
+            this.layouts[3].h = h;
             combined.h = h;
             combined.h = h;
         }
         }
-        if( layout == LayoutType.TOP_BOTTOM_LEFT )
-            this.layouts[ 0 ].h = h;
-        if( layout == LayoutType.TOP_BOTTOM_RIGHT )
-            this.layouts[ 1 ].h = h;
-        if( layout == LayoutType.BOTTOM_TOP_LEFT )
-            this.layouts[ 2 ].h = h;
-        if( layout == LayoutType.BOTTOM_TOP_RIGHT )
-            this.layouts[ 3 ].h = h;
-        if( layout == LayoutType.COMBINED )
+        if (layout == LayoutType.TOP_BOTTOM_LEFT)
+            this.layouts[0].h = h;
+        if (layout == LayoutType.TOP_BOTTOM_RIGHT)
+            this.layouts[1].h = h;
+        if (layout == LayoutType.BOTTOM_TOP_LEFT)
+            this.layouts[2].h = h;
+        if (layout == LayoutType.BOTTOM_TOP_RIGHT)
+            this.layouts[3].h = h;
+        if (layout == LayoutType.COMBINED)
             combined.h = h;
             combined.h = h;
     }
     }
 
 
     @Override
     @Override
     public void removeEdge(LayeredGraphEdge e) {
     public void removeEdge(LayeredGraphEdge e) {
-        edges.remove( e );
+        edges.remove(e);
     }
     }
 
 
     @Override
     @Override
     public void removeNode(LayeredGraphNode n) {
     public void removeNode(LayeredGraphNode n) {
-        for( LayeredGraphEdge e : n.getIncomingEdges() )
+        for (LayeredGraphEdge e : n.getIncomingEdges())
             e.remove();
             e.remove();
-        for( LayeredGraphEdge e : n.getOutgoingEdges() )
+        for (LayeredGraphEdge e : n.getOutgoingEdges())
             e.remove();
             e.remove();
-        nodes.remove( n );
-        for( ArrayList<LayeredGraphNode> l : layers )
-        {
-            l.remove( n );
+        nodes.remove(n);
+        for (ArrayList<LayeredGraphNode> l : layers) {
+            l.remove(n);
         }
         }
     }
     }
 
 
     @Override
     @Override
     public void setNodeLayer(LayeredGraphNode n, int index) {
     public void setNodeLayer(LayeredGraphNode n, int index) {
-        while( index >= layers.size() )
-            layers.add( new ArrayList<>() );
+        while (index >= layers.size())
+            layers.add(new ArrayList<>());
         int old = n.getLayer();
         int old = n.getLayer();
-        if( old >= 0 )
-            layers.get( old ).remove( n );
-        layers.get( index ).add( n );
+        if (old >= 0)
+            layers.get(old).remove(n);
+        layers.get(index).add(n);
     }
     }
 
 
     @Override
     @Override
     public void setOrderedLayer(ArrayList<Double> indizes, int layerIndex) {
     public void setOrderedLayer(ArrayList<Double> indizes, int layerIndex) {
-        ArrayList<LayeredGraphNode> l2 = layers.get( layerIndex );
+        ArrayList<LayeredGraphNode> l2 = layers.get(layerIndex);
         ArrayList<LayeredGraphNode> result = new ArrayList<LayeredGraphNode>();
         ArrayList<LayeredGraphNode> result = new ArrayList<LayeredGraphNode>();
-        while( indizes.size() > 0 )
-        {
+        while (indizes.size() > 0) {
             int mIndex = 0;
             int mIndex = 0;
-            double min = indizes.get( 0 );
-            for( int i = 1; i < indizes.size(); i++ )
-            {
-                if( min > indizes.get( i ) )
-                {
+            double min = indizes.get(0);
+            for (int i = 1; i < indizes.size(); i++) {
+                if (min > indizes.get(i)) {
                     mIndex = i;
                     mIndex = i;
-                    min = indizes.get( i );
+                    min = indizes.get(i);
                 }
                 }
             }
             }
-            result.add( l2.get( mIndex ) );
-            l2.remove( mIndex );
-            indizes.remove( mIndex );
+            result.add(l2.get(mIndex));
+            l2.remove(mIndex);
+            indizes.remove(mIndex);
         }
         }
-        layers.set( layerIndex, result );
+        layers.set(layerIndex, result);
     }
     }
-    
+
     @Override
     @Override
     public ArrayList<LayeredGraphEdge> getOutgoingEdges() {
     public ArrayList<LayeredGraphEdge> getOutgoingEdges() {
-        return parent.getOutgoingEdges( this );
+        return parent.getOutgoingEdges(this);
     }
     }
-    
+
     @Override
     @Override
     public ArrayList<LayeredGraphEdge> getSortedOutgoingEdges() {
     public ArrayList<LayeredGraphEdge> getSortedOutgoingEdges() {
-        return parent.getSortedOutgoingEdges( this );
+        return parent.getSortedOutgoingEdges(this);
     }
     }
 
 
     @Override
     @Override
     public ArrayList<LayeredGraphEdge> getIncomingEdges() {
     public ArrayList<LayeredGraphEdge> getIncomingEdges() {
-        return parent.getIncomingEdges( this );
+        return parent.getIncomingEdges(this);
     }
     }
 
 
     @Override
     @Override
     public ArrayList<LayeredGraphEdge> getSortedIncomingEdges() {
     public ArrayList<LayeredGraphEdge> getSortedIncomingEdges() {
-        return parent.getSortedIncomingEdges( this );
+        return parent.getSortedIncomingEdges(this);
     }
     }
 
 
     @Override
     @Override
@@ -821,14 +760,12 @@ public class LayeredNode implements LayeredGraphNode {
     public ArrayList<LayeredGraphNode> getContainedNodes() {
     public ArrayList<LayeredGraphNode> getContainedNodes() {
         return nodes;
         return nodes;
     }
     }
-    
+
     @Override
     @Override
-    public ArrayList< LayeredGraphNode > getSortedContainedNodes()
-    {
-        ArrayList< LayeredGraphNode > result = new ArrayList<>();
-        for( ArrayList<LayeredGraphNode> l : layers )
-        {
-            result.addAll( l );
+    public ArrayList<LayeredGraphNode> getSortedContainedNodes() {
+        ArrayList<LayeredGraphNode> result = new ArrayList<>();
+        for (ArrayList<LayeredGraphNode> l : layers) {
+            result.addAll(l);
         }
         }
         return result;
         return result;
     }
     }
@@ -840,9 +777,8 @@ public class LayeredNode implements LayeredGraphNode {
 
 
     @Override
     @Override
     public int getNodeLayer(LayeredGraphNode n) {
     public int getNodeLayer(LayeredGraphNode n) {
-        for( int i = 0; i < layers.size(); i++ )
-        {
-            if( layers.get( i ).contains( n ) )
+        for (int i = 0; i < layers.size(); i++) {
+            if (layers.get(i).contains(n))
                 return i;
                 return i;
         }
         }
         return -1;
         return -1;
@@ -903,7 +839,7 @@ public class LayeredNode implements LayeredGraphNode {
         }
         }
         return result;
         return result;
     }
     }
-    
+
     @Override
     @Override
     public LayeredGraphEdge findEdgeBetween( LayeredGraphNode source, LayeredGraphNode target )
     public LayeredGraphEdge findEdgeBetween( LayeredGraphNode source, LayeredGraphNode target )
     {
     {
@@ -917,15 +853,16 @@ public class LayeredNode implements LayeredGraphNode {
 
 
     @Override
     @Override
     public LayeredGraphNode createNode(ElkNode original) {
     public LayeredGraphNode createNode(ElkNode original) {
-        LayeredGraphNode n = new LayeredNode( original, this );
-        nodes.add( n );
+        LayeredGraphNode n = new LayeredNode(original, this);
+        nodes.add(n);
         return n;
         return n;
     }
     }
 
 
     @Override
     @Override
-    public LayeredGraphEdge createEdge(ElkEdge original, ArrayList<LayeredGraphNode> sources, ArrayList<LayeredGraphNode> targets) {
-        LayeredGraphEdge e = new LayeredEdge( original, sources, targets, this );
-        edges.add( e );
+    public LayeredGraphEdge createEdge(ElkEdge original, ArrayList<LayeredGraphNode> sources,
+            ArrayList<LayeredGraphNode> targets) {
+        LayeredGraphEdge e = new LayeredEdge(original, sources, targets, this);
+        edges.add(e);
         return e;
         return e;
     }
     }
 
 
@@ -933,18 +870,17 @@ public class LayeredNode implements LayeredGraphNode {
     public LayeredGraphEdge createSimpleEdge(ElkEdge original, LayeredGraphNode source, LayeredGraphNode target) {
     public LayeredGraphEdge createSimpleEdge(ElkEdge original, LayeredGraphNode source, LayeredGraphNode target) {
         ArrayList<LayeredGraphNode> sources = new ArrayList<>();
         ArrayList<LayeredGraphNode> sources = new ArrayList<>();
         ArrayList<LayeredGraphNode> targets = new ArrayList<>();
         ArrayList<LayeredGraphNode> targets = new ArrayList<>();
-        sources.add( source );
-        targets.add( target );
-        LayeredGraphEdge e = new LayeredEdge( original, sources, targets, this );
-        edges.add( e );
+        sources.add(source);
+        targets.add(target);
+        LayeredGraphEdge e = new LayeredEdge(original, sources, targets, this);
+        edges.add(e);
         return e;
         return e;
     }
     }
-    
+
     @Override
     @Override
     public LayeredGraphEdge findEdgeFromOriginal(Object original) {
     public LayeredGraphEdge findEdgeFromOriginal(Object original) {
-        for( LayeredGraphEdge e : edges )
-        {
-            if( e.getOriginalEdge() == original )
+        for (LayeredGraphEdge e : edges) {
+            if (e.getOriginalEdge() == original)
                 return e;
                 return e;
         }
         }
         return null;
         return null;
@@ -952,42 +888,39 @@ public class LayeredNode implements LayeredGraphNode {
 
 
     @Override
     @Override
     public LayeredGraphNode findNodeFromOriginal(Object original) {
     public LayeredGraphNode findNodeFromOriginal(Object original) {
-        for( LayeredGraphNode n : nodes )
-        {
-            if( n.getOriginalNode() == original )
+        for (LayeredGraphNode n : nodes) {
+            if (n.getOriginalNode() == original)
                 return n;
                 return n;
         }
         }
         return null;
         return null;
     }
     }
-    
+
     @Override
     @Override
-    public LayeredGraphNode findNodeByName( String name )
-    {
-    	for( LayeredGraphNode n : nodes )
-        {
-            if( n.getName() != null && name != null && n.getName().equals( name ) )
+    public LayeredGraphNode findNodeByName(String name) {
+        for (LayeredGraphNode n : nodes) {
+            if (n.getName() != null && name != null && n.getName().equals(name))
                 return n;
                 return n;
         }
         }
-        return null;	
+        return null;
     }
     }
 
 
     @Override
     @Override
     public void addNode(LayeredGraphNode n) {
     public void addNode(LayeredGraphNode n) {
-        nodes.add( n );
-        n.setParent( this );
+        nodes.add(n);
+        n.setParent(this);
     }
     }
 
 
     @Override
     @Override
     public void addEdge(LayeredGraphEdge e) {
     public void addEdge(LayeredGraphEdge e) {
-        edges.add( e );
-        e.setGraph( this );
+        edges.add(e);
+        e.setGraph(this);
     }
     }
 
 
     @Override
     @Override
     public void setParent(LayeredGraphNode parent) {
     public void setParent(LayeredGraphNode parent) {
         this.parent = parent;
         this.parent = parent;
     }
     }
-    
+
     @Override
     @Override
     public String toString() {
     public String toString() {
         if( name != null )
         if( name != null )

+ 1 - 1
src/lib/TextLayoutHelper.java

@@ -62,7 +62,7 @@ public class TextLayoutHelper {
         ret += current + "</html>";
         ret += current + "</html>";
         return ret;
         return ret;
     }
     }
-    
+
     public static String[] getVariables( String s )
     public static String[] getVariables( String s )
     {
     {
         ArrayList<String> list = new ArrayList<>();
         ArrayList<String> list = new ArrayList<>();

+ 6 - 1
src/view/MainView.java

@@ -142,7 +142,12 @@ public class MainView {
         debugFrame.add( view );
         debugFrame.add( view );
         debugFrame.setSize( frame.getWidth(), frame.getHeight() );
         debugFrame.setSize( frame.getWidth(), frame.getHeight() );
         debugFrame.setVisible( true );
         debugFrame.setVisible( true );
-        System.out.println( infoS );
+        if (infoS.trim().equals("")) {
+            System.out.println( "" );
+            System.out.println( "Debug info:" );
+            System.out.println( infoS );
+            System.out.println( "" );
+        }
     }
     }
 
 
     public MainView( ElkNode graph )
     public MainView( ElkNode graph )

+ 14 - 14
src/view/NodeView.java

@@ -72,15 +72,15 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
     public void updateTooltipText() {
     public void updateTooltipText() {
         if( layout != LayoutType.COMBINED )
         if( layout != LayoutType.COMBINED )
         {
         {
-            setToolTipText( "<html>Name: " + model.toString() + 
+            setToolTipText( "<html>Name: " + model.toString() +
                             "<br>Root: " + model.getRoot( layout ).toString() +
                             "<br>Root: " + model.getRoot( layout ).toString() +
-                            "<br>Shink: " + model.getSink( layout ).toString() + 
+                            "<br>Shink: " + model.getSink( layout ).toString() +
                             "<br>Shift: " + model.getShift( layout ) + "</html>" );
                             "<br>Shift: " + model.getShift( layout ) + "</html>" );
         }
         }
         else
         else
         {
         {
-            setToolTipText( "<html>Name: " + model.toString() + 
-                            "<br>result X: " + model.getX( LayoutType.COMBINED ) + 
+            setToolTipText( "<html>Name: " + model.toString() +
+                            "<br>result X: " + model.getX( LayoutType.COMBINED ) +
                             "<br>other layouts: [" + model.getX( LayoutType.TOP_BOTTOM_LEFT ) + "," + model.getX( LayoutType.TOP_BOTTOM_RIGHT ) + ","
                             "<br>other layouts: [" + model.getX( LayoutType.TOP_BOTTOM_LEFT ) + "," + model.getX( LayoutType.TOP_BOTTOM_RIGHT ) + ","
                                 + model.getX( LayoutType.BOTTOM_TOP_LEFT ) + "," + model.getX( LayoutType.BOTTOM_TOP_RIGHT ) + "]</html>" );
                                 + model.getX( LayoutType.BOTTOM_TOP_LEFT ) + "," + model.getX( LayoutType.BOTTOM_TOP_RIGHT ) + "]</html>" );
         }
         }
@@ -91,7 +91,7 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
             ((NodeView)c).updateTooltipText();
             ((NodeView)c).updateTooltipText();
         }
         }
     }
     }
-    
+
     public int getXOffset()
     public int getXOffset()
     {
     {
         int x = 0;
         int x = 0;
@@ -100,7 +100,7 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
         x += (getWidth()-50) / 2 - (getWidthOfNeededArea() * scale ) / 2 + 25;
         x += (getWidth()-50) / 2 - (getWidthOfNeededArea() * scale ) / 2 + 25;
         return x;
         return x;
     }
     }
-    
+
     public int getYOffset()
     public int getYOffset()
     {
     {
         int y = 0;
         int y = 0;
@@ -109,15 +109,15 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
         y += (getHeight()-50) / 2 - (getHeightOfNeededArea() * scale ) / 2 + 25;
         y += (getHeight()-50) / 2 - (getHeightOfNeededArea() * scale ) / 2 + 25;
         return y;
         return y;
     }
     }
-    
+
     public int getOriginalWidth() {
     public int getOriginalWidth() {
         return originalWidth;
         return originalWidth;
     }
     }
-    
+
     public int getOriginalHeight() {
     public int getOriginalHeight() {
         return originalHeight;
         return originalHeight;
     }
     }
-    
+
     private int getWidthOfNeededArea() {
     private int getWidthOfNeededArea() {
         int max = 0;
         int max = 0;
         double min = Double.POSITIVE_INFINITY;
         double min = Double.POSITIVE_INFINITY;
@@ -131,7 +131,7 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
         }
         }
         return max - (int)min;
         return max - (int)min;
     }
     }
-    
+
     private int getHeightOfNeededArea() {
     private int getHeightOfNeededArea() {
         int max = 0;
         int max = 0;
         double min = Double.POSITIVE_INFINITY;
         double min = Double.POSITIVE_INFINITY;
@@ -145,7 +145,7 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
         }
         }
         return max - (int)min;
         return max - (int)min;
     }
     }
-    
+
     @Override
     @Override
     public void doLayout() {
     public void doLayout() {
         double minX = Double.POSITIVE_INFINITY;
         double minX = Double.POSITIVE_INFINITY;
@@ -169,7 +169,7 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
             c.setLocation( getScaledX( view.getVirtualX() - (int)minX ) + x, getScaledY( view.getVirtualY() ) + y);
             c.setLocation( getScaledX( view.getVirtualX() - (int)minX ) + x, getScaledY( view.getVirtualY() ) + y);
             if( c instanceof NodeView )
             if( c instanceof NodeView )
                 c.setSize( getScaledX( ((NodeView)c).getOriginalWidth() ), getScaledY( ((NodeView)c).getOriginalHeight() ) );
                 c.setSize( getScaledX( ((NodeView)c).getOriginalWidth() ), getScaledY( ((NodeView)c).getOriginalHeight() ) );
-            else            
+            else
                 c.setSize( getScaledX( view.getVirtualWidth() ), getScaledY( view.getVirtualHeight() ) );
                 c.setSize( getScaledX( view.getVirtualWidth() ), getScaledY( view.getVirtualHeight() ) );
             c.doLayout();
             c.doLayout();
         }
         }
@@ -201,12 +201,12 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
                 {
                 {
                     NodeView v = (NodeView)c;
                     NodeView v = (NodeView)c;
                     v.renderClass( g.create( getScaledX( v.getPlainVirtualX() - (int)minX - 12 ) + x, c.getY() - getScaledY(12), getScaledX( v.getPlainVirtualWidth() + 22 ), c.getHeight() + getScaledY(22) ) );
                     v.renderClass( g.create( getScaledX( v.getPlainVirtualX() - (int)minX - 12 ) + x, c.getY() - getScaledY(12), getScaledX( v.getPlainVirtualWidth() + 22 ), c.getHeight() + getScaledY(22) ) );
-                }                
+                }
             }
             }
             c.paint( g.create( c.getX(), c.getY(), c.getWidth(), c.getHeight() ) );
             c.paint( g.create( c.getX(), c.getY(), c.getWidth(), c.getHeight() ) );
         }
         }
     }
     }
-    
+
     public void renderClass( Graphics g ) {
     public void renderClass( Graphics g ) {
         g.setColor( model.getRoot( layout ).getClassColor( layout ) );
         g.setColor( model.getRoot( layout ).getClassColor( layout ) );
         if( model.getContainedNodes().size() == 0 && model.getRoot( layout ).getClassColor( layout ) != Color.LIGHT_GRAY )
         if( model.getContainedNodes().size() == 0 && model.getRoot( layout ).getClassColor( layout ) != Color.LIGHT_GRAY )