Model.java 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941
  1. package ui.model;
  2. import java.awt.Color;
  3. import java.util.ArrayList;
  4. import java.util.HashMap;
  5. import java.util.Hashtable;
  6. import java.util.LinkedList;
  7. import java.util.List;
  8. import javax.swing.JTable;
  9. import com.google.gson.JsonObject;
  10. import classes.AbstractCpsObject;
  11. import classes.Category;
  12. import classes.CpsEdge;
  13. import classes.CpsUpperNode;
  14. import classes.HolonElement;
  15. import classes.HolonSwitch;
  16. import interfaces.CategoryListener;
  17. import interfaces.GraphListener;
  18. import interfaces.ObjectListener;
  19. import ui.view.Console;
  20. import ui.view.DefaulTable;
  21. import ui.view.PropertyTable;
  22. import ui.view.StatisticGraphPanel;
  23. /**
  24. * The Class Model is the class where everything is saved. All changes made to
  25. * the Data is managed via a controller.
  26. *
  27. * @author Gruppe14
  28. *
  29. */
  30. public class Model {
  31. // Canvas Attributes
  32. private String imgPath = "";
  33. private int backgroundMode = 0;
  34. private int backgroundWidth = 0;
  35. private int backgroundHeight = 0;
  36. private int canvasX = 1000;
  37. private int canvasY = 1000;
  38. // Global Variables
  39. private static int sCALE = 50; // Picture Scale
  40. private static int sCALEdIV2 = sCALE / 2;
  41. private static int holonBodysCALE = 100; // Picture Scale
  42. private static final int ITERATIONS = 100;
  43. private int curIteration = 0;
  44. private LinkedList<Color> subNetColors = new LinkedList<>();
  45. // ID of the Selected Object
  46. private AbstractCpsObject selectedCpsObject = null;
  47. private HolonElement selectedHolonElement;
  48. private CpsEdge selectedEdge;
  49. private ArrayList<AbstractCpsObject> selectedObjects = new ArrayList<AbstractCpsObject>();
  50. private ArrayList<AbstractCpsObject> clipboardObjects = new ArrayList<AbstractCpsObject>();
  51. private Console console;
  52. private HashMap<Integer, ArrayList<HolonElement>> eleToDelete;
  53. // Capacity for Edge
  54. private float maxCapacity;
  55. // Table for HolonElements --> all cells are editable
  56. private JTable tableHolonElement;
  57. private ArrayList<GraphListener> graphListeners = new ArrayList<GraphListener>();
  58. // Iteration Speed
  59. private int timerSpeed = 1000;
  60. private int selectedID = 0;
  61. // number of the current autosave
  62. private int autoSaveNr = -1;
  63. // number of max simultaneous autosaves
  64. private int numberOfSaves = 35;
  65. // if the simulation is running and has not been reseted
  66. private boolean isSimRunning = false;
  67. // if the console log of the program should be displayed
  68. private boolean showConsoleLog = true;
  69. /*
  70. * Array of all categories in the model. It is set by default with the
  71. * categories ENERGY, BUILDINGS and COMPONENTS
  72. */
  73. private ArrayList<Category> categories;
  74. /*
  75. * Array of all HolonObj and HolonSwitches, that should be tracked through
  76. * out the statistics tab
  77. */
  78. private ArrayList<AbstractCpsObject> trackedObjects;
  79. /*
  80. * Array of all CpsObjects in our canvas. It is set by default as an empty
  81. * list.
  82. */
  83. private ArrayList<AbstractCpsObject> objectsOnCanvas;
  84. private HashMap<String, Integer> cgIdx;
  85. private HashMap<Integer, Integer> cvsObjIdx;
  86. /*
  87. * Array of all CpsObjects in our canvas. It is set by default as an empty
  88. * list.
  89. */
  90. private ArrayList<CpsEdge> edgesOnCanvas;
  91. /*
  92. * Array for all Listeners
  93. */
  94. private List<CategoryListener> categoryListeners;
  95. private List<ObjectListener> objectListeners;
  96. private PropertyTable tableModelHolonElementMulti;
  97. private PropertyTable tableModelHolonElementSingle;
  98. private DefaulTable tableModelProperties;
  99. public String[] colNames = { "Field", "Information" };
  100. /*
  101. * Object that runs the Algorithm
  102. */
  103. private Object algorithm = null;
  104. private int selectedHolonBody;
  105. // Statistic Graph Data
  106. private Hashtable<String, StatisticGraphPanel> statisticGraphTable = new Hashtable<String, StatisticGraphPanel>();
  107. private ArrayList<JsonObject> statisticData = new ArrayList<>();
  108. /**
  109. * Constructor for the model. It initializes the categories and
  110. * objectsOnCanvas by default values. Listeners are also initialized by
  111. * default values.
  112. */
  113. public Model() {
  114. setCategories(new ArrayList<Category>());
  115. setObjectsOnCanvas(new ArrayList<AbstractCpsObject>());
  116. setEdgesOnCanvas(new ArrayList<CpsEdge>());
  117. setCategoryListeners(new LinkedList<CategoryListener>());
  118. setObjectListeners(new LinkedList<ObjectListener>());
  119. setCgIdx(new HashMap<String, Integer>());
  120. setCvsObjIdx(new HashMap<Integer, Integer>());
  121. setClipboradObjects(new ArrayList<AbstractCpsObject>());
  122. setTrackingObj(new ArrayList<AbstractCpsObject>());
  123. setEleToDelete(new HashMap<Integer, ArrayList<HolonElement>>());
  124. setSingleTable(new PropertyTable());
  125. setMultiTable(new PropertyTable());
  126. setPropertyTable(new DefaulTable(1000, colNames.length));
  127. getPropertyTable().setColumnIdentifiers(colNames);
  128. setTableHolonElement(new JTable());
  129. }
  130. /**
  131. * Returns all Categories.
  132. *
  133. * @return the categories
  134. */
  135. public ArrayList<Category> getCategories() {
  136. return categories;
  137. }
  138. /**
  139. * Sets all Categories.
  140. *
  141. * @param categories
  142. * the categories to set
  143. */
  144. public void setCategories(ArrayList<Category> categories) {
  145. this.categories = categories;
  146. }
  147. /**
  148. * Transform the Arraylist of categories into a string of all objectName
  149. * with a separation (',') between each name.
  150. *
  151. * @return String of all names separeted by ','
  152. */
  153. public String toStringCat() {
  154. String text = "";
  155. for (int i = 0; i < categories.size(); i++) {
  156. if (text == "") {
  157. text = categories.get(i).getName();
  158. } else {
  159. text = text + ", " + categories.get(i).getName();
  160. }
  161. }
  162. return text;
  163. }
  164. /**
  165. * Returns all Objects on the Canvas.
  166. *
  167. * @return the objectsOnCanvas
  168. */
  169. public ArrayList<AbstractCpsObject> getObjectsOnCanvas() {
  170. return objectsOnCanvas;
  171. }
  172. /**
  173. * Sets all Objects on the Canvas.
  174. *
  175. * @param objectsOnCanvas
  176. * the objectsOnCanvas to set
  177. */
  178. public void setObjectsOnCanvas(ArrayList<AbstractCpsObject> objectsOnCanvas) {
  179. this.objectsOnCanvas = objectsOnCanvas;
  180. }
  181. /**
  182. * Get all Edges on the Canvas.
  183. *
  184. * @return the objectsOnCanvas
  185. */
  186. public ArrayList<CpsEdge> getEdgesOnCanvas() {
  187. return edgesOnCanvas;
  188. }
  189. /**
  190. * Adds an Edge to The Canvas.
  191. *
  192. * @param edge
  193. * the edgesOnCanvas to add
  194. */
  195. public void addEdgeOnCanvas(CpsEdge edge) {
  196. this.edgesOnCanvas.add(edge);
  197. }
  198. /**
  199. * Remove an edge from the Canvas.
  200. *
  201. * @param edge
  202. * the edge to remove
  203. */
  204. public void removeEdgesOnCanvas(CpsEdge edge) {
  205. this.edgesOnCanvas.remove(edge);
  206. }
  207. /**
  208. * Sets the edges on the Canvas.
  209. *
  210. * @param arrayList
  211. * the edgesOnCanvas to set
  212. */
  213. public void setEdgesOnCanvas(ArrayList<CpsEdge> arrayList) {
  214. this.edgesOnCanvas = arrayList;
  215. }
  216. /**
  217. * Returns the ObjectListener.
  218. *
  219. * @return the objectListeners
  220. */
  221. public List<ObjectListener> getObjectListeners() {
  222. return objectListeners;
  223. }
  224. /**
  225. * Sets the ObjectListener.
  226. *
  227. * @param linkedList
  228. * the objectListeners to set
  229. */
  230. public void setObjectListeners(LinkedList<ObjectListener> linkedList) {
  231. this.objectListeners = linkedList;
  232. }
  233. /**
  234. * Returns the CategorieListener.
  235. *
  236. * @return the categoryListeners
  237. */
  238. public List<CategoryListener> getCategoryListeners() {
  239. return categoryListeners;
  240. }
  241. /**
  242. * Sets the CategorieListener.
  243. *
  244. * @param linkedList
  245. * the categoryListeners to set
  246. */
  247. public void setCategoryListeners(LinkedList<CategoryListener> linkedList) {
  248. this.categoryListeners = linkedList;
  249. }
  250. /**
  251. * Set the ID of the selected Object 0 = no Object is selected.
  252. *
  253. * @param id
  254. * the ID
  255. *
  256. */
  257. public void setSelectedObjectID(int id) {
  258. this.selectedID = id;
  259. }
  260. /**
  261. * Returns the ID of the selected Object 0 = no Object is selected.
  262. *
  263. * @return ID
  264. */
  265. public int getSelectedObjectID() {
  266. return selectedID;
  267. }
  268. /**
  269. * Returns the Selected Cps Object.
  270. *
  271. * @return selected Cps Object
  272. */
  273. public AbstractCpsObject getSelectedCpsObject() {
  274. return selectedCpsObject;
  275. }
  276. /**
  277. * Set the Selected Objecs.
  278. *
  279. * @param selectedCpsObject
  280. * Objects that are selected
  281. */
  282. public void setSelectedCpsObject(AbstractCpsObject selectedCpsObject) {
  283. this.selectedCpsObject = selectedCpsObject;
  284. }
  285. /**
  286. * Returns all selected Objects on the Canvas.
  287. *
  288. * @return The selected Objects
  289. */
  290. public ArrayList<AbstractCpsObject> getSelectedCpsObjects() {
  291. return selectedObjects;
  292. }
  293. /**
  294. * Returns all selected Objects on the Canvas.
  295. *
  296. * @return The selected Objects
  297. */
  298. public void setSelectedCpsObjects(ArrayList<AbstractCpsObject> arr) {
  299. this.selectedObjects = arr;
  300. }
  301. /**
  302. * Returns the Selected Holon Element.
  303. *
  304. * @return selected Holon Element
  305. */
  306. public HolonElement getSelectedHolonElement() {
  307. return selectedHolonElement;
  308. }
  309. /**
  310. * Sets the Selecte HolonElement.
  311. *
  312. * @param selectedHolonElement
  313. * that is Selected
  314. */
  315. public void setSelectedHolonElement(HolonElement selectedHolonElement) {
  316. this.selectedHolonElement = selectedHolonElement;
  317. }
  318. /**
  319. * Returns the sCale (Scale for the Images).
  320. *
  321. * @return sCALE
  322. */
  323. public int getScale() {
  324. return sCALE;
  325. }
  326. /**
  327. * Returns sCALEdIV2 (The Scale divided by 2).
  328. *
  329. * @return sCALEdIV2
  330. */
  331. public int getScaleDiv2() {
  332. return sCALEdIV2;
  333. }
  334. /**
  335. * Sets the Image Scale.
  336. *
  337. * @param scale
  338. * for the image
  339. */
  340. public void setScale(int scale) {
  341. sCALE = scale;
  342. sCALEdIV2 = sCALE / 2;
  343. }
  344. /**
  345. * Returns ITERATIONS.
  346. *
  347. * @return ITERATIONS
  348. */
  349. public int getIterations() {
  350. return ITERATIONS;
  351. }
  352. /**
  353. * sets the current Iteration.
  354. *
  355. * @param curIT
  356. * the current Iteration
  357. */
  358. public void setCurIteration(int curIT) {
  359. this.curIteration = curIT;
  360. notifyGraphListeners();
  361. }
  362. private void notifyGraphListeners() {
  363. for (GraphListener gl : graphListeners) {
  364. gl.repaintTree();
  365. }
  366. }
  367. /**
  368. * Returns cURiTERATION.
  369. *
  370. * @return cURiTERATION
  371. */
  372. public int getCurIteration() {
  373. return curIteration;
  374. }
  375. /**
  376. * Set the selected Edge.
  377. *
  378. * @param edge
  379. * that is selected
  380. *
  381. */
  382. public void setSelectedEdge(CpsEdge edge) {
  383. this.selectedEdge = edge;
  384. }
  385. /**
  386. * Returns the selected Edge.
  387. *
  388. * @return selectedEdge
  389. */
  390. public CpsEdge getSelectedEdge() {
  391. return selectedEdge;
  392. }
  393. /**
  394. * Returns the Categorie Index.
  395. *
  396. * @return the cgIdx
  397. */
  398. public HashMap<String, Integer> getCgIdx() {
  399. return cgIdx;
  400. }
  401. /**
  402. * Sets the Categorie Index.
  403. *
  404. * @param cgIdx
  405. * the cgIdx to set
  406. */
  407. public void setCgIdx(HashMap<String, Integer> cgIdx) {
  408. this.cgIdx = cgIdx;
  409. }
  410. /**
  411. * Returns the CanvasObject Index.
  412. *
  413. * @return the cvsObjIdx
  414. */
  415. public HashMap<Integer, Integer> getCvsObjIdx() {
  416. return cvsObjIdx;
  417. }
  418. /**
  419. * Sets the CanvasObject Index.
  420. *
  421. * @param cvsObjIdx
  422. * the cvsObjIdx to set
  423. */
  424. public void setCvsObjIdx(HashMap<Integer, Integer> cvsObjIdx) {
  425. this.cvsObjIdx = cvsObjIdx;
  426. }
  427. /**
  428. * Sets the auto save Number.
  429. *
  430. * @param autoSaveNr
  431. * the auto save number
  432. */
  433. public void setAutoSaveNr(int autoSaveNr) {
  434. this.autoSaveNr = autoSaveNr;
  435. }
  436. /**
  437. * Returns the auto save Number.
  438. *
  439. * @return the auto save Number
  440. */
  441. public int getAutoSaveNr() {
  442. return autoSaveNr;
  443. }
  444. /**
  445. * Returns the Number of Saves.
  446. *
  447. * @return the numberOfSaves
  448. */
  449. public int getNumberOfSaves() {
  450. return numberOfSaves;
  451. }
  452. /**
  453. * Set the Number of Saves.
  454. *
  455. * @param numberOfSaves
  456. * the numberOfSaves to set
  457. */
  458. public void setNumberOfSaves(int numberOfSaves) {
  459. this.numberOfSaves = numberOfSaves;
  460. }
  461. /**
  462. * Sets the ClipboardObjects.
  463. *
  464. * @param c
  465. * Array of Objects
  466. */
  467. public void setClipboradObjects(ArrayList<AbstractCpsObject> c) {
  468. this.clipboardObjects = c;
  469. }
  470. /**
  471. * Returns all Objects in the Clipboard.
  472. *
  473. * @return Objects in the Clipboard
  474. */
  475. public ArrayList<AbstractCpsObject> getClipboradObjects() {
  476. return clipboardObjects;
  477. }
  478. /**
  479. * Sets the console.
  480. *
  481. * @param console
  482. * the console
  483. */
  484. public void setConsole(Console console) {
  485. this.console = console;
  486. }
  487. /**
  488. * Returns the Console.
  489. *
  490. * @return console the console
  491. */
  492. public Console getConsole() {
  493. return console;
  494. }
  495. /**
  496. * @return the maxCapacity
  497. */
  498. public float getMaxCapacity() {
  499. return maxCapacity;
  500. }
  501. /**
  502. * @param maxCapacity
  503. * the maxCapacity to set
  504. */
  505. public void setMaxCapacity(float maxCapacity) {
  506. this.maxCapacity = maxCapacity;
  507. }
  508. /**
  509. * Sets the Interval in ms between each Iteration.
  510. *
  511. * @param t
  512. * speed for the Iterations
  513. */
  514. public void setTimerSpeed(int t) {
  515. this.timerSpeed = t;
  516. }
  517. /**
  518. * get the Interval in ms between each Iteration.
  519. *
  520. * @return timerSpeed speed for the Iterations
  521. */
  522. public int getTimerSpeed() {
  523. return this.timerSpeed;
  524. }
  525. /**
  526. * Get Canvas X Size.
  527. *
  528. * @return the cANVAS_X
  529. */
  530. public int getCanvasX() {
  531. return canvasX;
  532. }
  533. /**
  534. * Set Canvas X Size.
  535. *
  536. * @param canvasX
  537. * the cANVAS_X to set
  538. */
  539. public void setCanvasX(int canvasX) {
  540. this.canvasX = canvasX;
  541. }
  542. /**
  543. * get Canvas Y size.
  544. *
  545. * @return the cANVAS_Y
  546. */
  547. public int getCanvasY() {
  548. return canvasY;
  549. }
  550. /**
  551. * Set Canvas Y size.
  552. *
  553. * @param canvasY
  554. * the cANVAS_Y to set
  555. */
  556. public void setCanvasY(int canvasY) {
  557. this.canvasY = canvasY;
  558. }
  559. /**
  560. * get the Algorithm.
  561. *
  562. * @return the Algorithm
  563. */
  564. public Object getAlgorithm() {
  565. return algorithm;
  566. }
  567. /**
  568. * Set the Algorithm.
  569. *
  570. * @param obj
  571. * the Algorithm
  572. */
  573. public void setAlgorithm(Object obj) {
  574. this.algorithm = null;
  575. this.algorithm = obj;
  576. }
  577. /**
  578. * Add a SubNetColor.
  579. *
  580. * @param c
  581. * the Color
  582. */
  583. public void addSubNetColor(Color c) {
  584. this.subNetColors.add(c);
  585. }
  586. /**
  587. * Get the SubNetColors.
  588. *
  589. * @return SubNetColors
  590. */
  591. public LinkedList<Color> getSubNetColors() {
  592. return this.subNetColors;
  593. }
  594. public void setTrackingObj(ArrayList<AbstractCpsObject> toTrack) {
  595. trackedObjects = toTrack;
  596. }
  597. public ArrayList<AbstractCpsObject> getTrackingObj() {
  598. return trackedObjects;
  599. }
  600. public void addGraphListener(GraphListener gl) {
  601. graphListeners.add(gl);
  602. }
  603. public void setEleToDelete(HashMap<Integer, ArrayList<HolonElement>> theHash) {
  604. this.eleToDelete = theHash;
  605. }
  606. public HashMap<Integer, ArrayList<HolonElement>> getEleToDelete() {
  607. return this.eleToDelete;
  608. }
  609. public void setSingleTable(PropertyTable pt) {
  610. this.tableModelHolonElementSingle = pt;
  611. }
  612. public PropertyTable getSingleTable() {
  613. return this.tableModelHolonElementSingle;
  614. }
  615. public PropertyTable getMultiTable() {
  616. return this.tableModelHolonElementMulti;
  617. }
  618. public void setMultiTable(PropertyTable pt) {
  619. this.tableModelHolonElementMulti = pt;
  620. }
  621. public void addObjectsToGraphListeners() {
  622. for (GraphListener gl : graphListeners) {
  623. gl.addTrackedObject(trackedObjects);
  624. gl.repaintTree();
  625. }
  626. }
  627. public DefaulTable getPropertyTable() {
  628. return this.tableModelProperties;
  629. }
  630. public void setPropertyTable(DefaulTable pt) {
  631. this.tableModelProperties = pt;
  632. }
  633. public JTable getTableHolonElement() {
  634. return tableHolonElement;
  635. }
  636. public void setTableHolonElement(JTable tableHolonElement) {
  637. this.tableHolonElement = tableHolonElement;
  638. }
  639. /**
  640. * Sets the HolonBody Scale.
  641. *
  642. * @param scale
  643. * for the HolonBody
  644. */
  645. public void setHolonBodyScale(int scale) {
  646. holonBodysCALE = scale;
  647. }
  648. /**
  649. * Returns the sCale (Scale for the Images).
  650. *
  651. * @return sCALE
  652. */
  653. public int getHolonBodyScale() {
  654. return holonBodysCALE;
  655. }
  656. /**
  657. * Sets the ID of the selected HolonBody
  658. *
  659. * @param i
  660. * int
  661. */
  662. public void setSelectedHolonBody(int i) {
  663. selectedHolonBody = i;
  664. }
  665. /**
  666. * Returns the ID of the selected HolonBody
  667. *
  668. * @return selectedHolonBody
  669. */
  670. public int getSelectedHolonBody() {
  671. return selectedHolonBody;
  672. }
  673. /**
  674. * get all Switches
  675. */
  676. public ArrayList<HolonSwitch> getSwitches() {
  677. ArrayList<HolonSwitch> switches = new ArrayList<>();
  678. for (AbstractCpsObject obj : getObjectsOnCanvas()) {
  679. if (obj instanceof HolonSwitch) {
  680. switches.add((HolonSwitch) obj);
  681. } else if (obj instanceof CpsUpperNode) {
  682. getSwitchesRec(((CpsUpperNode) obj).getNodes(), switches);
  683. }
  684. }
  685. return switches;
  686. }
  687. /**
  688. * get the Amount of Switches help function
  689. *
  690. * @param objects
  691. * objects
  692. * @param switches
  693. * List of switches
  694. */
  695. private ArrayList<HolonSwitch> getSwitchesRec(ArrayList<AbstractCpsObject> objects,
  696. ArrayList<HolonSwitch> switches) {
  697. for (AbstractCpsObject obj : objects) {
  698. if (obj instanceof HolonSwitch) {
  699. switches.add((HolonSwitch) obj);
  700. } else if (obj instanceof CpsUpperNode) {
  701. getSwitchesRec(((CpsUpperNode) obj).getNodes(), switches);
  702. }
  703. }
  704. return switches;
  705. }
  706. /**
  707. * Returns the Path for the background Image of the Canvas.
  708. *
  709. * @return imgPath the Path
  710. */
  711. public String getCanvasImagePath() {
  712. return imgPath;
  713. }
  714. /**
  715. * Returns the mode for the background Image of the Canvas.
  716. *
  717. * 0 take size of the Image 1 stretch the Image 2 Custom Image size
  718. *
  719. * @return backgroundMode the mode
  720. */
  721. public int getCanvasImageMode() {
  722. return backgroundMode;
  723. }
  724. /**
  725. * Returns the Custom width of the background Image of the Canvas.
  726. *
  727. * @return backgroundWidth the Width
  728. */
  729. public int getCanvasImageWidth() {
  730. return backgroundWidth;
  731. }
  732. /**
  733. * Returns the Custom height of the background Image of the Canvas.
  734. *
  735. * @return backgroundHeight the height
  736. */
  737. public int getCanvasImageHeight() {
  738. return backgroundHeight;
  739. }
  740. /**
  741. * Set the Path for the background Image of the Canvas.
  742. *
  743. * @param paththe
  744. * Path
  745. */
  746. public void setCanvasImagePath(String path) {
  747. imgPath = path;
  748. }
  749. /**
  750. * Set the mode for the background Image of the Canvas.
  751. *
  752. * 0 take size of the Image, 1 stretch the Image, 2 Custom Image size
  753. *
  754. * @param backgroundMode
  755. * the mode
  756. */
  757. public void setCanvasImageMode(int mode) {
  758. backgroundMode = mode;
  759. }
  760. /**
  761. * Set the Custom width of the background Image of the Canvas.
  762. *
  763. * @param width
  764. * the Width
  765. */
  766. public void setCanvasImageWidth(int width) {
  767. backgroundWidth = width;
  768. }
  769. /**
  770. * Set the Custom height of the background Image of the Canvas.
  771. *
  772. * @param height
  773. * the height
  774. */
  775. public void setCanvasImageHeight(int height) {
  776. backgroundHeight = height;
  777. }
  778. /**
  779. * Set the graphtable for Statistic Graphs
  780. */
  781. public void setGraphTable(Hashtable<String, StatisticGraphPanel> gT) {
  782. statisticGraphTable = gT;
  783. }
  784. /**
  785. * Returns the graphtable for Statistic Graphs.
  786. */
  787. public Hashtable<String, StatisticGraphPanel> getGraphTable() {
  788. return statisticGraphTable;
  789. }
  790. /**
  791. * Returns if the Simulation is running.
  792. */
  793. public boolean getIsSimRunning() {
  794. return isSimRunning;
  795. }
  796. /**
  797. * Sets isSimRunning.
  798. *
  799. * @param isRunning
  800. */
  801. public void setIsSimRunning(boolean isRunning) {
  802. isSimRunning = isRunning;
  803. }
  804. /**
  805. * @return the statisticData
  806. */
  807. public ArrayList<JsonObject> getStatisticData() {
  808. return statisticData;
  809. }
  810. /**
  811. * @param statisticData
  812. * the statisticData to set
  813. */
  814. public void setStatisticData(ArrayList<JsonObject> statisticData) {
  815. this.statisticData = statisticData;
  816. }
  817. /**
  818. * Returns showConsoleLog.
  819. */
  820. public boolean getShowConsoleLog() {
  821. return this.showConsoleLog;
  822. }
  823. /**
  824. * Sets showConsoleLog.
  825. *
  826. * @param showConsoleLog
  827. */
  828. public void setShowConsoleLog(boolean showConsoleLog) {
  829. this.showConsoleLog = showConsoleLog;
  830. }
  831. }