Selaa lähdekoodia

Merge branch 'master' of https://koljastrohm-games.com:3000/GraphDrawer/NodePlacementAnimation

Kolja Strohm 6 vuotta sitten
vanhempi
commit
5b178d2af8

+ 0 - 0
doc/material/lec01-Pragmatics-Overview.pdf → material/lec01-Pragmatics-Overview.pdf


+ 0 - 0
doc/material/lec02-Terminology.pptx → material/lec02-Terminology.pptx


+ 0 - 0
doc/material/lec03-Forcedirected.pptx → material/lec03-Forcedirected.pptx


+ 0 - 0
doc/material/lec04-Stress.pptx → material/lec04-Stress.pptx


+ 0 - 0
doc/material/lec05-Layered.pptx → material/lec05-Layered.pptx


+ 0 - 0
doc/material/lec06-Ports-Hyperedges.pptx → material/lec06-Ports-Hyperedges.pptx


+ 0 - 0
doc/material/lec07-Nodes-Size.pptx → material/lec07-Nodes-Size.pptx


+ 0 - 0
doc/material/lec08-Trees.pptx → material/lec08-Trees.pptx


+ 0 - 0
doc/material/lec08a-Skambath-EvolvingTrees-animated-version.tar.gz → material/lec08a-Skambath-EvolvingTrees-animated-version.tar.gz


+ 0 - 0
doc/material/lec09-Planarity.pptx → material/lec09-Planarity.pptx


+ 0 - 0
doc/material/lec10-Labels.pptx → material/lec10-Labels.pptx


+ 8 - 1
src/Algorithms/Animated/Action.java

@@ -1,7 +1,14 @@
 package Algorithms.Animated;
 
+/**
+ * An action some kind of command that can be send to the {@link AnimatedAlgorithm} from the {@link AnimationController}.
+ * {@code FORWARD} tells the {@link AnimatedAlgorithm} to perform one more step in the layout process.
+ * {@code BACKWARD} tells the {@link AnimatedAlgorithm} to undo the last step in the layout process.
+ * 
+ * @author kolja
+ *
+ */
 public enum Action {
-
 	FORWARD,
 	BACKWARD
 }

+ 3 - 5
src/Algorithms/Animated/AnnimatedAlgorithm.java → src/Algorithms/Animated/AnimatedAlgorithm.java

@@ -1,15 +1,13 @@
 package Algorithms.Animated;
 
-import javax.swing.SwingUtilities;
-
 import Model.LayeredGraphNode;
 
-public abstract class AnnimatedAlgorithm extends Thread implements AlgorithmStep {
+public abstract class AnimatedAlgorithm extends Thread implements AlgorithmStep {
 
-	protected AnnimationController ac;
+	protected AnimationController ac;
 	protected LayeredGraphNode graph;
 	
-	public AnnimatedAlgorithm( AnnimationController controller, LayeredGraphNode graph )
+	public AnimatedAlgorithm( AnimationController controller, LayeredGraphNode graph )
 	{
 		this.ac = controller;
 		this.graph = graph;

+ 2 - 3
src/Algorithms/Animated/AnnimationController.java → src/Algorithms/Animated/AnimationController.java

@@ -1,14 +1,13 @@
 package Algorithms.Animated;
 
-public class AnnimationController {
-
+public class AnimationController {
 	
 	private Action next;
 	private boolean continuous;
 	private long lastTime;
 	private long timeBetween;
 	
-	public AnnimationController()
+	public AnimationController()
 	{
 		next = null;
 		continuous = false;

+ 4 - 4
src/Algorithms/Animated/BK/BKNodePlacement.java

@@ -1,11 +1,11 @@
 package Algorithms.Animated.BK;
 
 import Algorithms.Animated.AlgorithmStep;
-import Algorithms.Animated.AnnimatedAlgorithm;
-import Algorithms.Animated.AnnimationController;
+import Algorithms.Animated.AnimatedAlgorithm;
+import Algorithms.Animated.AnimationController;
 import Model.LayeredGraphNode;
 
-public class BKNodePlacement extends AnnimatedAlgorithm {
+public class BKNodePlacement extends AnimatedAlgorithm {
 
 	/*
 	 * Private data structures to store the process of the algorithm
@@ -24,7 +24,7 @@ public class BKNodePlacement extends AnnimatedAlgorithm {
 	private Layout layouts[];
 	private Combine combine;
 	
-	public BKNodePlacement(AnnimationController controller, LayeredGraphNode graph) {
+	public BKNodePlacement(AnimationController controller, LayeredGraphNode graph) {
 		super(controller, graph);
 		state = State.LAYOUT1;
 		layouts = new Layout[ 4 ];

+ 9 - 0
src/IO/Reader.java

@@ -13,6 +13,11 @@ import Model.LayeredGraphEdge;
 import Model.LayeredGraphNode;
 import Model.LayeredNode;
 
+/**
+ * reads a {@link LayeredGraphNode} from a JSON file
+ * @author kolja
+ *
+ */
 public class Reader {
 
 	private String fileName;
@@ -22,6 +27,10 @@ public class Reader {
 		fileName = inputFileName;
 	}
 	
+	/**
+	 * read the JSON file and return its contents as a {@link LayeredGraphNode}
+	 * @return the read {@link LayeredGraphNode}
+	 */
 	public LayeredGraphNode readInputGraph()
 	{
 		String file = "";

+ 11 - 2
src/IO/Writer.java

@@ -12,6 +12,11 @@ import org.json.JSONObject;
 import Model.LayeredGraphEdge;
 import Model.LayeredGraphNode;
 
+/**
+ * Writes a {@link LayeredGraphNode} to a JSON file.
+ * @author kolja
+ *
+ */
 public class Writer {
 
     private String file;
@@ -21,6 +26,10 @@ public class Writer {
         file = outputFileName;
     }
     
+    /**
+     * Writes the given {@link LayeredGraphNode} to a JSON file.
+     * @param graph the graph that is to be saved.
+     */
     public void writeOutputGraph( LayeredGraphNode graph )
     {
         try {
@@ -32,7 +41,7 @@ public class Writer {
         }        
     }
     
-    public JSONObject parseNode( LayeredGraphNode graph ) throws JSONException
+    private JSONObject parseNode( LayeredGraphNode graph ) throws JSONException
     {
         JSONObject node = new JSONObject();
         JSONArray layers = new JSONArray();
@@ -58,7 +67,7 @@ public class Writer {
         return node;
     }
     
-    public JSONObject parseEdge( LayeredGraphEdge e ) throws JSONException
+    private JSONObject parseEdge( LayeredGraphEdge e ) throws JSONException
     {
         JSONObject edge = new JSONObject();
         edge.put( "source", e.getSources().get( 0 ).getName() );

+ 5 - 1
src/Main.java

@@ -1,10 +1,14 @@
 import Algorithms.InitializeNodePositions;
 import Algorithms.RandomGraphGenerator;
 import Algorithms.SweepCrossingMinimizer;
-import IO.Reader;
 import Model.LayeredGraphNode;
 import View.MainView;
 
+/**
+ * The main executable class. Starts the application.
+ * @author kolja
+ *
+ */
 public class Main {
 
 	public static void main(String[] args) {

+ 2 - 1
src/Model/LayeredEdge.java

@@ -6,7 +6,8 @@ import java.util.ArrayList;
 import org.eclipse.elk.graph.ElkEdge;
 
 /**
- * Die Implementation einer Kante aus einem Layered Graphen
+ * Die Implementation einer Kante aus einem Layered Graphen.
+ * Implementiert {@link LayeredGraphEdge.}
  * 
  * @author kolja
  *

+ 3 - 2
src/Model/LayeredNode.java

@@ -12,7 +12,8 @@ import org.eclipse.elk.graph.ElkNode;
 import View.MainView;
 
 /**
- * Die Implementation eines Knotens in einem Layered Graph
+ * Die Implementation eines Knotens in einem Layered Graph.
+ * Implementiert {@link LayeredGraphNode.}
  * 
  * @author kolja
  *
@@ -67,7 +68,7 @@ public class LayeredNode implements LayeredGraphNode {
         shift = Double.POSITIVE_INFINITY;
         xUndef = true;
     }
-    
+
     @Override
     public void setShift( double shift )
     {

+ 3 - 3
src/View/MainView.java

@@ -7,7 +7,7 @@ import java.awt.event.KeyListener;
 import javax.swing.JFrame;
 
 import Algorithms.Animated.Action;
-import Algorithms.Animated.AnnimationController;
+import Algorithms.Animated.AnimationController;
 import Algorithms.Animated.BK.BKNodePlacement;
 import IO.Writer;
 import Model.LayeredGraphEdge;
@@ -16,11 +16,11 @@ import Model.LayeredGraphNode;
 public class MainView {
 
 	public static JFrame frame;
-	AnnimationController controller;
+	AnimationController controller;
 	
 	public MainView( LayeredGraphNode graph )
 	{
-		controller = new AnnimationController();
+		controller = new AnimationController();
 		controller.setTimeBetween( 100 );
 		frame = new JFrame();
         frame.setSize( Math.min( (int)graph.getWidth() + 200, 1700 ), Math.min( (int)graph.getHeight() + 200, 900 ) );