|
@@ -0,0 +1,62 @@
|
|
|
+package API;
|
|
|
+
|
|
|
+import java.awt.Color;
|
|
|
+import java.util.ArrayList;
|
|
|
+
|
|
|
+import classes.CpsObject;
|
|
|
+import classes.subNet;
|
|
|
+import ui.controller.Control;
|
|
|
+import ui.controller.SimulationManager;
|
|
|
+
|
|
|
+public class API {
|
|
|
+ private Control controller;
|
|
|
+ private SimulationManager simManager;
|
|
|
+
|
|
|
+ public API(Control cont){
|
|
|
+ this.controller = cont;
|
|
|
+ this.simManager = controller.getSimManager();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * a SubNet contains all Components
|
|
|
+ * @return all SubNets on Canvas
|
|
|
+ */
|
|
|
+ public ArrayList<subNet> getSubNets(){
|
|
|
+ simManager.searchForSubNets();
|
|
|
+ return simManager.getSubNets();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @return all Objects on Canvas in no specific order
|
|
|
+ */
|
|
|
+ public ArrayList<CpsObject> getAllObjectsOnCanvas(){
|
|
|
+
|
|
|
+ return controller.getModel().getObjectsOnCanvas();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * prints a given text on the console
|
|
|
+ * @param text
|
|
|
+ */
|
|
|
+ public void consolePrint(String text){
|
|
|
+ controller.addTextToConsole(text);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * prints a given text on the console with more details
|
|
|
+ * @param text: the text that will be printed
|
|
|
+ * @param color: the color the text will have
|
|
|
+ * @param p: font size
|
|
|
+ * @param bold: true or false
|
|
|
+ * @param italic: true or false
|
|
|
+ * @param nl: new line after text
|
|
|
+ */
|
|
|
+ public void consolePrint(String text, Color color, int p, boolean bold, boolean italic, boolean nl){
|
|
|
+ controller.addTextToConsole(text, color, p, bold, italic, nl);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setBorderColorForObject(CpsObject toChange, Color color){
|
|
|
+ }
|
|
|
+
|
|
|
+}
|