|
@@ -62,7 +62,7 @@ public class Control {
|
|
|
this.consoleController = new ConsoleController(model);
|
|
|
autoPath = System.getProperty("user.home") + "/HolonGUI/Autosave/";
|
|
|
File dest = new File(autoPath);
|
|
|
- //deleteDirectory(dest);
|
|
|
+ // deleteDirectory(dest);
|
|
|
dest.mkdirs();
|
|
|
try {
|
|
|
autoSave();
|
|
@@ -97,7 +97,8 @@ public class Control {
|
|
|
/**
|
|
|
* Search for Object by ID.
|
|
|
*
|
|
|
- * @param id the id of the Object
|
|
|
+ * @param id
|
|
|
+ * the id of the Object
|
|
|
* @return the CpsObject
|
|
|
*/
|
|
|
public AbstractCpsObject searchByID(int id) {
|
|
@@ -120,7 +121,8 @@ public class Control {
|
|
|
/**
|
|
|
* search for category.
|
|
|
*
|
|
|
- * @param cat name of the Category
|
|
|
+ * @param cat
|
|
|
+ * name of the Category
|
|
|
* @return the Category
|
|
|
*/
|
|
|
public Category searchCategory(String cat) {
|
|
@@ -128,7 +130,7 @@ public class Control {
|
|
|
}
|
|
|
|
|
|
/* Operations for Categories and Objects */
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* init default category and objects.
|
|
|
*/
|
|
@@ -153,7 +155,8 @@ public class Control {
|
|
|
* Category
|
|
|
* @param obj
|
|
|
* New Object Name
|
|
|
- * @param ele Array of Elements
|
|
|
+ * @param ele
|
|
|
+ * Array of Elements
|
|
|
* @param img
|
|
|
* the image Path
|
|
|
*/
|
|
@@ -468,7 +471,9 @@ public class Control {
|
|
|
public void calculateStateForCurrentTimeStep() {
|
|
|
simulationManager.reset();
|
|
|
simulationManager.calculateStateForTimeStep(model.getCurIteration());
|
|
|
- runAlgorithm(model, this);
|
|
|
+ if (model.getIsSimulation()) {
|
|
|
+ runAlgorithm(model, this);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -480,7 +485,9 @@ public class Control {
|
|
|
public void calculateStateForTimeStep(int x) {
|
|
|
simulationManager.reset();
|
|
|
simulationManager.calculateStateForTimeStep(x);
|
|
|
- runAlgorithm(model, this);
|
|
|
+ if (model.getIsSimulation()) {
|
|
|
+ runAlgorithm(model, this);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -644,42 +651,44 @@ public class Control {
|
|
|
public void setIsSimulation(boolean b) {
|
|
|
globalController.setIsSimulation(b);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* Set the Canvas X Size.
|
|
|
*
|
|
|
- * @param canvasX the cANVAS_X to set
|
|
|
+ * @param canvasX
|
|
|
+ * the cANVAS_X to set
|
|
|
*/
|
|
|
public void setCanvasX(int canvasX) {
|
|
|
globalController.setCanvasX(canvasX);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* Set the Canvas Y Size.
|
|
|
*
|
|
|
- * @param canvasY the cANVAS_Y to set
|
|
|
+ * @param canvasY
|
|
|
+ * the cANVAS_Y to set
|
|
|
*/
|
|
|
public void setCanvasY(int canvasY) {
|
|
|
globalController.setCanvasY(canvasY);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* Set the Algorithm.
|
|
|
*
|
|
|
- * @param obj the Algorithm
|
|
|
+ * @param obj
|
|
|
+ * the Algorithm
|
|
|
*/
|
|
|
public void setAlgorithm(Object obj) {
|
|
|
multiPurposeController.setAlgorithm(obj);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* Run the Algorithm.
|
|
|
*/
|
|
|
public void runAlgorithm(Model model, Control controller) {
|
|
|
if (model.getAlgorithm() != null) {
|
|
|
- ((interfaceTest)model.getAlgorithm()).RunAlgorithm(model, controller);
|
|
|
+ ((interfaceTest) model.getAlgorithm()).RunAlgorithm(model, controller);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|