You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

246 lines
18 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <!DOCTYPE HTML>
  2. <html lang="de">
  3. <head>
  4. <!-- Generated by javadoc (17) on Fri Jun 17 12:42:43 CEST 2022 -->
  5. <title>CollisionAwareEgoController</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  8. <meta name="dc.created" content="2022-06-17">
  9. <meta name="description" content="declaration: package: controller, class: CollisionAwareEgoController">
  10. <meta name="generator" content="javadoc/ClassWriterImpl">
  11. <link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
  12. <link rel="stylesheet" type="text/css" href="../script-dir/jquery-ui.min.css" title="Style">
  13. <link rel="stylesheet" type="text/css" href="../jquery-ui.overrides.css" title="Style">
  14. <script type="text/javascript" src="../script.js"></script>
  15. <script type="text/javascript" src="../script-dir/jquery-3.5.1.min.js"></script>
  16. <script type="text/javascript" src="../script-dir/jquery-ui.min.js"></script>
  17. </head>
  18. <body class="class-declaration-page">
  19. <script type="text/javascript">var evenRowColor = "even-row-color";
  20. var oddRowColor = "odd-row-color";
  21. var tableTab = "table-tab";
  22. var activeTableTab = "active-table-tab";
  23. var pathtoroot = "../";
  24. loadScripts(document, 'script');</script>
  25. <noscript>
  26. <div>JavaScript is disabled on your browser.</div>
  27. </noscript>
  28. <div class="flex-box">
  29. <header role="banner" class="flex-header">
  30. <nav role="navigation">
  31. <!-- ========= START OF TOP NAVBAR ======= -->
  32. <div class="top-nav" id="navbar-top">
  33. <div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
  34. <ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
  35. <li><a href="../index.html">Overview</a></li>
  36. <li><a href="package-summary.html">Package</a></li>
  37. <li class="nav-bar-cell1-rev">Class</li>
  38. <li><a href="class-use/CollisionAwareEgoController.html">Use</a></li>
  39. <li><a href="package-tree.html">Tree</a></li>
  40. <li><a href="../index-files/index-1.html">Index</a></li>
  41. <li><a href="../help-doc.html#class">Help</a></li>
  42. </ul>
  43. </div>
  44. <div class="sub-nav">
  45. <div>
  46. <ul class="sub-nav-list">
  47. <li>Summary:&nbsp;</li>
  48. <li>Nested&nbsp;|&nbsp;</li>
  49. <li>Field&nbsp;|&nbsp;</li>
  50. <li><a href="#constructor-summary">Constr</a>&nbsp;|&nbsp;</li>
  51. <li><a href="#method-summary">Method</a></li>
  52. </ul>
  53. <ul class="sub-nav-list">
  54. <li>Detail:&nbsp;</li>
  55. <li>Field&nbsp;|&nbsp;</li>
  56. <li><a href="#constructor-detail">Constr</a>&nbsp;|&nbsp;</li>
  57. <li><a href="#method-detail">Method</a></li>
  58. </ul>
  59. </div>
  60. <div class="nav-list-search"><label for="search-input">SEARCH:</label>
  61. <input type="text" id="search-input" value="search" disabled="disabled">
  62. <input type="reset" id="reset-button" value="reset" disabled="disabled">
  63. </div>
  64. </div>
  65. <!-- ========= END OF TOP NAVBAR ========= -->
  66. <span class="skip-nav" id="skip-navbar-top"></span></nav>
  67. </header>
  68. <div class="flex-content">
  69. <main role="main">
  70. <!-- ======== START OF CLASS DATA ======== -->
  71. <div class="header">
  72. <div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">controller</a></div>
  73. <h1 title="Class CollisionAwareEgoController" class="title">Class CollisionAwareEgoController</h1>
  74. </div>
  75. <div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">java.lang.Object</a>
  76. <div class="inheritance"><a href="ObjectController.html" title="class in controller">controller.ObjectController</a>
  77. <div class="inheritance"><a href="EgoController.html" title="class in controller">controller.EgoController</a>
  78. <div class="inheritance">controller.CollisionAwareEgoController</div>
  79. </div>
  80. </div>
  81. </div>
  82. <section class="class-description" id="class-description">
  83. <hr>
  84. <div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">CollisionAwareEgoController</span>
  85. <span class="extends-implements">extends <a href="EgoController.html" title="class in controller">EgoController</a></span></div>
  86. <div class="block">An EgoController which cannot move through obstacle objects (is collission aware). Only respects
  87. GameObjects that have the String 'obstacle' in their name.</div>
  88. </section>
  89. <section class="summary">
  90. <ul class="summary-list">
  91. <!-- ======== CONSTRUCTOR SUMMARY ======== -->
  92. <li>
  93. <section class="constructor-summary" id="constructor-summary">
  94. <h2>Constructor Summary</h2>
  95. <div class="caption"><span>Constructors</span></div>
  96. <div class="summary-table two-column-summary">
  97. <div class="table-header col-first">Constructor</div>
  98. <div class="table-header col-last">Description</div>
  99. <div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E(double)" class="member-name-link">CollisionAwareEgoController</a><wbr>(double&nbsp;egoRad)</code></div>
  100. <div class="col-last even-row-color">&nbsp;</div>
  101. <div class="col-constructor-name odd-row-color"><code><a href="#%3Cinit%3E(double,java.io.File)" class="member-name-link">CollisionAwareEgoController</a><wbr>(double&nbsp;egoRad,
  102. <a href="https://docs.oracle.com/javase/8/docs/api/java/io/File.html" title="class or interface in java.io" class="external-link">File</a>&nbsp;soundOnShot)</code></div>
  103. <div class="col-last odd-row-color">&nbsp;</div>
  104. </div>
  105. </section>
  106. </li>
  107. <!-- ========== METHOD SUMMARY =========== -->
  108. <li>
  109. <section class="method-summary" id="method-summary">
  110. <h2>Method Summary</h2>
  111. <div id="method-summary-table">
  112. <div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div>
  113. <div id="method-summary-table.tabpanel" role="tabpanel">
  114. <div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
  115. <div class="table-header col-first">Modifier and Type</div>
  116. <div class="table-header col-second">Method</div>
  117. <div class="table-header col-last">Description</div>
  118. <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
  119. <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#onSpace(java.awt.event.KeyEvent,gameobjects.GameObject)" class="member-name-link">onSpace</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/awt/event/KeyEvent.html" title="class or interface in java.awt.event" class="external-link">KeyEvent</a>&nbsp;e,
  120. <a href="../gameobjects/GameObject.html" title="class in gameobjects">GameObject</a>&nbsp;ego)</code></div>
  121. <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
  122. <div class="block">calls superclass <a href="EgoController.html#onSpace(java.awt.event.KeyEvent,gameobjects.GameObject)"><code>EgoController.onSpace(KeyEvent, GameObject)</code></a> only, if the time elapsed since last pressing of space is above 0.1 ms.</div>
  123. </div>
  124. <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
  125. <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#restoreDynamicState()" class="member-name-link">restoreDynamicState</a>()</code></div>
  126. <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
  127. <div class="block">Restores formally saved values of x,y position and speed vx,vy from attributes back to the ego object.</div>
  128. </div>
  129. <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
  130. <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#saveDynamicState()" class="member-name-link">saveDynamicState</a>()</code></div>
  131. <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
  132. <div class="block">Copies current values of x,y position and speed vx,vy into attributes.</div>
  133. </div>
  134. <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
  135. <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#stopObject()" class="member-name-link">stopObject</a>()</code></div>
  136. <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
  137. <div class="block">extends parent class implementation by a check whether or not the ego object collides with any other "obstacle" object.</div>
  138. </div>
  139. </div>
  140. </div>
  141. </div>
  142. <div class="inherited-list">
  143. <h3 id="methods-inherited-from-class-controller.EgoController">Methods inherited from class&nbsp;controller.<a href="EgoController.html" title="class in controller">EgoController</a></h3>
  144. <code><a href="EgoController.html#onDown(java.awt.event.KeyEvent,gameobjects.GameObject)">onDown</a>, <a href="EgoController.html#onLeft(java.awt.event.KeyEvent,gameobjects.GameObject)">onLeft</a>, <a href="EgoController.html#onRight(java.awt.event.KeyEvent,gameobjects.GameObject)">onRight</a>, <a href="EgoController.html#onStop(java.awt.event.KeyEvent,gameobjects.GameObject)">onStop</a>, <a href="EgoController.html#onUp(java.awt.event.KeyEvent,gameobjects.GameObject)">onUp</a>, <a href="EgoController.html#updateObject()">updateObject</a></code></div>
  145. <div class="inherited-list">
  146. <h3 id="methods-inherited-from-class-controller.ObjectController">Methods inherited from class&nbsp;controller.<a href="ObjectController.html" title="class in controller">ObjectController</a></h3>
  147. <code><a href="ObjectController.html#applySpeedVector()">applySpeedVector</a>, <a href="ObjectController.html#getPlayground()">getPlayground</a>, <a href="ObjectController.html#getTimestep()">getTimestep</a>, <a href="ObjectController.html#getVX()">getVX</a>, <a href="ObjectController.html#getVY()">getVY</a>, <a href="ObjectController.html#getX()">getX</a>, <a href="ObjectController.html#getY()">getY</a>, <a href="ObjectController.html#setDummy(java.lang.String)">setDummy</a>, <a href="ObjectController.html#setObject(gameobjects.GameObject)">setObject</a>, <a href="ObjectController.html#setPlayground(playground.Playground)">setPlayground</a>, <a href="ObjectController.html#setVX(double)">setVX</a>, <a href="ObjectController.html#setVY(double)">setVY</a>, <a href="ObjectController.html#setX(double)">setX</a>, <a href="ObjectController.html#setY(double)">setY</a></code></div>
  148. <div class="inherited-list">
  149. <h3 id="methods-inherited-from-class-java.lang.Object">Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3>
  150. <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
  151. </section>
  152. </li>
  153. </ul>
  154. </section>
  155. <section class="details">
  156. <ul class="details-list">
  157. <!-- ========= CONSTRUCTOR DETAIL ======== -->
  158. <li>
  159. <section class="constructor-details" id="constructor-detail">
  160. <h2>Constructor Details</h2>
  161. <ul class="member-list">
  162. <li>
  163. <section class="detail" id="&lt;init&gt;(double)">
  164. <h3>CollisionAwareEgoController</h3>
  165. <div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">CollisionAwareEgoController</span><wbr><span class="parameters">(double&nbsp;egoRad)</span></div>
  166. <dl class="notes">
  167. <dt>Parameters:</dt>
  168. <dd><code>egoRad</code> - radius of ego object to be used.</dd>
  169. </dl>
  170. </section>
  171. </li>
  172. <li>
  173. <section class="detail" id="&lt;init&gt;(double,java.io.File)">
  174. <h3>CollisionAwareEgoController</h3>
  175. <div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">CollisionAwareEgoController</span><wbr><span class="parameters">(double&nbsp;egoRad,
  176. <a href="https://docs.oracle.com/javase/8/docs/api/java/io/File.html" title="class or interface in java.io" class="external-link">File</a>&nbsp;soundOnShot)</span></div>
  177. <dl class="notes">
  178. <dt>Parameters:</dt>
  179. <dd><code>egoRad</code> - radius of ego object to be used.</dd>
  180. <dd><code>soundOnShot</code> - WAV file to be played on shot</dd>
  181. </dl>
  182. </section>
  183. </li>
  184. </ul>
  185. </section>
  186. </li>
  187. <!-- ============ METHOD DETAIL ========== -->
  188. <li>
  189. <section class="method-details" id="method-detail">
  190. <h2>Method Details</h2>
  191. <ul class="member-list">
  192. <li>
  193. <section class="detail" id="saveDynamicState()">
  194. <h3>saveDynamicState</h3>
  195. <div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">saveDynamicState</span>()</div>
  196. <div class="block">Copies current values of x,y position and speed vx,vy into attributes. These can be restored by call to <a href="#restoreDynamicState()"><code>restoreDynamicState()</code></a>.</div>
  197. </section>
  198. </li>
  199. <li>
  200. <section class="detail" id="restoreDynamicState()">
  201. <h3>restoreDynamicState</h3>
  202. <div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">restoreDynamicState</span>()</div>
  203. <div class="block">Restores formally saved values of x,y position and speed vx,vy from attributes back to the ego object.
  204. These values should have been stored before by a call to <a href="#saveDynamicState()"><code>saveDynamicState()</code></a>, otherwise all values will be 0.00.</div>
  205. </section>
  206. </li>
  207. <li>
  208. <section class="detail" id="stopObject()">
  209. <h3>stopObject</h3>
  210. <div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">stopObject</span>()</div>
  211. <div class="block">extends parent class implementation by a check whether or not the ego object collides with any other "obstacle" object.
  212. If yes, the position stays fixed (by using <a href="#saveDynamicState()"><code>saveDynamicState()</code></a> and <a href="#restoreDynamicState()"><code>restoreDynamicState()</code></a>.</div>
  213. <dl class="notes">
  214. <dt>Overrides:</dt>
  215. <dd><code><a href="EgoController.html#stopObject()">stopObject</a></code>&nbsp;in class&nbsp;<code><a href="EgoController.html" title="class in controller">EgoController</a></code></dd>
  216. <dt>Returns:</dt>
  217. <dd>true if the object reached the boundaries of the level, false otherwise.</dd>
  218. </dl>
  219. </section>
  220. </li>
  221. <li>
  222. <section class="detail" id="onSpace(java.awt.event.KeyEvent,gameobjects.GameObject)">
  223. <h3>onSpace</h3>
  224. <div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">onSpace</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/awt/event/KeyEvent.html" title="class or interface in java.awt.event" class="external-link">KeyEvent</a>&nbsp;e,
  225. <a href="../gameobjects/GameObject.html" title="class in gameobjects">GameObject</a>&nbsp;ego)</span></div>
  226. <div class="block">calls superclass <a href="EgoController.html#onSpace(java.awt.event.KeyEvent,gameobjects.GameObject)"><code>EgoController.onSpace(KeyEvent, GameObject)</code></a> only, if the time elapsed since last pressing of space is above 0.1 ms.</div>
  227. <dl class="notes">
  228. <dt>Overrides:</dt>
  229. <dd><code><a href="EgoController.html#onSpace(java.awt.event.KeyEvent,gameobjects.GameObject)">onSpace</a></code>&nbsp;in class&nbsp;<code><a href="EgoController.html" title="class in controller">EgoController</a></code></dd>
  230. <dt>Parameters:</dt>
  231. <dd><code>e</code> - KeyEvent of the space key</dd>
  232. <dd><code>ego</code> - EgoObject instance (used to determine position of shot object's start)</dd>
  233. </dl>
  234. </section>
  235. </li>
  236. </ul>
  237. </section>
  238. </li>
  239. </ul>
  240. </section>
  241. <!-- ========= END OF CLASS DATA ========= -->
  242. </main>
  243. </div>
  244. </div>
  245. </body>
  246. </html>