Browse Source

autoformat

jascha Bohne 7 years ago
parent
commit
72ea3d3485
18 changed files with 143 additions and 169 deletions
  1. 9 11
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/GraphHelper.java
  2. 1 1
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/GraphManager.java
  3. 2 6
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/MyGraph.java
  4. 10 15
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/GraphMLExporter.java
  5. 8 11
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/GraphMLImporter.java
  6. 36 43
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/MyFileSinkGraphML.java
  7. 2 2
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/MyFileSourceGraphML.java
  8. 5 5
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/MySourceBase.java
  9. 1 1
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/Main.java
  10. 28 29
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/BasicMappingOperator.java
  11. 1 1
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/TestOperator.java
  12. 1 1
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/interfaces/ScopvizGraphOperator.java
  13. 9 10
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ButtonManager.java
  14. 1 1
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GUIController.java
  15. 4 4
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GraphDisplayManager.java
  16. 11 13
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/OperatorManager.java
  17. 2 4
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/OptionsManager.java
  18. 12 11
      scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ToolboxManager.java

+ 9 - 11
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/GraphHelper.java

@@ -10,7 +10,6 @@ import org.graphstream.graph.Node;
 import org.graphstream.ui.geom.Point3;
 
 import de.tu_darmstadt.informatik.tk.scopviz.main.Layer;
-import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.OptionsManager;
 
 public class GraphHelper {
@@ -157,7 +156,7 @@ public class GraphHelper {
 	 * Removes all labels if that option is set
 	 */
 	public static void handleEdgeWeight(MyGraph g) {
-		if(!Layer.UNDERLAY.equals(g.getAttribute("layer"))){
+		if (!Layer.UNDERLAY.equals(g.getAttribute("layer"))) {
 			return;
 		}
 		Edge e = null;
@@ -175,17 +174,16 @@ public class GraphHelper {
 			}
 		}
 	}
-	
+
 	/**
-	 * adds default to all Nodes and
-	 * converts yEd attributes to regular ones.
+	 * adds default to all Nodes and converts yEd attributes to regular ones.
 	 * 
 	 * @param g
 	 *            the graph that the attributes will be added onto
 	 */
-	public static void setAllDefaults(MyGraph g){
+	public static void setAllDefaults(MyGraph g) {
 		for (Node n : g.getNodeSet()) {
-			//general defaults
+			// general defaults
 			if (!n.hasAttribute("ui.label")) {
 				n.addAttribute("ui.label", "");
 			}
@@ -193,8 +191,8 @@ public class GraphHelper {
 				n.addAttribute("typeofNode", "standard");
 			}
 
-			//underlay defaults
-			if(Layer.UNDERLAY.equals(g.getAttribute("layer"))){
+			// underlay defaults
+			if (Layer.UNDERLAY.equals(g.getAttribute("layer"))) {
 				if (!n.hasAttribute("typeofDevice") || n.getAttribute("typeofDevice").equals("")) {
 					n.addAttribute("typeofDevice", "unknown");
 				}
@@ -209,8 +207,8 @@ public class GraphHelper {
 				}
 			}
 
-			//operator defaults
-			if(Layer.OPERATOR.equals(g.getAttribute("layer"))){
+			// operator defaults
+			if (Layer.OPERATOR.equals(g.getAttribute("layer"))) {
 				if (!n.hasAttribute("process-need") || n.getAttribute("process-need").equals("")) {
 					n.addAttribute("process-need", 0.0);
 				}

+ 1 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/GraphManager.java

@@ -572,7 +572,7 @@ public class GraphManager {
 	 */
 	protected void deselectNodesAfterEdgeCreation(String nodeID) {
 		Node n = getGraph().getNode(nodeID);
-		if(n == null){
+		if (n == null) {
 			return;
 		}
 		if (!hasClass(n, UI_CLASS_PROCESSING_ENABLED) || !GraphDisplayManager.getCurrentLayer().equals(Layer.MAPPING)) {

+ 2 - 6
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/graphs/MyGraph.java

@@ -2,16 +2,13 @@ package de.tu_darmstadt.informatik.tk.scopviz.graphs;
 
 import java.util.Iterator;
 import java.util.LinkedList;
-import java.util.Optional;
 
 import org.graphstream.graph.Edge;
 import org.graphstream.graph.Node;
 import org.graphstream.graph.implementations.SingleGraph;
 
 import de.tu_darmstadt.informatik.tk.scopviz.main.Layer;
-import de.tu_darmstadt.informatik.tk.scopviz.ui.OptionsManager;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.ToolboxManager;
-import javafx.scene.control.TextInputDialog;
 
 /**
  * Our own Class to extend GraphStreams Graph with our own Functionality.
@@ -102,7 +99,7 @@ public class MyGraph extends SingleGraph {
 	 *            the Edge that was just created
 	 */
 	private void edgeCreatedNotify(Edge e) {
-		if(Layer.UNDERLAY.equals(this.getAttribute("layer"))){
+		if (Layer.UNDERLAY.equals(this.getAttribute("layer"))) {
 			ToolboxManager.createWeighDialog(e);
 		}
 		for (EdgeCreatedListener list : allEdgeListeners) {
@@ -122,8 +119,7 @@ public class MyGraph extends SingleGraph {
 	}
 
 	/**
-	 * Notifies all added NodeCreatedListener.
-	 * also sets defaults
+	 * Notifies all added NodeCreatedListener. also sets defaults
 	 * 
 	 * @param n
 	 *            the Edge that was just created

+ 10 - 15
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/GraphMLExporter.java

@@ -2,14 +2,7 @@ package de.tu_darmstadt.informatik.tk.scopviz.io;
 
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.util.Iterator;
 
-import org.graphstream.graph.Edge;
-import org.graphstream.graph.Graph;
-import org.graphstream.graph.Node;
-import org.graphstream.stream.file.FileSinkGraphML;
-
-import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.MyGraph;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
 import javafx.stage.FileChooser;
@@ -35,7 +28,7 @@ public class GraphMLExporter {
 	public void writeGraph(final MyGraph g, final String fileName) {
 		MyFileSinkGraphML writer = new MyFileSinkGraphML();
 		String newFileName = fileName;
-		if(g.isComposite()){
+		if (g.isComposite()) {
 			writer.exportGraphs(g.getAllSubGraphs(), fileNameAppend(fileName, "appended"));
 			newFileName = fileNameAppend(fileName, "merged");
 		}
@@ -70,27 +63,29 @@ public class GraphMLExporter {
 
 		}
 	}
-	
-	/** 
+
+	/**
 	 * Appends a string to the fileName before the fileExtension
 	 * 
-	 * @param fileName the fileName
-	 * @param append the string that will be appended
+	 * @param fileName
+	 *            the fileName
+	 * @param append
+	 *            the string that will be appended
 	 */
-	public String fileNameAppend(String fileName, String append){
+	public String fileNameAppend(String fileName, String append) {
 		String[] parts = fileName.split(".");
 		if (parts.length < 2) {
 			fileName = fileName.concat(append);
 		} else {
 			fileName = "";
 			int i = 0;
-			for (; i < parts.length-1; i++){
+			for (; i < parts.length - 1; i++) {
 				fileName = fileName.concat(parts[0]);
 			}
 			fileName.concat(append);
 			fileName.concat(parts[i]);
 		}
-		
+
 		return fileName;
 	}
 }

+ 8 - 11
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/GraphMLImporter.java

@@ -5,13 +5,11 @@ import java.net.URL;
 import java.util.LinkedList;
 
 import org.graphstream.graph.Node;
-import org.graphstream.graph.implementations.SingleGraph;
 
 import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.GraphHelper;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.MyGraph;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
-import de.tu_darmstadt.informatik.tk.scopviz.ui.OptionsManager;
 import javafx.stage.FileChooser;
 import javafx.stage.Stage;
 
@@ -47,18 +45,17 @@ public class GraphMLImporter {
 			System.out.println("GraphML File doesn't exist or can't be opened");
 			e.printStackTrace();
 		}
-		if(fs.wasMultiGraph()){
+		if (fs.wasMultiGraph()) {
 			g = GraphHelper.newMerge(false, fs.getSubGraphs().toArray(new MyGraph[0]));
 		}
 		fs.removeSink(g);
-		for(Node n : g.getNodeSet()){
+		for (Node n : g.getNodeSet()) {
 			n.removeAttribute("ui.class");
 		}
 		yEdConversion(g);
 		return g;
 	}
 
-
 	/**
 	 * Imports a GraphML file. Opens a open dialog. Returns null if the process
 	 * is aborted.
@@ -101,7 +98,7 @@ public class GraphMLImporter {
 			e.printStackTrace();
 		}
 		fs.removeSink(g);
-		for(Node n : g.getNodeSet()){
+		for (Node n : g.getNodeSet()) {
 			n.removeAttribute("ui.class");
 		}
 		yEdConversion(g);
@@ -117,19 +114,19 @@ public class GraphMLImporter {
 		return fs.getSubGraphs();
 	}
 
-	public void yEdConversion(MyGraph g){
-		for(Node n : g.getNodeSet()) {
-			//yed conversion
+	public void yEdConversion(MyGraph g) {
+		for (Node n : g.getNodeSet()) {
+			// yed conversion
 			if (!n.hasAttribute("ui.label") && n.hasAttribute("yEd.label")) {
 				n.addAttribute("ui.label", n.getAttribute("yEd.label").toString());
 				n.removeAttribute("yEd.label");
-			} else if(n.hasAttribute("ui.label")) {
+			} else if (n.hasAttribute("ui.label")) {
 				n.removeAttribute("yEd.label");
 			}
 			if (n.hasAttribute("yEd.x") && !n.getAttribute("yEd.x").equals("")) {
 				n.addAttribute("x", Main.getInstance().convertAttributeTypes(n.getAttribute("yEd.x"), new Double(0.0)));
 				n.removeAttribute("yEd.x");
-			} else{
+			} else {
 				n.removeAttribute("yEd.x");
 			}
 			if (n.hasAttribute("yEd.y") && !n.getAttribute("yEd.y").equals("")) {

+ 36 - 43
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/MyFileSinkGraphML.java

@@ -13,8 +13,7 @@ import org.graphstream.stream.file.FileSinkGraphML;
 import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.MyGraph;
 
-
-public class MyFileSinkGraphML extends FileSinkGraphML{
+public class MyFileSinkGraphML extends FileSinkGraphML {
 	public boolean isWritingMultigraph = false;
 
 	private void print(String format, Object... args) throws IOException {
@@ -22,7 +21,7 @@ public class MyFileSinkGraphML extends FileSinkGraphML{
 	}
 
 	@Override
-	protected void exportGraph(Graph g){
+	protected void exportGraph(Graph g) {
 		try {
 			int attribute = 0;
 			HashMap<String, String> nodeAttributes = new HashMap<String, String>();
@@ -54,15 +53,15 @@ public class MyFileSinkGraphML extends FileSinkGraphML{
 
 					graphAttributes.put(j, gId);
 
-					print("\t<key id=\"%s\" for=\"graph\" attr.name=\"%s\" attr.type=\"%s\"/>\n",
-							gId, escapeXmlString(j), gType);
+					print("\t<key id=\"%s\" for=\"graph\" attr.name=\"%s\" attr.type=\"%s\"/>\n", gId,
+							escapeXmlString(j), gType);
 				}
 			}
 
 			for (Node n : g.getEachNode()) {
 				for (String k : n.getAttributeKeySet()) {
-					//AttributeFiltering
-					if(k.equals("ui.j2dsk") || k.equals("ui.class") || k.equals("ui.pie-values")){
+					// AttributeFiltering
+					if (k.equals("ui.j2dsk") || k.equals("ui.class") || k.equals("ui.pie-values")) {
 						continue;
 					}
 					Class<? extends Object> c = n.getAttribute(k).getClass();
@@ -70,8 +69,8 @@ public class MyFileSinkGraphML extends FileSinkGraphML{
 							&& !(c == Integer.class) && !(c == Long.class) && !(c == Short.class) && !(c == Byte.class)
 							&& !(c == Float.class) && !(c == Double.class)) {
 						Debug.out("Could not parse an Attribute because it is not Primitive or a String \n\t"
-								+ "(Attribute: " + k + ", Value: " + n.getAttribute(k) + ", from Node: " + n + ", Type: "
-								+ c + ") ", 2);
+								+ "(Attribute: " + k + ", Value: " + n.getAttribute(k) + ", from Node: " + n
+								+ ", Type: " + c + ") ", 2);
 						continue;
 					}
 
@@ -99,16 +98,16 @@ public class MyFileSinkGraphML extends FileSinkGraphML{
 
 						nodeAttributes.put(k, id);
 
-						print("\t<key id=\"%s\" for=\"node\" attr.name=\"%s\" attr.type=\"%s\"/>\n",
-								id, escapeXmlString(k), type);
+						print("\t<key id=\"%s\" for=\"node\" attr.name=\"%s\" attr.type=\"%s\"/>\n", id,
+								escapeXmlString(k), type);
 					}
 				}
 			}
 
 			for (Edge n : g.getEachEdge()) {
 				for (String k : n.getAttributeKeySet()) {
-					//AttributeFiltering
-					if(k.equals("ui.j2dsk")){
+					// AttributeFiltering
+					if (k.equals("ui.j2dsk")) {
 						continue;
 					}
 					Class<? extends Object> c = n.getAttribute(k).getClass();
@@ -116,10 +115,10 @@ public class MyFileSinkGraphML extends FileSinkGraphML{
 							&& !(c == Integer.class) && !(c == Long.class) && !(c == Short.class) && !(c == Byte.class)
 							&& !(c == Float.class) && !(c == Double.class)) {
 						Debug.out("Could not parse an Attribute because it is not Primitive or a String \n\t"
-								+ "(Attribute: " + k + ", Value: " + n.getAttribute(k) + ", from Edge: " + n + ", Type: "
-								+ c + ") ", 2);
+								+ "(Attribute: " + k + ", Value: " + n.getAttribute(k) + ", from Edge: " + n
+								+ ", Type: " + c + ") ", 2);
 						continue;
-					}	
+					}
 
 					if (!edgeAttributes.containsKey(k)) {
 						Object value = n.getAttribute(k);
@@ -144,22 +143,22 @@ public class MyFileSinkGraphML extends FileSinkGraphML{
 							type = "string";
 
 						edgeAttributes.put(k, id);
-						print("\t<key id=\"%s\" for=\"edge\" attr.name=\"%s\" attr.type=\"%s\"/>\n",
-								id, escapeXmlString(k), type);
+						print("\t<key id=\"%s\" for=\"edge\" attr.name=\"%s\" attr.type=\"%s\"/>\n", id,
+								escapeXmlString(k), type);
 					}
 				}
 			}
 
 			print("\t<graph id=\"%s\" edgedefault=\"undirected\">\n", escapeXmlString(g.getId()));
 			for (String k : g.getAttributeKeySet()) {
-				print("\t\t\t<data key=\"%s\">%s</data>\n", graphAttributes
-						.get(k), escapeXmlString(g.getAttribute(k).toString()));
+				print("\t\t\t<data key=\"%s\">%s</data>\n", graphAttributes.get(k),
+						escapeXmlString(g.getAttribute(k).toString()));
 			}
 
 			for (Node n : g.getEachNode()) {
 				print("\t\t<node id=\"%s\">\n", n.getId());
 				for (String k : n.getAttributeKeySet()) {
-					if(k.equals("ui.j2dsk") || k.equals("ui.class") || k.equals("ui.pie-values")){
+					if (k.equals("ui.j2dsk") || k.equals("ui.class") || k.equals("ui.pie-values")) {
 						continue;
 					}
 					Class<? extends Object> c = n.getAttribute(k).getClass();
@@ -169,18 +168,16 @@ public class MyFileSinkGraphML extends FileSinkGraphML{
 						continue;
 					}
 
-					print("\t\t\t<data key=\"%s\">%s</data>\n", nodeAttributes
-							.get(k), escapeXmlString(n.getAttribute(k).toString()));
+					print("\t\t\t<data key=\"%s\">%s</data>\n", nodeAttributes.get(k),
+							escapeXmlString(n.getAttribute(k).toString()));
 				}
 				print("\t\t</node>\n");
 			}
 			for (Edge e : g.getEachEdge()) {
-				print(
-						"\t\t<edge id=\"%s\" source=\"%s\" target=\"%s\" directed=\"%s\">\n",
-						e.getId(), e.getSourceNode().getId(), e.getTargetNode()
-						.getId(), e.isDirected());
+				print("\t\t<edge id=\"%s\" source=\"%s\" target=\"%s\" directed=\"%s\">\n", e.getId(),
+						e.getSourceNode().getId(), e.getTargetNode().getId(), e.isDirected());
 				for (String k : e.getAttributeKeySet()) {
-					if(k.equals("ui.j2dsk") || k.equals("ui.class") || k.equals("ui.pie-values")){
+					if (k.equals("ui.j2dsk") || k.equals("ui.class") || k.equals("ui.pie-values")) {
 						continue;
 					}
 					Class<? extends Object> c = e.getAttribute(k).getClass();
@@ -190,8 +187,8 @@ public class MyFileSinkGraphML extends FileSinkGraphML{
 						continue;
 					}
 
-					print("\t\t\t<data key=\"%s\">%s</data>\n", edgeAttributes
-							.get(k), escapeXmlString(e.getAttribute(k).toString()));
+					print("\t\t\t<data key=\"%s\">%s</data>\n", edgeAttributes.get(k),
+							escapeXmlString(e.getAttribute(k).toString()));
 				}
 				print("\t\t</edge>\n");
 			}
@@ -201,36 +198,32 @@ public class MyFileSinkGraphML extends FileSinkGraphML{
 		}
 	}
 
-	private static String escapeXmlString(String s){
-		//why do you make me do this graphstream???
-		return s
-				.replace("&", "&amp;")
-				.replace("<", "&lt;")
-				.replace(">", "&gt;")
-				.replace("\"", "&quot;")
-				.replace("'", "&apos;");
+	private static String escapeXmlString(String s) {
+		// why do you make me do this graphstream???
+		return s.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace("\"", "&quot;").replace("'",
+				"&apos;");
 	}
 
 	/**
 	 * 
 	 * @param graphs
 	 */
-	public void exportGraphs(LinkedList<MyGraph> graphs, String fileName){
+	public void exportGraphs(LinkedList<MyGraph> graphs, String fileName) {
 		Iterator<MyGraph> graphIter = graphs.iterator();
-		while(graphIter.hasNext()){
-			if(graphIter.next().isComposite()){
+		while (graphIter.hasNext()) {
+			if (graphIter.next().isComposite()) {
 				graphIter.remove();
 			}
 		}
 		try {
 			begin(fileName);
 			isWritingMultigraph = true;
-			for(MyGraph g : graphs){
+			for (MyGraph g : graphs) {
 				exportGraph(g);
 			}
 			isWritingMultigraph = false;
 			end();
-		} catch(IOException e){
+		} catch (IOException e) {
 			e.printStackTrace();
 		}
 	}

+ 2 - 2
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/MyFileSourceGraphML.java

@@ -679,7 +679,7 @@ public class MyFileSourceGraphML extends MySourceBase implements FileSource, XML
 					currentReaderState = ReaderState.END;
 				} else if (isEvent(e, XMLEvent.START_ELEMENT, "key")) {
 					currentReaderState = ReaderState.KEYS;
-					
+
 				} else if (isEvent(e, XMLEvent.START_ELEMENT, "node") || isEvent(e, XMLEvent.START_ELEMENT, "edge")) {
 					currentReaderState = ReaderState.NODES_EDGES;
 				} else if (isEvent(e, XMLEvent.START_ELEMENT, "data")) {
@@ -1395,7 +1395,7 @@ public class MyFileSourceGraphML extends MySourceBase implements FileSource, XML
 			Location loc = e.getLocation();
 
 			Debug.out(String.format("[WARNING] %d:%d graph inside node is not implemented", loc.getLineNumber(),
-					loc.getColumnNumber()),2);
+					loc.getColumnNumber()), 2);
 
 			pushback(e);
 			__graph();

+ 5 - 5
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/io/MySourceBase.java

@@ -74,16 +74,16 @@ import de.tu_darmstadt.informatik.tk.scopviz.graphs.MyGraph;
  */
 public class MySourceBase implements Source {
 	// Attribute
-	
+
 	/**
 	 * if the programm is currently reading a multigraph
 	 */
 	protected boolean multiGraph = false;
-	
-	/** 
+
+	/**
 	 * @return if the last read Graph was a multigraph
 	 */
-	public boolean wasMultiGraph(){
+	public boolean wasMultiGraph() {
 		return multiGraph;
 	}
 
@@ -1195,7 +1195,7 @@ public class MySourceBase implements Source {
 	 * called
 	 */
 	protected void newSubGraph() {
-		if(subGraphCounter>1){
+		if (subGraphCounter > 1) {
 			Debug.out(originalSink.toString());
 			removeSink(originalSink);
 			multiGraph = true;

+ 1 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/Main.java

@@ -157,7 +157,7 @@ public final class Main {
 	// don't worry I checked all the conversions
 	@SuppressWarnings("unchecked")
 	public <T extends Number> T convertAttributeTypes(Object attribute, T result) {
-		if(attribute == null){
+		if (attribute == null) {
 			return null;
 		}
 		String currentType = attribute.getClass().getSimpleName().toLowerCase();

+ 28 - 29
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/BasicMappingOperator.java

@@ -1,6 +1,5 @@
 package de.tu_darmstadt.informatik.tk.scopviz.metrics;
 
-import java.util.Collection;
 import java.util.Comparator;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -17,35 +16,35 @@ public class BasicMappingOperator implements ScopvizGraphOperator {
 
 	@Override
 	public void calculate(GraphManager g) {
-		//check if you are using a Mapping Graph
+		// check if you are using a Mapping Graph
 		MappingGraphManager map;
-		if (g instanceof MappingGraphManager){
+		if (g instanceof MappingGraphManager) {
 			map = (MappingGraphManager) g;
 		} else {
 			Debug.out("ERROR: can only invoke " + getName() + " on a Mapping Graph", 3);
 			return;
 		}
-		
-		//find the Nodes that have to be mapped and where they can be mapped to
+
+		// find the Nodes that have to be mapped and where they can be mapped to
 		LinkedList<Node> operatorNodes = getOperatorNodes(map);
 		LinkedList<Node> procEnNodes = getProcEnNodes(map);
-		
-		
-		//Map the Nodes (beginning with the operatorNode with the highest Processing requirement)
+
+		// Map the Nodes (beginning with the operatorNode with the highest
+		// Processing requirement)
 		operatorNodes.sort(operatorComparator);
 		Iterator<Node> procEnIterator;
 		Boolean successfull;
-		for (Node n: operatorNodes){
+		for (Node n : operatorNodes) {
 			procEnIterator = procEnNodes.iterator();
 			successfull = false;
-			while(procEnIterator.hasNext() && !successfull){
+			while (procEnIterator.hasNext() && !successfull) {
 				successfull = map.createEdge(procEnIterator.next().getId(), n.getId());
 				Debug.out(new Boolean(successfull).toString());
 			}
-			if(!successfull){
+			if (!successfull) {
 				Debug.out("WARNING: BasicMappingOperator could not map all Nodes");
 			}
-			
+
 		}
 	}
 
@@ -53,43 +52,43 @@ public class BasicMappingOperator implements ScopvizGraphOperator {
 	public String getName() {
 		return "Basic Automapping";
 	}
-	
-	protected LinkedList<Node> getProcEnNodes(GraphManager g){
+
+	protected LinkedList<Node> getProcEnNodes(GraphManager g) {
 		LinkedList<Node> result = new LinkedList<Node>();
-		Iterator<Node> nodeIter= g.getGraph().getNodeIterator();
-		while(nodeIter.hasNext()){
+		Iterator<Node> nodeIter = g.getGraph().getNodeIterator();
+		while (nodeIter.hasNext()) {
 			Node n = nodeIter.next();
-			if("procEn".equals(n.getAttribute("typeofNode"))){
+			if ("procEn".equals(n.getAttribute("typeofNode"))) {
 				result.add(n);
 			}
 		}
 		return result;
 	}
-	
-	protected LinkedList<Node> getOperatorNodes(GraphManager g){
+
+	protected LinkedList<Node> getOperatorNodes(GraphManager g) {
 		LinkedList<Node> result = new LinkedList<Node>();
-		Iterator<Node> nodeIter= g.getGraph().getNodeIterator();
-		while(nodeIter.hasNext()){
+		Iterator<Node> nodeIter = g.getGraph().getNodeIterator();
+		while (nodeIter.hasNext()) {
 			Node n = nodeIter.next();
-			if("operator".equals(n.getAttribute("typeofNode"))){
+			if ("operator".equals(n.getAttribute("typeofNode"))) {
 				result.add(n);
 			}
 		}
 		return result;
 	}
-	
+
 	protected Comparator<Node> operatorComparator = new Comparator<Node>() {
 
 		@Override
-		public int compare(Node o1,Node o2) {
+		public int compare(Node o1, Node o2) {
 			Main m = Main.getInstance();
-			
-			//this does: process-need(o1) - process-need(o2)
-			Double result =  m.convertAttributeTypes(o1.getAttribute("process-need"), new Double(0)) 
+
+			// this does: process-need(o1) - process-need(o2)
+			Double result = m.convertAttributeTypes(o1.getAttribute("process-need"), new Double(0))
 					- m.convertAttributeTypes(o2.getAttribute("process-need"), new Double(0));
-			if(result == 0.0){
+			if (result == 0.0) {
 				return 0;
-			}else if (result < 0.0){
+			} else if (result < 0.0) {
 				return -1;
 			} else {
 				return 1;

+ 1 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/TestOperator.java

@@ -12,7 +12,7 @@ public class TestOperator implements ScopvizGraphOperator {
 	@Override
 	public void calculate(GraphManager g) {
 		Iterator<Node> nodeIter = g.getGraph().getNodeIterator();
-		while(nodeIter.hasNext()){
+		while (nodeIter.hasNext()) {
 			nodeIter.next().addAttribute("ui.style", "fill-color: blue;");
 		}
 	}

+ 1 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/metrics/interfaces/ScopvizGraphOperator.java

@@ -3,7 +3,7 @@ package de.tu_darmstadt.informatik.tk.scopviz.metrics.interfaces;
 import de.tu_darmstadt.informatik.tk.scopviz.graphs.GraphManager;
 
 public interface ScopvizGraphOperator {
-	
+
 	/**
 	 * calculates a new Version of the Graph using the given operator.
 	 * 

+ 9 - 10
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ButtonManager.java

@@ -3,10 +3,8 @@ package de.tu_darmstadt.informatik.tk.scopviz.ui;
 import java.io.IOException;
 import java.util.ArrayList;
 
-import org.graphstream.graph.implementations.Graphs;
 import org.jxmapviewer.viewer.WaypointPainter;
 
-import de.tu_darmstadt.informatik.tk.scopviz.graphs.MyGraph;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Layer;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.mapView.CustomWaypoint;
@@ -131,7 +129,7 @@ public final class ButtonManager {
 	 */
 	public static void underlayAction(ActionEvent arg0) {
 		Main.getInstance().getGraphManager().deselectEdgeCreationNodes();
-		
+
 		switchfromSymbolLayer();
 
 		GraphDisplayManager.setCurrentLayer(Layer.UNDERLAY);
@@ -161,7 +159,7 @@ public final class ButtonManager {
 	 */
 	public static void operatorAction(ActionEvent arg0) {
 		Main.getInstance().getGraphManager().deselectEdgeCreationNodes();
-		
+
 		switchfromSymbolLayer();
 
 		GraphDisplayManager.setCurrentLayer(Layer.OPERATOR);
@@ -191,7 +189,7 @@ public final class ButtonManager {
 	 */
 	public static void mappingAction(ActionEvent arg0) {
 		Main.getInstance().getGraphManager().deselectEdgeCreationNodes();
-		
+
 		// show metricbox/update button
 		if (!(GraphDisplayManager.getCurrentLayer().equals(Layer.MAPPING))) {
 			controller.rightSide.getChildren().add(controller.updateButtonAPane);
@@ -224,15 +222,16 @@ public final class ButtonManager {
 	 */
 	public static void symbolRepAction(ActionEvent arg0) {
 		Main.getInstance().getGraphManager().deselectEdgeCreationNodes();
-		
+
 		if (!(GraphDisplayManager.getCurrentLayer().equals(Layer.SYMBOL))) {
 
 			// add a copy of the underlay graph to the the symbol layer
-			//TODO fix problem with underlay weight popups
-			//MyGraph gClone = (MyGraph) Graphs.clone(GraphDisplayManager.getGraphManager(Layer.UNDERLAY).getGraph());
-			//gClone.removeAttribute("layer");
+			// TODO fix problem with underlay weight popups
+			// MyGraph gClone = (MyGraph)
+			// Graphs.clone(GraphDisplayManager.getGraphManager(Layer.UNDERLAY).getGraph());
+			// gClone.removeAttribute("layer");
 			GraphDisplayManager.setCurrentLayer(Layer.SYMBOL);
-			//GraphDisplayManager.addGraph(gClone, true);
+			// GraphDisplayManager.addGraph(gClone, true);
 			controller.topLeftAPane.getChildren().add(controller.symbolToolVBox);
 		}
 

+ 1 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GUIController.java

@@ -97,7 +97,7 @@ public class GUIController implements Initializable {
 	public MenuItem delete;
 	@FXML
 	public MenuItem undelete;
-	@FXML 
+	@FXML
 	public MenuItem operators;
 	@FXML
 	public MenuItem resetMapping;

+ 4 - 4
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GraphDisplayManager.java

@@ -194,14 +194,14 @@ public final class GraphDisplayManager {
 		if (g == null) {
 			throw new NullArgumentException();
 		}
-				
+
 		GraphManager v;
 		int ret = 0;
 		// replacing the current graph or merging
 		if (replaceCurrent) {
 			v = new GraphManager(g);
 			v.getGraph().addAttribute("layer", currentLayer);
-			//set default values
+			// set default values
 			GraphHelper.setAllDefaults(g);
 			v.getGraph().addAttribute("ui.antialias");
 			removeAllCurrentGraphs();
@@ -363,8 +363,8 @@ public final class GraphDisplayManager {
 			Debug.out("ERROR: no Operator found", 3);
 			return;
 		}
-		if (mapping == null || !mapping.hasGraphManagerAsParent(underlay)
-				|| !mapping.hasGraphManagerAsParent(operator) || force) {
+		if (mapping == null || !mapping.hasGraphManagerAsParent(underlay) || !mapping.hasGraphManagerAsParent(operator)
+				|| force) {
 			if (mapping == null)
 				Debug.out("WARNING: no Mapping found", 2);
 			else {

+ 11 - 13
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/OperatorManager.java

@@ -3,7 +3,6 @@ package de.tu_darmstadt.informatik.tk.scopviz.ui;
 import java.util.ArrayList;
 import java.util.HashMap;
 
-import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
 import de.tu_darmstadt.informatik.tk.scopviz.metrics.BasicMappingOperator;
 import de.tu_darmstadt.informatik.tk.scopviz.metrics.TestOperator;
@@ -11,11 +10,11 @@ import de.tu_darmstadt.informatik.tk.scopviz.metrics.interfaces.ScopvizGraphOper
 import javafx.application.Platform;
 import javafx.collections.FXCollections;
 import javafx.geometry.Insets;
+import javafx.scene.control.ButtonBar.ButtonData;
 import javafx.scene.control.ButtonType;
 import javafx.scene.control.ChoiceBox;
 import javafx.scene.control.Dialog;
 import javafx.scene.control.Label;
-import javafx.scene.control.ButtonBar.ButtonData;
 import javafx.scene.layout.GridPane;
 
 public class OperatorManager {
@@ -27,17 +26,17 @@ public class OperatorManager {
 	/**
 	 * Initializes all GraphOperators for employment
 	 * 
-	 * ****Central method to add a new metric***** 
-	 * Add line: addOperator(new YourMetric()); for using it in the Operatordialog
+	 * ****Central method to add a new metric***** Add line: addOperator(new
+	 * YourMetric()); for using it in the Operatordialog
 	 * **************************************************************
 	 * 
 	 */
-	private static void initializeGraphOperators(){
+	private static void initializeGraphOperators() {
 		addOperator(new TestOperator());
-		addOperator(new  BasicMappingOperator());
+		addOperator(new BasicMappingOperator());
 	}
 
-	public static void openOperatorsDialog(){
+	public static void openOperatorsDialog() {
 		Dialog<ArrayList<String>> addPropDialog = new Dialog<>();
 		addPropDialog.setTitle("GraphOperators");
 
@@ -50,11 +49,11 @@ public class OperatorManager {
 		grid.setVgap(10);
 		grid.setPadding(new Insets(20, 150, 10, 10));
 
-		//set DropDown Menu
+		// set DropDown Menu
 		ChoiceBox<String> operatorChooser = new ChoiceBox<>();
 		operatorChooser.setItems(FXCollections.observableArrayList(operators.keySet()));
 
-		//adding elements to grid
+		// adding elements to grid
 		grid.add(new Label("Please select the operator you want to invoke on the current Gaph"), 0, 0);
 		grid.add(operatorChooser, 0, 1);
 
@@ -66,7 +65,7 @@ public class OperatorManager {
 		addPropDialog.setResultConverter(dialogButton -> {
 			if (dialogButton == addButtonType) {
 				operators.get(operatorChooser.getSelectionModel().getSelectedItem())
-				.calculate(Main.getInstance().getGraphManager());
+						.calculate(Main.getInstance().getGraphManager());
 				return null;
 			} else
 				return null;
@@ -74,14 +73,13 @@ public class OperatorManager {
 		});
 		addPropDialog.showAndWait();
 
-
 	}
 
-	public static void addOperator(ScopvizGraphOperator op){
+	public static void addOperator(ScopvizGraphOperator op) {
 		operators.put(op.getName(), op);
 	}
 
-	public static void initialize(GUIController g){
+	public static void initialize(GUIController g) {
 		initializeGraphOperators();
 		guiController = g;
 	}

+ 2 - 4
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/OptionsManager.java

@@ -16,7 +16,6 @@ import javafx.scene.control.Label;
 import javafx.scene.control.RadioButton;
 import javafx.scene.control.TextField;
 import javafx.scene.layout.GridPane;
-import sun.util.logging.resources.logging;
 
 /**
  * manages the settings of the program also stores the constants
@@ -73,10 +72,9 @@ public final class OptionsManager {
 			nodeGraphicsSelector.getSelectionModel().select(StylesheetManager.getNodeGraphics());
 		}
 
-		ChoiceBox<Integer> loggingLevelSelector = new ChoiceBox<Integer>(
-				FXCollections.observableArrayList(1, 2, 3));
+		ChoiceBox<Integer> loggingLevelSelector = new ChoiceBox<Integer>(FXCollections.observableArrayList(1, 2, 3));
 		loggingLevelSelector.getSelectionModel().select(new Integer(Debug.getLogLevel()));
-				
+
 		TextField defaultLatitudeField = new TextField(Double.toString(defaultLat));
 		TextField defaultLongitudeField = new TextField(Double.toString(defaultLong));
 

+ 12 - 11
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ToolboxManager.java

@@ -216,20 +216,21 @@ public final class ToolboxManager {
 	private static Pair<Object, String> pair(Object picture, String name) {
 		return new Pair<>(picture, name);
 	}
-	
+
 	/**
 	 * the last edge that was created
 	 */
 	private static Edge lastCreatedEdge = null;
-	
+
 	/**
-	 * opens a dialog that asks for a weight for a newly created Edge. 
-	 * The default value is Optionsmanager.getDefaultWeight()
-	 *   
-	 * @param e the new Edge that needs a weight
+	 * opens a dialog that asks for a weight for a newly created Edge. The
+	 * default value is Optionsmanager.getDefaultWeight()
+	 * 
+	 * @param e
+	 *            the new Edge that needs a weight
 	 */
-	public static void createWeighDialog(Edge e){
-		if(e.equals(lastCreatedEdge)){
+	public static void createWeighDialog(Edge e) {
+		if (e.equals(lastCreatedEdge)) {
 			return;
 		}
 		lastCreatedEdge = e;
@@ -239,7 +240,7 @@ public final class ToolboxManager {
 			weightDialog.setHeaderText("Please enter the weight of the Edge");
 			weightDialog.setContentText("Edge Weight");
 			Optional<String> result = weightDialog.showAndWait();
-			if(result.isPresent()){
+			if (result.isPresent()) {
 				e.addAttribute("weight", result.get());
 			}
 		});
@@ -250,7 +251,7 @@ public final class ToolboxManager {
 	 *
 	 */
 	public static class PairKeyFactory
-	implements Callback<TableColumn.CellDataFeatures<Pair<Object, String>, String>, ObservableValue<String>> {
+			implements Callback<TableColumn.CellDataFeatures<Pair<Object, String>, String>, ObservableValue<String>> {
 		@Override
 		public ObservableValue<String> call(TableColumn.CellDataFeatures<Pair<Object, String>, String> data) {
 			return new ReadOnlyObjectWrapper<>(data.getValue().getValue());
@@ -262,7 +263,7 @@ public final class ToolboxManager {
 	 *
 	 */
 	public static class PairValueFactory
-	implements Callback<TableColumn.CellDataFeatures<Pair<Object, String>, Object>, ObservableValue<Object>> {
+			implements Callback<TableColumn.CellDataFeatures<Pair<Object, String>, Object>, ObservableValue<Object>> {
 		@SuppressWarnings("unchecked")
 		@Override
 		public ObservableValue<Object> call(TableColumn.CellDataFeatures<Pair<Object, String>, Object> data) {