Control.java 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885
  1. package ui.controller;
  2. import java.awt.Color;
  3. import java.awt.Point;
  4. import java.io.File;
  5. import java.io.IOException;
  6. import java.util.ArrayList;
  7. import cpsAlgorithm.*;
  8. import classes.Category;
  9. import classes.CpsEdge;
  10. import classes.CpsNode;
  11. import classes.CpsUpperNode;
  12. import classes.AbstractCpsObject;
  13. import classes.HolonElement;
  14. import classes.HolonObject;
  15. import classes.HolonSwitch;
  16. import interfaces.CategoryListener;
  17. import ui.model.Model;
  18. import ui.view.MyCanvas;
  19. /**
  20. * The Class represents the controller in the model, controller view Pattern.
  21. *
  22. * @author Gruppe14
  23. *
  24. */
  25. public class Control {
  26. private Model model;
  27. private final ConsoleController consoleController;
  28. private final MultiPurposeController multiPurposeController;
  29. private final CategoryController categoryController;
  30. private final ObjectController objectController;
  31. private final CanvasController canvasController;
  32. private final GlobalController globalController;
  33. private final StoreController storeController;
  34. private final LoadController loadController;
  35. private final AutoSaveController autoSaveController;
  36. private SimulationManager simulationManager;
  37. private final StatsController statsController;
  38. private final NodeController nodeController;
  39. private final ClipboardController clipboardController;
  40. private String autoPath = "";
  41. /**
  42. * Constructor.
  43. *
  44. * @param model
  45. * the Model
  46. */
  47. public Control(Model model) {
  48. this.model = model;
  49. this.multiPurposeController = new MultiPurposeController(model);
  50. this.categoryController = new CategoryController(model, multiPurposeController);
  51. this.objectController = new ObjectController(model, multiPurposeController);
  52. this.canvasController = new CanvasController(model, multiPurposeController);
  53. this.globalController = new GlobalController(model);
  54. this.storeController = new StoreController(model);
  55. this.nodeController = new NodeController(model, canvasController, multiPurposeController);
  56. this.loadController = new LoadController(model, categoryController, canvasController, objectController,
  57. nodeController, multiPurposeController);
  58. this.simulationManager = new SimulationManager(model);
  59. this.autoSaveController = new AutoSaveController(model);
  60. this.consoleController = new ConsoleController(model);
  61. this.statsController = new StatsController(model);
  62. this.clipboardController = new ClipboardController(model, storeController, loadController);
  63. autoPath = System.getProperty("user.home") + "/HolonGUI/Autosave/";
  64. File dest = new File(autoPath);
  65. // deleteDirectory(dest);
  66. dest.mkdirs();
  67. try {
  68. autoSave();
  69. } catch (IOException e) {
  70. // TODO Auto-generated catch block
  71. e.printStackTrace();
  72. }
  73. }
  74. /**
  75. * Delete a Directory.
  76. *
  77. * @param path
  78. * to delete
  79. */
  80. public void deleteDirectory(File path) {
  81. if (path.exists()) {
  82. File[] files = path.listFiles();
  83. for (int i = 0; i < files.length; i++) {
  84. if (files[i].isDirectory()) {
  85. deleteDirectory(files[i]);
  86. } else {
  87. files[i].delete();
  88. }
  89. }
  90. path.delete();
  91. }
  92. }
  93. /* Operations for searching */
  94. /**
  95. * Search for Object by ID.
  96. *
  97. * @param id
  98. * the id of the Object
  99. * @return the CpsObject
  100. */
  101. public AbstractCpsObject searchByID(int id) {
  102. return multiPurposeController.searchByID(id);
  103. }
  104. /**
  105. * Search for Object by ID in upperNode
  106. *
  107. * @param id
  108. * the id of the Object
  109. * @return the CpsObject
  110. */
  111. public AbstractCpsObject searchByIDUpperNode(int id, CpsUpperNode upperNode) {
  112. return multiPurposeController.searchByIDUpperNode(id, upperNode);
  113. }
  114. /**
  115. * Search for Object in a Category.
  116. *
  117. * @param category
  118. * name of the Category
  119. * @param object
  120. * Name of the Object
  121. * @return The Object
  122. */
  123. public AbstractCpsObject searchCategoryObject(String category, String object) {
  124. return multiPurposeController.searchCatObj(multiPurposeController.searchCat(category), object);
  125. }
  126. /**
  127. * search for category.
  128. *
  129. * @param cat
  130. * name of the Category
  131. * @return the Category
  132. */
  133. public Category searchCategory(String cat) {
  134. return multiPurposeController.searchCat(cat);
  135. }
  136. /* Operations for Categories and Objects */
  137. /**
  138. * init default category and objects.
  139. */
  140. public void resetCategorys() {
  141. categoryController.initCategories();
  142. }
  143. /**
  144. * Adds New Category into Model.
  145. *
  146. * @param cat
  147. * name of the new Category
  148. */
  149. public void addCategory(String cat) {
  150. categoryController.addNewCategory(cat);
  151. }
  152. /**
  153. * Add new Holon Object to a Category.
  154. *
  155. * @param cat
  156. * Category
  157. * @param obj
  158. * New Object Name
  159. * @param ele
  160. * Array of Elements
  161. * @param img
  162. * the image Path
  163. */
  164. public void addObject(Category cat, String obj, ArrayList<HolonElement> ele, String img) {
  165. categoryController.addNewHolonObject(cat, obj, ele, img);
  166. }
  167. /**
  168. * Add new Holon Transformer to a Category.
  169. *
  170. * @param cat
  171. * Category
  172. * @param obj
  173. * New Object Name
  174. */
  175. public void addTransformer(Category cat, String obj) {
  176. categoryController.addNewHolonTransformer(cat, obj, "/Images/transformer-1.png");
  177. }
  178. /**
  179. * Add new Holon Switch to a Category.
  180. *
  181. * @param cat
  182. * Category
  183. * @param obj
  184. * New Object Name
  185. */
  186. public void addSwitch(Category cat, String obj) {
  187. categoryController.addNewHolonSwitch(cat, obj, "/Images/switch-on.png");
  188. }
  189. /**
  190. * delete a given Category.
  191. *
  192. * @param cat
  193. * the Category
  194. */
  195. public void deleteCategory(String cat) {
  196. categoryController.deleteCategory(cat);
  197. }
  198. /**
  199. * Delete an Object from a Category.
  200. *
  201. * @param cat
  202. * the Category
  203. * @param obj
  204. * the Object
  205. */
  206. public void delObjectCategory(String cat, String obj) {
  207. categoryController.deleteObject(cat, obj);
  208. }
  209. /**
  210. * deletes a selectedObject.
  211. *
  212. * @param obj
  213. * Cpsobject
  214. */
  215. public void deleteSelectedObject(AbstractCpsObject obj) {
  216. objectController.deleteSelectedObject(obj);
  217. }
  218. /**
  219. * add an Object to selectedObject.
  220. *
  221. * @param obj
  222. * AbstractCpsobject
  223. */
  224. public void addSelectedObject(AbstractCpsObject obj) {
  225. objectController.addSelectedObject(obj);
  226. }
  227. /* Operations for Canvas */
  228. /**
  229. * Add an edge to the Canvas.
  230. *
  231. * @param edge
  232. * the edge
  233. */
  234. public void addEdgeOnCanvas(CpsEdge edge) {
  235. canvasController.addEdgeOnCanvas(edge);
  236. try {
  237. autoSave();
  238. } catch (IOException e) {
  239. // TODO Auto-generated catch block
  240. e.printStackTrace();
  241. }
  242. }
  243. /**
  244. * Removes an Edge from the Canvas.
  245. *
  246. * @param edge
  247. * the edge to remove
  248. */
  249. public void removeEdgesOnCanvas(CpsEdge edge) {
  250. canvasController.removeEdgesOnCanvas(edge);
  251. try {
  252. autoSave();
  253. } catch (IOException e) {
  254. // TODO Auto-generated catch block
  255. e.printStackTrace();
  256. }
  257. }
  258. /**
  259. * Set the selected Edge.
  260. *
  261. * @param edge
  262. * that is selected
  263. */
  264. public void setSelecteEdge(CpsEdge edge) {
  265. model.setSelectedEdge(edge);
  266. }
  267. /**
  268. * Add a new Object.
  269. *
  270. * @param object
  271. * the Object
  272. */
  273. public void addObjectCanvas(AbstractCpsObject object) {
  274. canvasController.addNewObject(object);
  275. if (!(object instanceof CpsNode)) {
  276. try {
  277. autoSave();
  278. } catch (IOException e) {
  279. // TODO Auto-generated catch block
  280. e.printStackTrace();
  281. }
  282. }
  283. }
  284. /**
  285. * Returns the ID of the selected Object 0 = no Object is selected.
  286. *
  287. * @param id
  288. * the ID of the selected Object
  289. */
  290. public void setSelectedObjectID(int id) {
  291. objectController.setSelectedObjectID(id);
  292. }
  293. /**
  294. * Deletes an CpsObject on the Canvas and its connections.
  295. *
  296. * @param obj
  297. * AbstractCpsObject
  298. * @param save
  299. */
  300. public void delCanvasObject(AbstractCpsObject obj, boolean save) {
  301. canvasController.deleteObjectOnCanvas(obj);
  302. if (obj instanceof CpsUpperNode)
  303. canvasController.bfsNodeCleaner((CpsUpperNode) obj);
  304. if (save)
  305. try {
  306. autoSave();
  307. } catch (IOException e) {
  308. // TODO Auto-generated catch block
  309. e.printStackTrace();
  310. }
  311. }
  312. /* Operations for Objects and Elements */
  313. /**
  314. * Add a new Element into a Object on the Canvas.
  315. *
  316. * @param id
  317. * the Object ID
  318. * @param ele
  319. * the Name of the Element
  320. * @param amount
  321. * the Amount
  322. * @param energy
  323. * the Energy
  324. */
  325. public void addElementCanvasObject(int id, String ele, int amount, float energy) {
  326. objectController.addNewElementIntoCanvasObject(id, ele, amount, energy);
  327. }
  328. /**
  329. * Add a new Element into a Object in Category.
  330. *
  331. * @param catName
  332. * the Category
  333. * @param objName
  334. * the Object
  335. * @param eleName
  336. * the Element Name
  337. * @param amount
  338. * the amount
  339. * @param energy
  340. * the Energy
  341. */
  342. public void addElementCategoryObject(String catName, String objName, String eleName, int amount, float energy) {
  343. objectController.addNewElementIntoCategoryObject(catName, objName, eleName, amount, energy);
  344. }
  345. /**
  346. * deletes a Element from a given Canvas Object.
  347. *
  348. * @param id
  349. * the ID
  350. * @param elementid
  351. * the Element ID
  352. */
  353. public void deleteElementCanvas(int id, int elementid) {
  354. objectController.deleteElementInCanvas(id, elementid);
  355. }
  356. /**
  357. * deletes a Element from a given Object.
  358. *
  359. * @param obj
  360. * the Oject
  361. * @param ele
  362. * the Element
  363. */
  364. public void deleteElementCanvas(HolonObject obj, HolonElement ele) {
  365. objectController.deleteElement(obj, ele);
  366. }
  367. /**
  368. * Sets the ClipboardObjects.
  369. *
  370. * @param list
  371. * Array of Objects
  372. */
  373. public void setClipboardObjects(ArrayList<AbstractCpsObject> list) {
  374. model.setClipboradObjects(list);
  375. }
  376. /* Global Operations */
  377. /**
  378. * Add a SubNetColor.
  379. *
  380. * @param c
  381. * the Color
  382. */
  383. public void addSubNetColor(Color c) {
  384. globalController.addSubNetColor(c);
  385. }
  386. /**
  387. * Returns SCALE.
  388. *
  389. * @return SCALE
  390. */
  391. public int getScale() {
  392. return globalController.getScale();
  393. }
  394. /**
  395. * Returns SCALE Divided by 2.
  396. *
  397. * @return SCALE Divided by 2
  398. */
  399. public int getScaleDiv2() {
  400. return globalController.getScaleDiv2();
  401. }
  402. /**
  403. * Changes the value of SCALE and SCALEDIV2.
  404. *
  405. * @param s
  406. * Scale
  407. */
  408. public void setScale(int s) {
  409. globalController.setScale(s);
  410. }
  411. /**
  412. * sets the current Iteration.
  413. *
  414. * @param curit
  415. * the current Iteration
  416. */
  417. public void setCurIteration(int curit) {
  418. globalController.setCurIteration(curit);
  419. }
  420. /**
  421. * Writes the current State of the Modelling into a JSON File which can be
  422. * loaded.
  423. *
  424. * @param path
  425. * the Path
  426. *
  427. * @throws IOException
  428. * exception
  429. */
  430. public void saveFile(String path) throws IOException {
  431. storeController.writeSaveFile(path);
  432. }
  433. /**
  434. * Reads the the JSON File and load the state into the Model.
  435. *
  436. * @param path
  437. * the Path
  438. * @throws IOException
  439. * exception
  440. */
  441. public void loadFile(String path) throws IOException {
  442. loadController.readJson(path);
  443. }
  444. /**
  445. * Init the CategoryListener.
  446. *
  447. * @param catLis
  448. * the CategoryListener
  449. */
  450. public void initListener(CategoryListener catLis) {
  451. categoryController.addCategoryListener(catLis);
  452. }
  453. /**
  454. * calculates the flow of the edges and the supply for objects for the
  455. * current Timestep.
  456. */
  457. public void calculateStateForCurrentTimeStep() {
  458. simulationManager.reset();
  459. simulationManager.calculateStateForTimeStep(model.getCurIteration());
  460. }
  461. /**
  462. * calculates the flow of the edges and the supply for objects.
  463. *
  464. * @param x
  465. * current Iteration
  466. */
  467. public void calculateStateForTimeStep(int x) {
  468. simulationManager.reset();
  469. simulationManager.calculateStateForTimeStep(x);
  470. }
  471. /**
  472. * Set the Canvas.
  473. *
  474. * @param can
  475. * the Canvas
  476. */
  477. public void setCanvas(MyCanvas can) {
  478. simulationManager.setCanvas(can);
  479. }
  480. /**
  481. * make an autosave.
  482. *
  483. * @throws IOException
  484. * Exception
  485. */
  486. public void autoSave() throws IOException {
  487. autoSaveController.increaseAutoSaveNr();
  488. storeController.writeAutosaveFile(autoPath + autoSaveController.getAutoSaveNr());
  489. if (autoSaveController.allowed()) {
  490. new File(autoPath + (autoSaveController.getAutoSaveNr() - globalController.getNumbersOfSaves())).delete();
  491. }
  492. }
  493. /**
  494. * Returns the undo save.
  495. *
  496. * @return the undo save
  497. */
  498. public String getUndoSave() {
  499. autoSaveController.decreaseAutoSaveNr();
  500. if (!new File(autoPath + (autoSaveController.getAutoSaveNr())).exists()) {
  501. autoSaveController.increaseAutoSaveNr();
  502. }
  503. return autoPath + (autoSaveController.getAutoSaveNr());
  504. }
  505. /**
  506. * Returns the redo save.
  507. *
  508. * @return the redo save
  509. */
  510. public String getRedoSave() {
  511. autoSaveController.increaseAutoSaveNr();
  512. if (!new File(autoPath + (autoSaveController.getAutoSaveNr())).exists()) {
  513. autoSaveController.decreaseAutoSaveNr();
  514. }
  515. return autoPath + (autoSaveController.getAutoSaveNr());
  516. }
  517. /**
  518. * Paste all Selected Objects.
  519. *
  520. * @param point
  521. * the mouse Position
  522. */
  523. public void pasteObjects(Point point) {
  524. canvasController.pasteObjects(point);
  525. try {
  526. autoSave();
  527. } catch (IOException e) {
  528. // TODO Auto-generated catch block
  529. e.printStackTrace();
  530. }
  531. }
  532. /**
  533. * Cut all Selected Objects.
  534. */
  535. public void cutObjects() {
  536. canvasController.cutObjects();
  537. try {
  538. autoSave();
  539. } catch (IOException e) {
  540. // TODO Auto-generated catch block
  541. e.printStackTrace();
  542. }
  543. }
  544. /**
  545. * Getter for Model.
  546. *
  547. * @return the Model
  548. */
  549. public Model getModel() {
  550. return model;
  551. }
  552. /**
  553. * get the Simulation Manager.
  554. *
  555. * @return the Simulation Manager
  556. */
  557. public SimulationManager getSimManager() {
  558. return simulationManager;
  559. }
  560. /**
  561. * Getter for selected CpsObject.
  562. *
  563. * @param text
  564. * String the Text
  565. * @param color
  566. * the color of the Text
  567. * @param p
  568. * size of the Text
  569. * @param bold
  570. * bold or not
  571. * @param italic
  572. * italic or not
  573. * @param nl
  574. * new line or not
  575. *
  576. */
  577. public void addTextToConsole(String text, Color color, int p, boolean bold, boolean italic, boolean nl) {
  578. consoleController.addTextToConsole(text, color, p, bold, italic, nl);
  579. }
  580. /**
  581. * Print Text on the console in black and font size 12.
  582. *
  583. * @param text
  584. * String the Text
  585. */
  586. public void addTextToConsole(String text) {
  587. consoleController.addTextToConsole(text);
  588. }
  589. /**
  590. * Clears the console.
  591. */
  592. public void clearConsole() {
  593. consoleController.clearConsole();
  594. }
  595. /**
  596. * Set the timerSpeed.
  597. *
  598. * @param t
  599. * interval in ms
  600. */
  601. public void setTimerSpeed(int t) {
  602. globalController.setTimerSpeed(t);
  603. }
  604. /**
  605. * Set if its simulating or not.
  606. *
  607. * @param b
  608. * isSimulation
  609. */
  610. public void setIsSimulation(boolean b) {
  611. globalController.setIsSimulation(b);
  612. }
  613. /**
  614. * Set the Canvas X Size.
  615. *
  616. * @param canvasX
  617. * the cANVAS_X to set
  618. */
  619. public void setCanvasX(int canvasX) {
  620. globalController.setCanvasX(canvasX);
  621. }
  622. /**
  623. * Set the Canvas Y Size.
  624. *
  625. * @param canvasY
  626. * the cANVAS_Y to set
  627. */
  628. public void setCanvasY(int canvasY) {
  629. globalController.setCanvasY(canvasY);
  630. }
  631. public void setMaxCapacity(float cap) {
  632. globalController.setMaxCapacity(cap);
  633. }
  634. /**
  635. * Set the Algorithm.
  636. *
  637. * @param obj
  638. * the Algorithm
  639. */
  640. public void setAlgorithm(Object obj) {
  641. multiPurposeController.setAlgorithm(obj);
  642. }
  643. /**
  644. * Run the Algorithm.
  645. */
  646. public void runAlgorithm(Model model, Control controller) {
  647. if (model.getAlgorithm() != null) {
  648. ((CpsAlgorithm) model.getAlgorithm()).RunAlgorithm(model, controller);
  649. }
  650. }
  651. // ========================= MANAGING TRACKED OBJECTS ====================
  652. public void setTrackingObj(ArrayList<AbstractCpsObject> objArr) {
  653. statsController.setTrackingObj(objArr);
  654. }
  655. public ArrayList<AbstractCpsObject> getTrackingObj() {
  656. return statsController.getTrackingObj();
  657. }
  658. public void addTrackingObj(AbstractCpsObject obj) {
  659. statsController.addTrackingObj(obj);
  660. }
  661. public void removeTrackingObj(AbstractCpsObject obj) {
  662. statsController.removeTrackingObj(obj);
  663. }
  664. // ========================== MANAGING TRACKED OBJECTS END ================
  665. /**
  666. * Controlling Nodes of Nodes
  667. */
  668. public void addUpperNode(String nodeName, CpsUpperNode upperNode, ArrayList<AbstractCpsObject> toGroup) {
  669. nodeController.doUpperNode(nodeName, upperNode, toGroup);
  670. try {
  671. autoSave();
  672. } catch (IOException e) {
  673. // TODO Auto-generated catch block
  674. e.printStackTrace();
  675. }
  676. }
  677. public void delUpperNode(CpsUpperNode node, CpsUpperNode upperNode) {
  678. nodeController.undoUpperNode(node, upperNode);
  679. try {
  680. autoSave();
  681. } catch (IOException e) {
  682. // TODO Auto-generated catch block
  683. e.printStackTrace();
  684. }
  685. }
  686. public void addObjUpperNode(AbstractCpsObject object, CpsUpperNode upperNode) {
  687. nodeController.addObjectInUpperNode(object, upperNode);
  688. try {
  689. autoSave();
  690. } catch (IOException e) {
  691. // TODO Auto-generated catch block
  692. e.printStackTrace();
  693. }
  694. }
  695. public void delObjUpperNode(AbstractCpsObject object, CpsUpperNode upperNode) {
  696. nodeController.deleteObjectInUpperNode(object, upperNode);
  697. if (object instanceof CpsUpperNode)
  698. canvasController.bfsNodeCleaner((CpsUpperNode) object);
  699. try {
  700. autoSave();
  701. } catch (IOException e) {
  702. // TODO Auto-generated catch block
  703. e.printStackTrace();
  704. }
  705. }
  706. public void addEdgeUpperNode(CpsEdge edge, CpsUpperNode upperNode) {
  707. nodeController.addEdge(edge, upperNode);
  708. try {
  709. autoSave();
  710. } catch (IOException e) {
  711. // TODO Auto-generated catch block
  712. e.printStackTrace();
  713. }
  714. }
  715. public void delEdgeUpperNode(CpsEdge edge, CpsUpperNode upperNode) {
  716. nodeController.deleteEdge(edge, upperNode);
  717. try {
  718. autoSave();
  719. } catch (IOException e) {
  720. // TODO Auto-generated catch block
  721. e.printStackTrace();
  722. }
  723. }
  724. public void connectNodes(CpsEdge edge, CpsUpperNode upperNode) {
  725. nodeController.connectNodes(edge, upperNode);
  726. try {
  727. autoSave();
  728. } catch (IOException e) {
  729. // TODO Auto-generated catch block
  730. e.printStackTrace();
  731. }
  732. }
  733. public void disconnectNodes(CpsEdge edge, CpsUpperNode upperNode) {
  734. nodeController.disconnectNodes(edge, upperNode);
  735. try {
  736. autoSave();
  737. } catch (IOException e) {
  738. // TODO Auto-generated catch block
  739. e.printStackTrace();
  740. }
  741. }
  742. /**
  743. * Get the number of HolonObjects in the given List
  744. *
  745. * @param list
  746. */
  747. public int getNumberHolonObjects(ArrayList<AbstractCpsObject> list) {
  748. return objectController.getNumberHolonObjects(list);
  749. }
  750. /**
  751. * Get the number of HolonObjects with the given state in the given List
  752. *
  753. * @param list
  754. * @param state
  755. */
  756. public int getNumberStateObjects(ArrayList<AbstractCpsObject> list, int state) {
  757. return objectController.getNumberStateObjects(list, state);
  758. }
  759. /**
  760. * Changes the value of HolonBodySCALE
  761. *
  762. * @param s
  763. * HolonBodyScale
  764. */
  765. public void setHolonBodyScale(int s) {
  766. globalController.setHolonBodyScale(s);
  767. }
  768. /**
  769. * Returns HolonBodySCALE.
  770. *
  771. * @return SCALE
  772. */
  773. public int getHolonBodyScale() {
  774. return globalController.getHolonBodyScale();
  775. }
  776. /**
  777. * Sets the ID of the selected HolonBody
  778. *
  779. * @param i
  780. * ID of the selected HolonBody
  781. */
  782. public void addSelectedHolonBody(int i) {
  783. objectController.addSelectedHolonBody(i);
  784. }
  785. /**
  786. * Copy all Selected Objects.
  787. */
  788. public void copy(CpsUpperNode upperNode) {
  789. clipboardController.copy(upperNode);
  790. }
  791. public void getObjectsInDepth() {
  792. clipboardController.getObjectsInDepth();
  793. }
  794. }