Browse Source

autoformat

jascha Bohne 7 years ago
parent
commit
273acd0a5a

+ 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)) {

+ 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.
 	 * 

+ 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;
 	}