Browse Source

Merge branch 'Ohne_Drag_and_Drop' of https://git.tk.informatik.tu-darmstadt.de/carlos.garcia/praktikum-holons into Ohne_Drag_and_Drop

Edgardo Palza 7 years ago
parent
commit
1de3134bb6

+ 6 - 6
src/classes/CpsObject.java

@@ -22,8 +22,8 @@ public abstract class CpsObject {
 	/* Where the Object is Stored */
 	String sav;
 	
-	float energyIn;
-	float energyOut;
+	float input;
+	float output;
 
 	/**
 	 * Constructor for an CpsObejct with an unique ID
@@ -138,19 +138,19 @@ public abstract class CpsObject {
 
 	/* Getter and Setters for the energy input and output */
 	public float getEnergyIn() {
-		return energyIn;
+		return input;
 	}
 
 	public void setEnergyIn(float energyIn) {
-		this.energyIn = energyIn;
+		this.input = energyIn;
 	}
 
 	public float getEnergyOut() {
-		return energyOut;
+		return output;
 	}
 
 	public void setEnergyOut(float energyOut) {
-		this.energyOut = energyOut;
+		this.output = energyOut;
 	}
 
 

+ 0 - 2
src/classes/HolonSwitch.java

@@ -5,8 +5,6 @@ public class HolonSwitch extends CpsObject {
 	 * True, if this wire is working (capable of carrying electricity), else
 	 * false
 	 */
-	
-	
 	boolean active;
 
 	public HolonSwitch(String ObjName) {

+ 4 - 0
src/classes/HolonTransformer.java

@@ -7,6 +7,10 @@ public class HolonTransformer extends CpsObject {
 
 	/* Fixed transform value */
 	float transformFixed;
+	
+	float maxInput;
+	
+	float maxOutput;
 
 	/**
 	 * Constructor Set type of object (Transformer), its transform ratio and the

+ 8 - 4
src/ui/controller/LoadController.java

@@ -200,7 +200,7 @@ public class LoadController {
 		HolonElement ele = new HolonElement(next(i), Integer.parseInt(next(i)), Float.parseFloat(next(i)));
 
 		if (sav.equals("CVS")) {
-			ele.setActive(compare(Integer.parseInt(next(i))));
+			ele.setActive(convert(Integer.parseInt(next(i))));
 			objC.addElementIntoCanvasObject((HolonObject) mpC.searchByID(Integer.parseInt(obj)), ele);
 		} else
 			objC.addElementIntoCategoryObject(sav, obj, ele);
@@ -240,15 +240,19 @@ public class LoadController {
 	}
 
 	/**
-	 * 
+	 * Get the Next Element from an Iterator
 	 * @param i
 	 * @return
 	 */
 	public String next(Iterator<Object> i) {
 		return i.next().toString();
 	}
-
-	public boolean compare(int x) {
+	/**
+	 * converting saved Integers into Booleans
+	 * @param x
+	 * @return
+	 */
+	public boolean convert(int x) {
 		return x == 1 ? true : false;
 	}
 

+ 2 - 16
src/ui/controller/MultiPurposeController.java

@@ -31,12 +31,6 @@ public class MultiPurposeController {
 	 */
 	public Category searchCategory(String category) {
 
-		// for (Category cat : MODEL.getCategories()) {
-		// if (cat.getName().equals(category)) {
-		// return cat;
-		// }
-		// }
-		// return null;
 		Integer idx;
 
 		if ((idx = MODEL.getCgIdx().get(category)) == null || MODEL.getCgIdx().size() < 1 )
@@ -53,11 +47,7 @@ public class MultiPurposeController {
 	 * @return
 	 */
 	public CpsObject searchCategoryObject(Category category, String object) {
-		// for (CpsObject objects : list) {
-		// if (objects.getObjName().equals(object))
-		// return objects;
-		// }
-		// return null;
+
 		Integer idx;
 
 		if ((idx = category.getObjIdx().get(object)) == null || category.getObjIdx().size() < 1)
@@ -74,11 +64,7 @@ public class MultiPurposeController {
 	 * @return
 	 */
 	public CpsObject searchByID(int ID) {
-		// for (CpsObject objects : MODEL.getObjectsOnCanvas()) {
-		// if (objects.getID() == ID)
-		// return objects;
-		// }
-		// return null;
+
 		Integer idx;
 
 		if ((idx = MODEL.getCvsObjIdx().get(ID)) == null || MODEL.getCvsObjIdx().size() < 1)

+ 3 - 3
src/ui/view/MyCanvas.java

@@ -93,7 +93,7 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
 
 		// Selection
 		if (selectRect != null) {
-			g2.setColor(Color.GREEN);
+			g2.setColor(Color.BLUE);
 			g2.fillRect((int) selectRect.getX(), (int) selectRect.getY(), (int) selectRect.getWidth(),
 					(int) selectRect.getHeight());
 		}
@@ -121,7 +121,7 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
 
 		// Highlighted Edge
 		if (model.getSelectedObjectID() > 0) {
-			g2.setColor(Color.GREEN);
+			g2.setColor(Color.BLUE);
 			for (CpsEdge con : model.getEdgesOnCanvas()) {
 				if (con.getA().getID() == model.getSelectedObjectID()
 						|| con.getB().getID() == model.getSelectedObjectID() && con != edgeHighlight) {
@@ -135,7 +135,7 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
 				}
 			}
 		} else if (edgeHighlight != null) {
-			g2.setColor(Color.GREEN);
+			g2.setColor(Color.BLUE);
 			g2.drawLine(edgeHighlight.getA().getPosition().x + controller.getScaleDiv2(),
 					edgeHighlight.getA().getPosition().y + controller.getScaleDiv2(),
 					edgeHighlight.getB().getPosition().x + controller.getScaleDiv2(),