diff --git a/.gradle/8.10.2/executionHistory/executionHistory.bin b/.gradle/8.10.2/executionHistory/executionHistory.bin index 3d10d841a99272782ddf282c4b0b29cb55371420..8a7d940b93df112c84f1974aafc6583f732a969c 100644 Binary files a/.gradle/8.10.2/executionHistory/executionHistory.bin and b/.gradle/8.10.2/executionHistory/executionHistory.bin differ diff --git a/.gradle/8.10.2/executionHistory/executionHistory.lock b/.gradle/8.10.2/executionHistory/executionHistory.lock index d462db45c4d7c86d8dede5dd9486e44dd8f78e98..ef361d8b63c134e84f7affa2d2621affa8de176b 100644 Binary files a/.gradle/8.10.2/executionHistory/executionHistory.lock and b/.gradle/8.10.2/executionHistory/executionHistory.lock differ diff --git a/.gradle/8.10.2/fileHashes/fileHashes.bin b/.gradle/8.10.2/fileHashes/fileHashes.bin index 3e8d4326b4822a700794d3a64e23eb54f2571c57..f2a336c65db20a01007e272875843babaefcf378 100644 Binary files a/.gradle/8.10.2/fileHashes/fileHashes.bin and b/.gradle/8.10.2/fileHashes/fileHashes.bin differ diff --git a/.gradle/8.10.2/fileHashes/fileHashes.lock b/.gradle/8.10.2/fileHashes/fileHashes.lock index db77305cf79235e825e81164a24609e0e6a27510..798d5cd3eb39830d8ca937c9a283e98363eb1566 100644 Binary files a/.gradle/8.10.2/fileHashes/fileHashes.lock and b/.gradle/8.10.2/fileHashes/fileHashes.lock differ diff --git a/.gradle/8.10.2/fileHashes/resourceHashesCache.bin b/.gradle/8.10.2/fileHashes/resourceHashesCache.bin index edb634cebcfa9c75ef210f68711974592d3302de..7d944ec98a8eaa6d54745e6131228683c877919b 100644 Binary files a/.gradle/8.10.2/fileHashes/resourceHashesCache.bin and b/.gradle/8.10.2/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 97aa507909944c5e6a8483e7ca506d18bff5e745..d2e3f59c567d112182b45db78883bd7bfb215512 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/file-system.probe b/.gradle/file-system.probe index 03c0d8421f990ae962b0bc7ae603ecef67a88649..93c56d2b8a81d5ee6e98ab947d377bceda18ebb0 100644 Binary files a/.gradle/file-system.probe and b/.gradle/file-system.probe differ diff --git a/.gradle/workspace-id.txt.lock b/.gradle/workspace-id.txt.lock index b117a4c56870b8883f344d769d1e8f83ede5b207..7cc3960a3fca5d19e737bc98de26227ef721d7fc 100644 Binary files a/.gradle/workspace-id.txt.lock and b/.gradle/workspace-id.txt.lock differ diff --git a/build/classes/java/main/app/SimulatorApplication.class b/build/classes/java/main/app/SimulatorApplication.class index b36b7c02d18654382c104e681c6af17a8589e001..6d88dc9a0edace933e7b9ca5f67bbdaddba48037 100644 Binary files a/build/classes/java/main/app/SimulatorApplication.class and b/build/classes/java/main/app/SimulatorApplication.class differ diff --git a/build/classes/java/main/model/Behavior.class b/build/classes/java/main/model/Behavior.class index d86121cbe423c6d1029c44d360bbf96c1d64988d..7b66ceda77beed63d4117f3a5a0e60d01e373d50 100644 Binary files a/build/classes/java/main/model/Behavior.class and b/build/classes/java/main/model/Behavior.class differ diff --git a/build/classes/java/main/model/BoardData.class b/build/classes/java/main/model/BoardData.class index 68916b340a4acd1d2621bfcf585e06fd2a6ae4df..1473192238ebff191ff33a083801c7c099c24bc6 100644 Binary files a/build/classes/java/main/model/BoardData.class and b/build/classes/java/main/model/BoardData.class differ diff --git a/build/classes/java/main/model/Cell.class b/build/classes/java/main/model/Cell.class new file mode 100644 index 0000000000000000000000000000000000000000..c5b5ebd6bb02a92a57e1e05dacdf52857fba1e74 Binary files /dev/null and b/build/classes/java/main/model/Cell.class differ diff --git a/build/classes/java/main/model/Cloud.class b/build/classes/java/main/model/Cloud.class index 156cea833bbe8aa84054ee652a14bcc4cb4dd6af..a31acca2d1c953a93b797c67b9600eb48fd22172 100644 Binary files a/build/classes/java/main/model/Cloud.class and b/build/classes/java/main/model/Cloud.class differ diff --git a/build/classes/java/main/model/CloudBehavior.class b/build/classes/java/main/model/CloudBehavior.class index 1abcacc1dbe2ee98e7ace5ae399d9f2cc8a1f621..344f982210adb7b2522955c44e6e86888dd98f2b 100644 Binary files a/build/classes/java/main/model/CloudBehavior.class and b/build/classes/java/main/model/CloudBehavior.class differ diff --git a/build/classes/java/main/model/CloudManager.class b/build/classes/java/main/model/CloudManager.class deleted file mode 100644 index 6e6549e688a6b078ab5ddb04a71060303522476b..0000000000000000000000000000000000000000 Binary files a/build/classes/java/main/model/CloudManager.class and /dev/null differ diff --git a/build/classes/java/main/model/Element.class b/build/classes/java/main/model/Element.class index 079cd542c7fab8677b01e951559d75efdf145006..86796ebda7b006c90771da8c76c0f4b5e8ec76c5 100644 Binary files a/build/classes/java/main/model/Element.class and b/build/classes/java/main/model/Element.class differ diff --git a/build/classes/java/main/model/ElementManager.class b/build/classes/java/main/model/ElementManager.class new file mode 100644 index 0000000000000000000000000000000000000000..abc64510c990809c4aad859777a4a59aca4086cf Binary files /dev/null and b/build/classes/java/main/model/ElementManager.class differ diff --git a/build/classes/java/main/model/FFBehavior.class b/build/classes/java/main/model/FFBehavior.class index af7cecfbff535bc7ecb43c977276434d28084ce9..291fe9094bbfeaa70d5df89ff86cc3f4924868ba 100644 Binary files a/build/classes/java/main/model/FFBehavior.class and b/build/classes/java/main/model/FFBehavior.class differ diff --git a/build/classes/java/main/model/FFBoard.class b/build/classes/java/main/model/FFBoard.class index 36e503aaff8943f07c8ce851dbb75ec7b49a47fd..c9b8a72cb01f2a502c5697bcf5525fd49946aace 100644 Binary files a/build/classes/java/main/model/FFBoard.class and b/build/classes/java/main/model/FFBoard.class differ diff --git a/build/classes/java/main/model/FFBoardData.class b/build/classes/java/main/model/FFBoardData.class index 9f22a0e72eb02bd57d31319f61a8793d6e2ce0e7..ae88b9bbb6be6394ec0ec3fefd9be577f7a22e87 100644 Binary files a/build/classes/java/main/model/FFBoardData.class and b/build/classes/java/main/model/FFBoardData.class differ diff --git a/build/classes/java/main/model/FFUpdater.class b/build/classes/java/main/model/FFUpdater.class index e5ea52694798a006d28604626014ecab8922cbde..f18682c2c9367d3033da83621242d3dead5202c6 100644 Binary files a/build/classes/java/main/model/FFUpdater.class and b/build/classes/java/main/model/FFUpdater.class differ diff --git a/build/classes/java/main/model/Fire.class b/build/classes/java/main/model/Fire.class index c09a1b0fcfff85d7fbaaed635319ab41158e29ce..8604d513c073cdc29e42ab5a667e94ae636069f0 100644 Binary files a/build/classes/java/main/model/Fire.class and b/build/classes/java/main/model/Fire.class differ diff --git a/build/classes/java/main/model/FireBehavior.class b/build/classes/java/main/model/FireBehavior.class index 7e379c86687850fd17936c8e2669fce8a659df2c..fbda223f83d841a0d2e5d0ec3a306e46366258c2 100644 Binary files a/build/classes/java/main/model/FireBehavior.class and b/build/classes/java/main/model/FireBehavior.class differ diff --git a/build/classes/java/main/model/FireFighter.class b/build/classes/java/main/model/FireFighter.class new file mode 100644 index 0000000000000000000000000000000000000000..46f71e21c725c1bfb76086ef444cdc525879437e Binary files /dev/null and b/build/classes/java/main/model/FireFighter.class differ diff --git a/build/classes/java/main/model/FireManager.class b/build/classes/java/main/model/FireManager.class deleted file mode 100644 index 2912030cd2c68244abc3d7245b31d9f78fe361c0..0000000000000000000000000000000000000000 Binary files a/build/classes/java/main/model/FireManager.class and /dev/null differ diff --git a/build/classes/java/main/model/FirefighterBehavior.class b/build/classes/java/main/model/FirefighterBehavior.class index 4fe3de1c4aa61d2e8673433518ea2ca897113584..3685400111fbb247a6d748f2fc008267a4152b38 100644 Binary files a/build/classes/java/main/model/FirefighterBehavior.class and b/build/classes/java/main/model/FirefighterBehavior.class differ diff --git a/build/classes/java/main/model/FirefighterManager.class b/build/classes/java/main/model/FirefighterManager.class deleted file mode 100644 index d54d7a1cd1a00b43c1f70c9ee54961eb4d118faa..0000000000000000000000000000000000000000 Binary files a/build/classes/java/main/model/FirefighterManager.class and /dev/null differ diff --git a/build/classes/java/main/model/ModelElement.class b/build/classes/java/main/model/ModelElement.class index f351279861b5a192c7dac4cb9056a4bf8a308922..133014562eb460bf29442abefb2f7666149c8cc6 100644 Binary files a/build/classes/java/main/model/ModelElement.class and b/build/classes/java/main/model/ModelElement.class differ diff --git a/build/classes/java/main/model/MotorizedFireFighter.class b/build/classes/java/main/model/MotorizedFireFighter.class deleted file mode 100644 index a133fb3ed99fa3d211da064a22dfeb8b82cecd83..0000000000000000000000000000000000000000 Binary files a/build/classes/java/main/model/MotorizedFireFighter.class and /dev/null differ diff --git a/build/classes/java/main/model/Mountain.class b/build/classes/java/main/model/Mountain.class index d03d1d321fde0d670495882678f21db6b4ca2e15..8fe05667e5c8fafa6d3f2372371cb9667027db77 100644 Binary files a/build/classes/java/main/model/Mountain.class and b/build/classes/java/main/model/Mountain.class differ diff --git a/build/classes/java/main/model/NoBehavior.class b/build/classes/java/main/model/NoBehavior.class deleted file mode 100644 index e135fb71734fca1d064d5780df7d8300728f0d2e..0000000000000000000000000000000000000000 Binary files a/build/classes/java/main/model/NoBehavior.class and /dev/null differ diff --git a/build/classes/java/main/model/Printable.class b/build/classes/java/main/model/Printable.class new file mode 100644 index 0000000000000000000000000000000000000000..4a4da6580c0bf74116ba0d997894b5afc5b6981a Binary files /dev/null and b/build/classes/java/main/model/Printable.class differ diff --git a/build/classes/java/main/model/RemoverBehavior.class b/build/classes/java/main/model/RemoverBehavior.class index 2e8e64a409aef234ab281df7163aa7559ce659e0..04db6553438809493d5f56a17c14984108ebf74f 100644 Binary files a/build/classes/java/main/model/RemoverBehavior.class and b/build/classes/java/main/model/RemoverBehavior.class differ diff --git a/build/classes/java/main/model/StandardFire.class b/build/classes/java/main/model/StandardFire.class new file mode 100644 index 0000000000000000000000000000000000000000..6d04a90edcec07b7d1375dffb8a54bc7a4ae1aa9 Binary files /dev/null and b/build/classes/java/main/model/StandardFire.class differ diff --git a/build/classes/java/main/model/StandardFirefighter.class b/build/classes/java/main/model/StandardFirefighter.class index 87b932e2b9918ae55e8660f59e91d68d31655d19..fc5b93fe24ca479ac79d43a6c4b73789cb475381 100644 Binary files a/build/classes/java/main/model/StandardFirefighter.class and b/build/classes/java/main/model/StandardFirefighter.class differ diff --git a/build/classes/java/main/model/TangibleBehavior.class b/build/classes/java/main/model/TangibleBehavior.class index 073a9b1484d16129dace3fae3e881f17e3cfa1a1..7a4f2f1c104b6561239e3e8f93096cfebb71097b 100644 Binary files a/build/classes/java/main/model/TangibleBehavior.class and b/build/classes/java/main/model/TangibleBehavior.class differ diff --git a/build/classes/java/main/model/Updatable.class b/build/classes/java/main/model/Updatable.class new file mode 100644 index 0000000000000000000000000000000000000000..ca0085ffcc16197c036e8b623d6aa133f687c3a6 Binary files /dev/null and b/build/classes/java/main/model/Updatable.class differ diff --git a/build/classes/java/test/model/FirefighterBoardTest.class b/build/classes/java/test/model/FirefighterBoardTest.class deleted file mode 100644 index 21d13f1cc1402592912e6a62f579ee1dcbfca7ef..0000000000000000000000000000000000000000 Binary files a/build/classes/java/test/model/FirefighterBoardTest.class and /dev/null differ diff --git a/build/classes/java/test/view/FirefighterGridTest.class b/build/classes/java/test/view/FirefighterGridTest.class deleted file mode 100644 index 281b17c8e26e41d3c98363898d7b8885135a4096..0000000000000000000000000000000000000000 Binary files a/build/classes/java/test/view/FirefighterGridTest.class and /dev/null differ diff --git a/build/distributions/firefighter-shadow.tar b/build/distributions/firefighter-shadow.tar deleted file mode 100644 index 8c6edb56869d9dd1e887659c37c83192f9ca3c92..0000000000000000000000000000000000000000 Binary files a/build/distributions/firefighter-shadow.tar and /dev/null differ diff --git a/build/distributions/firefighter-shadow.zip b/build/distributions/firefighter-shadow.zip deleted file mode 100644 index 5c89420baff29d967f7ee67f6bb0e658e04549f1..0000000000000000000000000000000000000000 Binary files a/build/distributions/firefighter-shadow.zip and /dev/null differ diff --git a/build/distributions/firefighter.tar b/build/distributions/firefighter.tar deleted file mode 100644 index 7fb3be344f7e40cb9679ff8ad1460e6081f777e6..0000000000000000000000000000000000000000 Binary files a/build/distributions/firefighter.tar and /dev/null differ diff --git a/build/distributions/firefighter.zip b/build/distributions/firefighter.zip deleted file mode 100644 index 1dfed1fa6f1ed30bdf4e238760ae8e96bf6015df..0000000000000000000000000000000000000000 Binary files a/build/distributions/firefighter.zip and /dev/null differ diff --git a/build/libs/firefighter-all.jar b/build/libs/firefighter-all.jar deleted file mode 100644 index 88dad87556b6a2b4760ab877bad8aeee88a9d7ce..0000000000000000000000000000000000000000 Binary files a/build/libs/firefighter-all.jar and /dev/null differ diff --git a/build/libs/firefighter.jar b/build/libs/firefighter.jar deleted file mode 100644 index d2c86d78bf3773117e163a4eac7b1d0a71c4cb7b..0000000000000000000000000000000000000000 Binary files a/build/libs/firefighter.jar and /dev/null differ diff --git a/build/reports/tests/test/classes/model.FirefighterBoardTest.html b/build/reports/tests/test/classes/model.FirefighterBoardTest.html deleted file mode 100644 index bafdf34e7c29583f2ffee442a11dc1a78bf741e2..0000000000000000000000000000000000000000 --- a/build/reports/tests/test/classes/model.FirefighterBoardTest.html +++ /dev/null @@ -1,111 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> -<meta http-equiv="x-ua-compatible" content="IE=edge"/> -<title>Test results - FirefighterBoardTest</title> -<link href="../css/base-style.css" rel="stylesheet" type="text/css"/> -<link href="../css/style.css" rel="stylesheet" type="text/css"/> -<script src="../js/report.js" type="text/javascript"></script> -</head> -<body> -<div id="content"> -<h1>FirefighterBoardTest</h1> -<div class="breadcrumbs"> -<a href="../index.html">all</a> > -<a href="../packages/model.html">model</a> > FirefighterBoardTest</div> -<div id="summary"> -<table> -<tr> -<td> -<div class="summaryGroup"> -<table> -<tr> -<td> -<div class="infoBox" id="tests"> -<div class="counter">4</div> -<p>tests</p> -</div> -</td> -<td> -<div class="infoBox" id="failures"> -<div class="counter">0</div> -<p>failures</p> -</div> -</td> -<td> -<div class="infoBox" id="ignored"> -<div class="counter">0</div> -<p>ignored</p> -</div> -</td> -<td> -<div class="infoBox" id="duration"> -<div class="counter">0.098s</div> -<p>duration</p> -</div> -</td> -</tr> -</table> -</div> -</td> -<td> -<div class="infoBox success" id="successRate"> -<div class="percent">100%</div> -<p>successful</p> -</div> -</td> -</tr> -</table> -</div> -<div id="tabs"> -<ul class="tabLinks"> -<li> -<a href="#tab0">Tests</a> -</li> -</ul> -<div id="tab0" class="tab"> -<h2>Tests</h2> -<table> -<thead> -<tr> -<th>Test</th> -<th>Duration</th> -<th>Result</th> -</tr> -</thead> -<tr> -<td class="success">testColumnCount()</td> -<td class="success">0.078s</td> -<td class="success">passed</td> -</tr> -<tr> -<td class="success">testGetState_afterSet()</td> -<td class="success">0.016s</td> -<td class="success">passed</td> -</tr> -<tr> -<td class="success">testRowCount()</td> -<td class="success">0.002s</td> -<td class="success">passed</td> -</tr> -<tr> -<td class="success">testStepNumber()</td> -<td class="success">0.002s</td> -<td class="success">passed</td> -</tr> -</table> -</div> -</div> -<div id="footer"> -<p> -<div> -<label class="hidden" id="label-for-line-wrapping-toggle" for="line-wrapping-toggle">Wrap lines -<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/> -</label> -</div>Generated by -<a href="http://www.gradle.org">Gradle 8.10.2</a> at 16 nov. 2024, 18:17:08</p> -</div> -</div> -</body> -</html> diff --git a/build/reports/tests/test/css/base-style.css b/build/reports/tests/test/css/base-style.css deleted file mode 100644 index 4afa73e3ddcf5e21bdd0a22ac575dc99b2e3d826..0000000000000000000000000000000000000000 --- a/build/reports/tests/test/css/base-style.css +++ /dev/null @@ -1,179 +0,0 @@ - -body { - margin: 0; - padding: 0; - font-family: sans-serif; - font-size: 12pt; -} - -body, a, a:visited { - color: #303030; -} - -#content { - padding-left: 50px; - padding-right: 50px; - padding-top: 30px; - padding-bottom: 30px; -} - -#content h1 { - font-size: 160%; - margin-bottom: 10px; -} - -#footer { - margin-top: 100px; - font-size: 80%; - white-space: nowrap; -} - -#footer, #footer a { - color: #a0a0a0; -} - -#line-wrapping-toggle { - vertical-align: middle; -} - -#label-for-line-wrapping-toggle { - vertical-align: middle; -} - -ul { - margin-left: 0; -} - -h1, h2, h3 { - white-space: nowrap; -} - -h2 { - font-size: 120%; -} - -ul.tabLinks { - padding-left: 0; - padding-top: 10px; - padding-bottom: 10px; - overflow: auto; - min-width: 800px; - width: auto !important; - width: 800px; -} - -ul.tabLinks li { - float: left; - height: 100%; - list-style: none; - padding-left: 10px; - padding-right: 10px; - padding-top: 5px; - padding-bottom: 5px; - margin-bottom: 0; - -moz-border-radius: 7px; - border-radius: 7px; - margin-right: 25px; - border: solid 1px #d4d4d4; - background-color: #f0f0f0; -} - -ul.tabLinks li:hover { - background-color: #fafafa; -} - -ul.tabLinks li.selected { - background-color: #c5f0f5; - border-color: #c5f0f5; -} - -ul.tabLinks a { - font-size: 120%; - display: block; - outline: none; - text-decoration: none; - margin: 0; - padding: 0; -} - -ul.tabLinks li h2 { - margin: 0; - padding: 0; -} - -div.tab { -} - -div.selected { - display: block; -} - -div.deselected { - display: none; -} - -div.tab table { - min-width: 350px; - width: auto !important; - width: 350px; - border-collapse: collapse; -} - -div.tab th, div.tab table { - border-bottom: solid #d0d0d0 1px; -} - -div.tab th { - text-align: left; - white-space: nowrap; - padding-left: 6em; -} - -div.tab th:first-child { - padding-left: 0; -} - -div.tab td { - white-space: nowrap; - padding-left: 6em; - padding-top: 5px; - padding-bottom: 5px; -} - -div.tab td:first-child { - padding-left: 0; -} - -div.tab td.numeric, div.tab th.numeric { - text-align: right; -} - -span.code { - display: inline-block; - margin-top: 0em; - margin-bottom: 1em; -} - -span.code pre { - font-size: 11pt; - padding-top: 10px; - padding-bottom: 10px; - padding-left: 10px; - padding-right: 10px; - margin: 0; - background-color: #f7f7f7; - border: solid 1px #d0d0d0; - min-width: 700px; - width: auto !important; - width: 700px; -} - -span.wrapped pre { - word-wrap: break-word; - white-space: pre-wrap; - word-break: break-all; -} - -label.hidden { - display: none; -} \ No newline at end of file diff --git a/build/reports/tests/test/css/style.css b/build/reports/tests/test/css/style.css deleted file mode 100644 index 3dc4913e7a077a1f1f3810b1f20cc9275fb236bf..0000000000000000000000000000000000000000 --- a/build/reports/tests/test/css/style.css +++ /dev/null @@ -1,84 +0,0 @@ - -#summary { - margin-top: 30px; - margin-bottom: 40px; -} - -#summary table { - border-collapse: collapse; -} - -#summary td { - vertical-align: top; -} - -.breadcrumbs, .breadcrumbs a { - color: #606060; -} - -.infoBox { - width: 110px; - padding-top: 15px; - padding-bottom: 15px; - text-align: center; -} - -.infoBox p { - margin: 0; -} - -.counter, .percent { - font-size: 120%; - font-weight: bold; - margin-bottom: 8px; -} - -#duration { - width: 125px; -} - -#successRate, .summaryGroup { - border: solid 2px #d0d0d0; - -moz-border-radius: 10px; - border-radius: 10px; -} - -#successRate { - width: 140px; - margin-left: 35px; -} - -#successRate .percent { - font-size: 180%; -} - -.success, .success a { - color: #008000; -} - -div.success, #successRate.success { - background-color: #bbd9bb; - border-color: #008000; -} - -.failures, .failures a { - color: #b60808; -} - -.skipped, .skipped a { - color: #c09853; -} - -div.failures, #successRate.failures { - background-color: #ecdada; - border-color: #b60808; -} - -ul.linkList { - padding-left: 0; -} - -ul.linkList li { - list-style: none; - margin-bottom: 5px; -} diff --git a/build/reports/tests/test/index.html b/build/reports/tests/test/index.html deleted file mode 100644 index 6745010e7e1ed0ce0dfbbaf18cf8f3aeeeff484e..0000000000000000000000000000000000000000 --- a/build/reports/tests/test/index.html +++ /dev/null @@ -1,133 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> -<meta http-equiv="x-ua-compatible" content="IE=edge"/> -<title>Test results - Test Summary</title> -<link href="css/base-style.css" rel="stylesheet" type="text/css"/> -<link href="css/style.css" rel="stylesheet" type="text/css"/> -<script src="js/report.js" type="text/javascript"></script> -</head> -<body> -<div id="content"> -<h1>Test Summary</h1> -<div id="summary"> -<table> -<tr> -<td> -<div class="summaryGroup"> -<table> -<tr> -<td> -<div class="infoBox" id="tests"> -<div class="counter">4</div> -<p>tests</p> -</div> -</td> -<td> -<div class="infoBox" id="failures"> -<div class="counter">0</div> -<p>failures</p> -</div> -</td> -<td> -<div class="infoBox" id="ignored"> -<div class="counter">0</div> -<p>ignored</p> -</div> -</td> -<td> -<div class="infoBox" id="duration"> -<div class="counter">0.098s</div> -<p>duration</p> -</div> -</td> -</tr> -</table> -</div> -</td> -<td> -<div class="infoBox success" id="successRate"> -<div class="percent">100%</div> -<p>successful</p> -</div> -</td> -</tr> -</table> -</div> -<div id="tabs"> -<ul class="tabLinks"> -<li> -<a href="#tab0">Packages</a> -</li> -<li> -<a href="#tab1">Classes</a> -</li> -</ul> -<div id="tab0" class="tab"> -<h2>Packages</h2> -<table> -<thead> -<tr> -<th>Package</th> -<th>Tests</th> -<th>Failures</th> -<th>Ignored</th> -<th>Duration</th> -<th>Success rate</th> -</tr> -</thead> -<tbody> -<tr> -<td class="success"> -<a href="packages/model.html">model</a> -</td> -<td>4</td> -<td>0</td> -<td>0</td> -<td>0.098s</td> -<td class="success">100%</td> -</tr> -</tbody> -</table> -</div> -<div id="tab1" class="tab"> -<h2>Classes</h2> -<table> -<thead> -<tr> -<th>Class</th> -<th>Tests</th> -<th>Failures</th> -<th>Ignored</th> -<th>Duration</th> -<th>Success rate</th> -</tr> -</thead> -<tbody> -<tr> -<td class="success"> -<a href="classes/model.FirefighterBoardTest.html">model.FirefighterBoardTest</a> -</td> -<td>4</td> -<td>0</td> -<td>0</td> -<td>0.098s</td> -<td class="success">100%</td> -</tr> -</tbody> -</table> -</div> -</div> -<div id="footer"> -<p> -<div> -<label class="hidden" id="label-for-line-wrapping-toggle" for="line-wrapping-toggle">Wrap lines -<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/> -</label> -</div>Generated by -<a href="http://www.gradle.org">Gradle 8.10.2</a> at 16 nov. 2024, 18:17:08</p> -</div> -</div> -</body> -</html> diff --git a/build/reports/tests/test/js/report.js b/build/reports/tests/test/js/report.js deleted file mode 100644 index 83bab4a19f36a6f460c6747ad6b7252f63a1fad3..0000000000000000000000000000000000000000 --- a/build/reports/tests/test/js/report.js +++ /dev/null @@ -1,194 +0,0 @@ -(function (window, document) { - "use strict"; - - var tabs = {}; - - function changeElementClass(element, classValue) { - if (element.getAttribute("className")) { - element.setAttribute("className", classValue); - } else { - element.setAttribute("class", classValue); - } - } - - function getClassAttribute(element) { - if (element.getAttribute("className")) { - return element.getAttribute("className"); - } else { - return element.getAttribute("class"); - } - } - - function addClass(element, classValue) { - changeElementClass(element, getClassAttribute(element) + " " + classValue); - } - - function removeClass(element, classValue) { - changeElementClass(element, getClassAttribute(element).replace(classValue, "")); - } - - function initTabs() { - var container = document.getElementById("tabs"); - - tabs.tabs = findTabs(container); - tabs.titles = findTitles(tabs.tabs); - tabs.headers = findHeaders(container); - tabs.select = select; - tabs.deselectAll = deselectAll; - tabs.select(0); - - return true; - } - - function getCheckBox() { - return document.getElementById("line-wrapping-toggle"); - } - - function getLabelForCheckBox() { - return document.getElementById("label-for-line-wrapping-toggle"); - } - - function findCodeBlocks() { - var spans = document.getElementById("tabs").getElementsByTagName("span"); - var codeBlocks = []; - for (var i = 0; i < spans.length; ++i) { - if (spans[i].className.indexOf("code") >= 0) { - codeBlocks.push(spans[i]); - } - } - return codeBlocks; - } - - function forAllCodeBlocks(operation) { - var codeBlocks = findCodeBlocks(); - - for (var i = 0; i < codeBlocks.length; ++i) { - operation(codeBlocks[i], "wrapped"); - } - } - - function toggleLineWrapping() { - var checkBox = getCheckBox(); - - if (checkBox.checked) { - forAllCodeBlocks(addClass); - } else { - forAllCodeBlocks(removeClass); - } - } - - function initControls() { - if (findCodeBlocks().length > 0) { - var checkBox = getCheckBox(); - var label = getLabelForCheckBox(); - - checkBox.onclick = toggleLineWrapping; - checkBox.checked = false; - - removeClass(label, "hidden"); - } - } - - function switchTab() { - var id = this.id.substr(1); - - for (var i = 0; i < tabs.tabs.length; i++) { - if (tabs.tabs[i].id === id) { - tabs.select(i); - break; - } - } - - return false; - } - - function select(i) { - this.deselectAll(); - - changeElementClass(this.tabs[i], "tab selected"); - changeElementClass(this.headers[i], "selected"); - - while (this.headers[i].firstChild) { - this.headers[i].removeChild(this.headers[i].firstChild); - } - - var h2 = document.createElement("H2"); - - h2.appendChild(document.createTextNode(this.titles[i])); - this.headers[i].appendChild(h2); - } - - function deselectAll() { - for (var i = 0; i < this.tabs.length; i++) { - changeElementClass(this.tabs[i], "tab deselected"); - changeElementClass(this.headers[i], "deselected"); - - while (this.headers[i].firstChild) { - this.headers[i].removeChild(this.headers[i].firstChild); - } - - var a = document.createElement("A"); - - a.setAttribute("id", "ltab" + i); - a.setAttribute("href", "#tab" + i); - a.onclick = switchTab; - a.appendChild(document.createTextNode(this.titles[i])); - - this.headers[i].appendChild(a); - } - } - - function findTabs(container) { - return findChildElements(container, "DIV", "tab"); - } - - function findHeaders(container) { - var owner = findChildElements(container, "UL", "tabLinks"); - return findChildElements(owner[0], "LI", null); - } - - function findTitles(tabs) { - var titles = []; - - for (var i = 0; i < tabs.length; i++) { - var tab = tabs[i]; - var header = findChildElements(tab, "H2", null)[0]; - - header.parentNode.removeChild(header); - - if (header.innerText) { - titles.push(header.innerText); - } else { - titles.push(header.textContent); - } - } - - return titles; - } - - function findChildElements(container, name, targetClass) { - var elements = []; - var children = container.childNodes; - - for (var i = 0; i < children.length; i++) { - var child = children.item(i); - - if (child.nodeType === 1 && child.nodeName === name) { - if (targetClass && child.className.indexOf(targetClass) < 0) { - continue; - } - - elements.push(child); - } - } - - return elements; - } - - // Entry point. - - window.onload = function() { - initTabs(); - initControls(); - }; -} (window, window.document)); \ No newline at end of file diff --git a/build/reports/tests/test/packages/model.html b/build/reports/tests/test/packages/model.html deleted file mode 100644 index 513bbe36966c97444128570caef41f9ff98dbd8c..0000000000000000000000000000000000000000 --- a/build/reports/tests/test/packages/model.html +++ /dev/null @@ -1,103 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> -<meta http-equiv="x-ua-compatible" content="IE=edge"/> -<title>Test results - Package model</title> -<link href="../css/base-style.css" rel="stylesheet" type="text/css"/> -<link href="../css/style.css" rel="stylesheet" type="text/css"/> -<script src="../js/report.js" type="text/javascript"></script> -</head> -<body> -<div id="content"> -<h1>Package model</h1> -<div class="breadcrumbs"> -<a href="../index.html">all</a> > model</div> -<div id="summary"> -<table> -<tr> -<td> -<div class="summaryGroup"> -<table> -<tr> -<td> -<div class="infoBox" id="tests"> -<div class="counter">4</div> -<p>tests</p> -</div> -</td> -<td> -<div class="infoBox" id="failures"> -<div class="counter">0</div> -<p>failures</p> -</div> -</td> -<td> -<div class="infoBox" id="ignored"> -<div class="counter">0</div> -<p>ignored</p> -</div> -</td> -<td> -<div class="infoBox" id="duration"> -<div class="counter">0.098s</div> -<p>duration</p> -</div> -</td> -</tr> -</table> -</div> -</td> -<td> -<div class="infoBox success" id="successRate"> -<div class="percent">100%</div> -<p>successful</p> -</div> -</td> -</tr> -</table> -</div> -<div id="tabs"> -<ul class="tabLinks"> -<li> -<a href="#tab0">Classes</a> -</li> -</ul> -<div id="tab0" class="tab"> -<h2>Classes</h2> -<table> -<thead> -<tr> -<th>Class</th> -<th>Tests</th> -<th>Failures</th> -<th>Ignored</th> -<th>Duration</th> -<th>Success rate</th> -</tr> -</thead> -<tr> -<td class="success"> -<a href="../classes/model.FirefighterBoardTest.html">FirefighterBoardTest</a> -</td> -<td>4</td> -<td>0</td> -<td>0</td> -<td>0.098s</td> -<td class="success">100%</td> -</tr> -</table> -</div> -</div> -<div id="footer"> -<p> -<div> -<label class="hidden" id="label-for-line-wrapping-toggle" for="line-wrapping-toggle">Wrap lines -<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/> -</label> -</div>Generated by -<a href="http://www.gradle.org">Gradle 8.10.2</a> at 16 nov. 2024, 18:17:08</p> -</div> -</div> -</body> -</html> diff --git a/build/scripts/firefighter b/build/scripts/firefighter deleted file mode 100755 index 2d0d80b9a9480c8c5de330291d4133ac325cc1ec..0000000000000000000000000000000000000000 --- a/build/scripts/firefighter +++ /dev/null @@ -1,251 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# - -############################################################################## -# -# firefighter start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh firefighter -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and FIREFIGHTER_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} -# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd -P "${APP_HOME:-./}.." > /dev/null && printf '%s -' "$PWD" ) || exit - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/lib/firefighter.jar:$APP_HOME/lib/javafx-fxml-21-win.jar:$APP_HOME/lib/javafx-controls-21-win.jar:$APP_HOME/lib/javafx-graphics-21-win.jar:$APP_HOME/lib/javafx-base-21-win.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - if ! command -v java >/dev/null 2>&1 - then - die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and FIREFIGHTER_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - - -# Add default JVM options here. You can also use JAVA_OPTS and FIREFIGHTER_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, -# and any embedded shellness will be escaped. -# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be -# treated as '${Hostname}' itself on the command line. - -set -- \ - -classpath "$CLASSPATH" \ - app.SimulatorMain \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $FIREFIGHTER_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/build/scripts/firefighter.bat b/build/scripts/firefighter.bat deleted file mode 100644 index 857694a25003015075bc2c5b0a8c46e60790987d..0000000000000000000000000000000000000000 --- a/build/scripts/firefighter.bat +++ /dev/null @@ -1,94 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem -@rem SPDX-License-Identifier: Apache-2.0 -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem firefighter startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME%.. - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and FIREFIGHTER_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\lib\firefighter.jar;%APP_HOME%\lib\javafx-fxml-21-win.jar;%APP_HOME%\lib\javafx-controls-21-win.jar;%APP_HOME%\lib\javafx-graphics-21-win.jar;%APP_HOME%\lib\javafx-base-21-win.jar - - -@rem Execute firefighter -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %FIREFIGHTER_OPTS% -classpath "%CLASSPATH%" app.SimulatorMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable FIREFIGHTER_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%FIREFIGHTER_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/build/scriptsShadow/firefighter b/build/scriptsShadow/firefighter deleted file mode 100755 index ecdb49f7161492f27d686545536b691fbc98cf31..0000000000000000000000000000000000000000 --- a/build/scriptsShadow/firefighter +++ /dev/null @@ -1,183 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -## -## firefighter start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/.." >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="firefighter" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and FIREFIGHTER_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/lib/firefighter-all.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $FIREFIGHTER_OPTS -jar "\"$CLASSPATH\"" "$APP_ARGS" - -exec "$JAVACMD" "$@" \ No newline at end of file diff --git a/build/scriptsShadow/firefighter.bat b/build/scriptsShadow/firefighter.bat deleted file mode 100644 index 9d9829681fb66d0a67461026443aef372fc9b694..0000000000000000000000000000000000000000 --- a/build/scriptsShadow/firefighter.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem firefighter startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME%.. - -@rem Add default JVM options here. You can also use JAVA_OPTS and FIREFIGHTER_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\lib\firefighter-all.jar - -@rem Execute firefighter -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %FIREFIGHTER_OPTS% -jar "%CLASSPATH%" %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable FIREFIGHTER_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%FIREFIGHTER_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega \ No newline at end of file diff --git a/build/test-results/test/TEST-model.FirefighterBoardTest.xml b/build/test-results/test/TEST-model.FirefighterBoardTest.xml deleted file mode 100644 index 25b19d0fe71cd92c90d777d2be6487ddeb36aa41..0000000000000000000000000000000000000000 --- a/build/test-results/test/TEST-model.FirefighterBoardTest.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<testsuite name="model.FirefighterBoardTest" tests="4" skipped="0" failures="0" errors="0" timestamp="2024-11-16T17:17:08" hostname="DESKTOP-ETSE1TF" time="0.103"> - <properties/> - <testcase name="testColumnCount()" classname="model.FirefighterBoardTest" time="0.078"/> - <testcase name="testGetState_afterSet()" classname="model.FirefighterBoardTest" time="0.016"/> - <testcase name="testRowCount()" classname="model.FirefighterBoardTest" time="0.002"/> - <testcase name="testStepNumber()" classname="model.FirefighterBoardTest" time="0.002"/> - <system-out><![CDATA[]]></system-out> - <system-err><![CDATA[]]></system-err> -</testsuite> diff --git a/build/test-results/test/binary/output.bin b/build/test-results/test/binary/output.bin deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/build/test-results/test/binary/output.bin.idx b/build/test-results/test/binary/output.bin.idx deleted file mode 100644 index f76dd238ade08917e6712764a16a22005a50573d..0000000000000000000000000000000000000000 Binary files a/build/test-results/test/binary/output.bin.idx and /dev/null differ diff --git a/build/test-results/test/binary/results.bin b/build/test-results/test/binary/results.bin deleted file mode 100644 index a107e74bac0a156950871a4a3fe83cd91a688753..0000000000000000000000000000000000000000 Binary files a/build/test-results/test/binary/results.bin and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/Cloud.class.uniqueId0 b/build/tmp/compileJava/compileTransaction/stash-dir/Cloud.class.uniqueId0 deleted file mode 100644 index 156cea833bbe8aa84054ee652a14bcc4cb4dd6af..0000000000000000000000000000000000000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/Cloud.class.uniqueId0 and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CloudBehavior.class.uniqueId1 b/build/tmp/compileJava/compileTransaction/stash-dir/CloudBehavior.class.uniqueId1 deleted file mode 100644 index 3ad38aa3bff7463d78172a67ea3690988776ca78..0000000000000000000000000000000000000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CloudBehavior.class.uniqueId1 and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/Controller.class.uniqueId4 b/build/tmp/compileJava/compileTransaction/stash-dir/Controller.class.uniqueId4 deleted file mode 100644 index 6a04f4e1dcb90af98351b81bb8c0a5fe71e3561a..0000000000000000000000000000000000000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/Controller.class.uniqueId4 and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/FFBoard.class.uniqueId0 b/build/tmp/compileJava/compileTransaction/stash-dir/FFBoard.class.uniqueId0 new file mode 100644 index 0000000000000000000000000000000000000000..c9b8a72cb01f2a502c5697bcf5525fd49946aace Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/FFBoard.class.uniqueId0 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/FFBoard.class.uniqueId2 b/build/tmp/compileJava/compileTransaction/stash-dir/FFBoard.class.uniqueId2 deleted file mode 100644 index 770c4b78d8b83bd349ad7254c49a7da8f56f4be5..0000000000000000000000000000000000000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/FFBoard.class.uniqueId2 and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/ModelElement.class.uniqueId2 b/build/tmp/compileJava/compileTransaction/stash-dir/ModelElement.class.uniqueId2 new file mode 100644 index 0000000000000000000000000000000000000000..133014562eb460bf29442abefb2f7666149c8cc6 Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/ModelElement.class.uniqueId2 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/StandardFireFighter.class.uniqueId3 b/build/tmp/compileJava/compileTransaction/stash-dir/StandardFireFighter.class.uniqueId3 new file mode 100644 index 0000000000000000000000000000000000000000..e50baa20089256b969478bf81fa2a00ffb4e2f73 Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/StandardFireFighter.class.uniqueId3 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/module-info.class.uniqueId3 b/build/tmp/compileJava/compileTransaction/stash-dir/module-info.class.uniqueId1 similarity index 100% rename from build/tmp/compileJava/compileTransaction/stash-dir/module-info.class.uniqueId3 rename to build/tmp/compileJava/compileTransaction/stash-dir/module-info.class.uniqueId1 diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin index adfdf01ff14dd739f86daea19c6ec049490b0f9f..d61a78cf073388e04d0cd756b75702ada7870d81 100644 Binary files a/build/tmp/compileJava/previous-compilation-data.bin and b/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/build/tmp/compileTestJava/compileTransaction/stash-dir/FirefighterBoardTest.class.uniqueId0 b/build/tmp/compileTestJava/compileTransaction/stash-dir/FirefighterBoardTest.class.uniqueId0 deleted file mode 100644 index 21d13f1cc1402592912e6a62f579ee1dcbfca7ef..0000000000000000000000000000000000000000 Binary files a/build/tmp/compileTestJava/compileTransaction/stash-dir/FirefighterBoardTest.class.uniqueId0 and /dev/null differ diff --git a/build/tmp/compileTestJava/previous-compilation-data.bin b/build/tmp/compileTestJava/previous-compilation-data.bin deleted file mode 100644 index 52c7a82cea64dd185ab8069082e50a8050625d84..0000000000000000000000000000000000000000 Binary files a/build/tmp/compileTestJava/previous-compilation-data.bin and /dev/null differ diff --git a/build/tmp/jar/MANIFEST.MF b/build/tmp/jar/MANIFEST.MF deleted file mode 100644 index 59499bce4a2bd51cba227b7c00fcf745b19c95a4..0000000000000000000000000000000000000000 --- a/build/tmp/jar/MANIFEST.MF +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0 - diff --git a/build/tmp/shadowJar/MANIFEST.MF b/build/tmp/shadowJar/MANIFEST.MF deleted file mode 100644 index 2c5dafadb5f53a219e1c22537b872baf7d0b350d..0000000000000000000000000000000000000000 --- a/build/tmp/shadowJar/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: app.SimulatorMain - diff --git a/src/main/java/app/SimulatorApplication.java b/src/main/java/app/SimulatorApplication.java index 09638001b8ccac68352006236c540ffab80eeffd..6170fd9f819229fb6f3e9b7c6539946648b30c55 100644 --- a/src/main/java/app/SimulatorApplication.java +++ b/src/main/java/app/SimulatorApplication.java @@ -12,7 +12,7 @@ import java.net.URL; public class SimulatorApplication extends javafx.application.Application { private static final String VIEW_RESOURCE_PATH = "/view/view.fxml"; - private static final String APP_NAME = "StandardFirefighter simulator"; + private static final String APP_NAME = "FirefighterManager simulator"; private static final int ROW_COUNT = 20; private static final int COLUMN_COUNT = 20; private static final int BOX_WIDTH = 50; diff --git a/src/main/java/model/Behavior.java b/src/main/java/model/Behavior.java index 3e5c114d47d48d52f59228ea86b0ba1e53ca5068..fe9bf22a184cd32ec6ed411243902becd9eb4db8 100644 --- a/src/main/java/model/Behavior.java +++ b/src/main/java/model/Behavior.java @@ -6,6 +6,9 @@ import java.util.List; import java.util.Map; public interface Behavior { - public List<Position> getNext(BoardData boardData); - public Map<Position,List<Position>> legalNeighbors(BoardData boardData); + public List<Position> update(BoardData boardData,Element element); + + public List<Position> legalNeighbors(BoardData boardData,Position position); + + public Map<Position, List<Position>> allLegalNeighbors(BoardData boardData); } \ No newline at end of file diff --git a/src/main/java/model/BoardData.java b/src/main/java/model/BoardData.java index b7371b7ab4eeab33311cc7b76244f6fcf53f296e..480058ee90beae0af405d2dc67304f322a856282 100644 --- a/src/main/java/model/BoardData.java +++ b/src/main/java/model/BoardData.java @@ -6,8 +6,10 @@ import java.util.List; import java.util.Map; public interface BoardData { - public List<List<Position>> getPositions(); - public void setPositions( List<List<Position>> Positions); + public List<List<Element>> getElements(); + public Cell<Element> getCell(Position position); + public void addElement(Element element); + public void removeElement(Element element); public Map<Position, List<Position>> getNeighbors(); public List<Position> getNeighbor(Position position); public int getStep(); diff --git a/src/main/java/model/Cell.java b/src/main/java/model/Cell.java new file mode 100644 index 0000000000000000000000000000000000000000..4430300eeef30376deb2419f264fff8a1ed331ad --- /dev/null +++ b/src/main/java/model/Cell.java @@ -0,0 +1,18 @@ +package model; + +import util.Position; + +import java.util.ArrayList; +import java.util.List; + +public class Cell <E>{ + List<E> Content; + Position position; + + public Cell(Position position) { + this.position=position; + Content=new ArrayList<>(); + } + + +} diff --git a/src/main/java/model/Cloud.java b/src/main/java/model/Cloud.java index 4afaa3d824f4b8edfae955e4cafeb719655f2dee..32bbe25a00111192fe4122eeb345fd0599e81edf 100644 --- a/src/main/java/model/Cloud.java +++ b/src/main/java/model/Cloud.java @@ -1,28 +1,37 @@ package model; import util.Position; -import util.TargetStrategy; import java.util.ArrayList; import java.util.List; -public class Cloud extends Element { +public class Cloud implements Element,Updatable{ + ModelElement type; + Position position; +static Behavior behavior=new CloudBehavior(); - public Cloud() { - super(ModelElement.CLOUD, - new CloudBehavior(ModelElement.CLOUD)); - } - - @Override - public List<Position> Update(BoardData boardData, List<Position> modifiedPositions) { - List<Position> cloudPositions=boardData.getPositions().get(type.ordinal()); - List<Position> newCloudPositions=behavior.getNext(boardData); - modifiedPositions.removeAll(cloudPositions); - modifiedPositions.addAll(cloudPositions); - modifiedPositions.removeAll(newCloudPositions); - modifiedPositions.addAll(newCloudPositions); - cloudPositions.clear(); - cloudPositions.addAll(newCloudPositions); - return modifiedPositions; - } +public Cloud(Position position) { + this.type = ModelElement.CLOUD; + this.position = position; + } +@Override +public Position getPosition() { + return position; + } +@Override +public ModelElement getType() { + return type; + } +@Override +public List<Position> updateSelf(BoardData boardData) { + List<Position> positions=behavior.update(boardData,this); + List<Position> modifPositions=new ArrayList<>(positions); + modifPositions.add(this.getPosition()); + for (Position p:positions) { + boardData.removeElement(this); + this.position=p; + boardData.addElement(this); + } + return modifPositions; + } } diff --git a/src/main/java/model/CloudBehavior.java b/src/main/java/model/CloudBehavior.java index 44636179318b1351c678d13f4b471b872cb109d1..ea392b040603e844581094ac31d7bdf55478bedf 100644 --- a/src/main/java/model/CloudBehavior.java +++ b/src/main/java/model/CloudBehavior.java @@ -1,46 +1,43 @@ package model; +import model.BoardData; +import model.FFBehavior; +import model.ModelElement; +import model.RemoverBehavior; import util.Position; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; +import java.util.*; public class CloudBehavior extends FFBehavior implements RemoverBehavior<ModelElement> { - private final ModelElement removedElement=ModelElement.FIRE; + private final ModelElement removedElement=ModelElement.CLOUD; private final Random random=new Random(); - public CloudBehavior(ModelElement modelElement) { - super(ModelElement.CLOUD); - } @Override - public List<Position> getNext(BoardData boardData) { - List<Position> cloudPositions=boardData.getPositions().get(element.ordinal()); - List<Position> newCloudPositions=new ArrayList<>(); - for (Position cloudPosition:cloudPositions) { - List<Position> newPossibleCloudPosition=boardData.getNeighbors().get(cloudPosition); - Position newCloudPosition= newPossibleCloudPosition.get(random.nextInt(newPossibleCloudPosition.size())); - newCloudPositions.add(newCloudPosition); - remove(boardData,newCloudPosition); - } - return newCloudPositions; + public List<Position> update(BoardData boardData,Element element) { + Position position; + position=boardData.getNeighbor(element.getPosition()).get(random.nextInt(boardData.getNeighbor(element.getPosition()).size())); + extinguish(boardData,position); + return List.of(position); } - - - @Override - public ModelElement getElementToRemove() { - return removedElement; + private void extinguish(BoardData boardData,Position position){ + List<Position> l=new ArrayList<>(legalNeighbors(boardData,position)); + l.add(position); + for (Position p:l) { + List<Element> c=new ArrayList<>(boardData.getCell(p).Content); + for (Element e:c) { + if (e instanceof Fire){ + + boardData.removeElement(e);} + } + } } - @Override - public void removePartial(BoardData boardData,Position p) { - List<Position> firePositions = boardData.getPositions().get(getElementToRemove().ordinal()); - firePositions.remove(p); + public List<Position> legalNeighbors(BoardData boardData,Position position) { + return List.copyOf(boardData.getNeighbor(position)); } - @Override - public List<Position> remove(BoardData boardData, Position p) { - removePartial(boardData,p); - return List.of(p); + public Map<Position, List<Position>> allLegalNeighbors(BoardData boardData) { + Map<Position, List<Position>> neighbors=Map.copyOf(boardData.getNeighbors()); + return neighbors; } } diff --git a/src/main/java/model/Element.java b/src/main/java/model/Element.java index df9b042be6b27129cdebe4be906ad00251104334..c07f6c105fc11219a9ab81b930f2ae0e80e86977 100644 --- a/src/main/java/model/Element.java +++ b/src/main/java/model/Element.java @@ -2,16 +2,8 @@ package model; import util.Position; -import java.util.ArrayList; -import java.util.List; +public interface Element { + Position getPosition(); + ModelElement getType(); -public abstract class Element { - ModelElement type; - Behavior behavior; - List<ModelElement> obstacles; - public Element(ModelElement type, Behavior behavior) { - this.type = type; - this.behavior = behavior; - } - public abstract List<Position> Update(BoardData board, List<Position> modifiedList); } diff --git a/src/main/java/model/ElementManager.java b/src/main/java/model/ElementManager.java new file mode 100644 index 0000000000000000000000000000000000000000..f7f06d8e6968605acca1be1f928afacb3d1ba73f --- /dev/null +++ b/src/main/java/model/ElementManager.java @@ -0,0 +1,14 @@ +package model; + +import util.Position; + +import java.util.List; + +public abstract class ElementManager { + ModelElement type; + List<ModelElement> obstacles; + public ElementManager(ModelElement type) { + this.type = type; + } + public abstract List<Position> Update(BoardData board, List<Position> modifiedList); +} diff --git a/src/main/java/model/FFBehavior.java b/src/main/java/model/FFBehavior.java index d8abbdf1c7949e25e89e243b03e2be34af33f0db..744a30c8b0c802011c595d57e5264b8fdf54dfb1 100644 --- a/src/main/java/model/FFBehavior.java +++ b/src/main/java/model/FFBehavior.java @@ -8,17 +8,5 @@ import java.util.List; import java.util.Map; public abstract class FFBehavior implements Behavior { - public ModelElement element; - public FFBehavior(ModelElement element) { - this.element = element; - } - - @Override - public Map<Position, List<Position>> legalNeighbors(BoardData boardData) { - Map<Position,List<Position>> neighbors=new HashMap<>(); - for (Map.Entry<Position,List<Position>> entry: boardData.getNeighbors().entrySet()) { - neighbors.put(entry.getKey(),new ArrayList<Position>(List.copyOf(entry.getValue()))); - } - return neighbors; - } + public Element element; } \ No newline at end of file diff --git a/src/main/java/model/FFBoard.java b/src/main/java/model/FFBoard.java index 5f143a5bab00577b83a0d40fabb4c8149337d157..2fe2d4b61cdbc833135be36b82e769243cce6a71 100644 --- a/src/main/java/model/FFBoard.java +++ b/src/main/java/model/FFBoard.java @@ -3,6 +3,7 @@ package model; import util.Position; import util.TargetStrategy; +import java.lang.reflect.InvocationTargetException; import java.util.*; @@ -11,9 +12,7 @@ public class FFBoard implements Board<List<ModelElement>> { private final int rowCount; private final int initialFireCount; private final int initialFirefighterCount; - private final TargetStrategy targetStrategy = new TargetStrategy(); private BoardData boardData; - private final Position[][] positions; private FFUpdater FFUpdater ; private final Random randomGenerator = new Random(); @@ -22,19 +21,6 @@ public class FFBoard implements Board<List<ModelElement>> { FFUpdater=new FFUpdater(); this.columnCount = columnCount; this.rowCount = rowCount; - this.positions = new Position[rowCount][columnCount]; - for (int column = 0; column < columnCount; column++) - for (int row = 0; row < rowCount; row++) - positions[row][column] = new Position(row, column); - for (int column = 0; column < columnCount; column++) - for (int row = 0; row < rowCount; row++) { - List<Position> list = new ArrayList<>(); - if (row > 0) list.add(positions[row - 1][column]); - if (column > 0) list.add(positions[row][column - 1]); - if (row < rowCount - 1) list.add(positions[row + 1][column]); - if (column < columnCount - 1) list.add(positions[row][column + 1]); - boardData.getNeighbors().put(positions[row][column], list); - } this.initialFireCount = initialFireCount; this.initialFirefighterCount = initialFirefighterCount; initializeElements(); @@ -44,13 +30,13 @@ public class FFBoard implements Board<List<ModelElement>> { boardData.initialize(); FFUpdater= new FFUpdater(); for (int index = 0; index < initialFireCount; index++) - boardData.getPositions().get(ModelElement.FIRE.ordinal()).add(randomPosition()); + boardData.addElement(new StandardFire(randomPosition())); for (int index = 0; index < initialFirefighterCount; index++) - boardData.getPositions().get(ModelElement.FIREFIGHTER.ordinal()).add(randomPosition()); + boardData.addElement(new StandardFireFighter(randomPosition())); for (int index = 0; index < 10; index++) - boardData.getPositions().get(ModelElement.CLOUD.ordinal()).add(randomPosition()); + boardData.addElement(new Cloud(randomPosition())); for (int index = 0; index < 50; index++) - boardData.getPositions().get(ModelElement.MOUNTAIN.ordinal()).add(randomPosition()); + boardData.addElement(new Mountain(randomPosition())); } @@ -60,11 +46,9 @@ public class FFBoard implements Board<List<ModelElement>> { @Override public List<ModelElement> getState(Position position) { - List<ModelElement> result = new ArrayList<>(); - for (ModelElement e:ModelElement.values()) { - for (Position p : boardData.getPositions().get(e.ordinal())) - if (p.equals(position)) - result.add(e); + List<ModelElement> result=new ArrayList<>(); + for (Element e:boardData.getCell(position).Content) { + result.add(e.getType()); } return result; } @@ -85,49 +69,18 @@ public class FFBoard implements Board<List<ModelElement>> { boardData.setStep(boardData.getStep()+1); return modifiedPositions; } - - @Override public int stepNumber() { return boardData.getStep(); } - - /*private List<Position> updateFirefighters() { - List<Position> modifiedPosition = new ArrayList<>(); - List<Position> firefighterPositions = boardData.getPositions().get(ModelElement.FIREFIGHTER.ordinal()); - List<Position> firePositions = boardData.getPositions().get(ModelElement.FIRE.ordinal()); - List<Position> firefighterNewPositions = new ArrayList<>(); - for (Position firefighterPosition : firefighterPositions) { - Position newFirefighterPosition = - targetStrategy.neighborClosestToFire(firefighterPosition, - firePositions, boardData.getNeighbors()); - firefighterNewPositions.add(newFirefighterPosition); - extinguish(newFirefighterPosition); - modifiedPosition.add(firefighterPosition); - modifiedPosition.add(newFirefighterPosition); - List<Position> neighborFirePositions = boardData.getNeighbors().get(newFirefighterPosition).stream() - .filter(firePositions::contains).toList(); - for (Position firePosition : neighborFirePositions) - extinguish(firePosition); - modifiedPosition.addAll(neighborFirePositions); - } - firefighterPositions = firefighterNewPositions; - return modifiedPosition; - }*/ - @Override public void reset() { initializeElements(); } - - @Override public void setState(List<ModelElement> state, Position position) { - for (ModelElement e:ModelElement.values()) { - boardData.getPositions().get(e.ordinal()).remove(position); - } - for (ModelElement e:state) { - boardData.getPositions().get(e.ordinal()).add(position); + for (ModelElement modelElement: state) { + boardData.addElement(modelElement.instanciate(position)); } } } \ No newline at end of file diff --git a/src/main/java/model/FFBoardData.java b/src/main/java/model/FFBoardData.java index 65684d49cd95c08eadbe7037ac7f17d7916da1c0..2ab57bf9fba7b3fdeba1a9e8a2fdc4770a143a2b 100644 --- a/src/main/java/model/FFBoardData.java +++ b/src/main/java/model/FFBoardData.java @@ -5,11 +5,12 @@ import util.Position; import java.util.*; public class FFBoardData implements BoardData{ - private List<List<Position>> positions; + + private List<List<Element>> elementList; private Map<Position, List<Position>> neighbors = new HashMap<Position, List<Position>>(); private int step; private int columnCount,rowCount; - + private List<List<Cell<Element>>> cells; public FFBoardData(int columnCount, int rowCount) { this.columnCount=columnCount; this.rowCount=rowCount; @@ -19,9 +20,14 @@ public class FFBoardData implements BoardData{ step=0; neighbors = new HashMap<Position, List<Position>>(); Position[][] ps = new Position[rowCount][columnCount]; - for (int column = 0; column < columnCount; column++) - for (int row = 0; row < rowCount; row++) + cells=new ArrayList<>(); + for (int column = 0; column < columnCount; column++){ + cells.add(new ArrayList<>()); + for (int row = 0; row < rowCount; row++){ ps[row][column] = new Position(row, column); + cells.get(column).add(new Cell<>(ps[row][column])); + } + } for (int column = 0; column < columnCount; column++) for (int row = 0; row < rowCount; row++) { List<Position> list = new ArrayList<>(); @@ -31,28 +37,37 @@ public class FFBoardData implements BoardData{ if (column < columnCount - 1) list.add(ps[row][column + 1]); getNeighbors().put(ps[row][column], list); } - positions = new ArrayList<>(); + elementList = new ArrayList<>(); for (int i = 0; i < ModelElement.values().length; i++) { - positions.add(new ArrayList<>()); + elementList.add(new ArrayList<>()); } } - public List<List<Position>> getPositions() { - return positions; - } - public List<Position> getPositions(ModelElement modelElement) { - return positions.get(modelElement.ordinal()); - } - public void setPositions( List<List<Position>> Positions) { - this.positions = Positions; + + @Override + public List<List<Element>> getElements() { + return elementList; } + public Map<Position, List<Position>> getNeighbors() { return neighbors; } public List<Position> getNeighbor(Position position) { return neighbors.get(position); } - + public void addElement(Element element){ + elementList.get(element.getType().ordinal()).add(element); + getCell(element.getPosition()).Content.add(element); + FFUpdater.modifiedPositions.add(element.getPosition()); + } + public void removeElement(Element element){ + FFUpdater.modifiedPositions.add(element.getPosition()); + elementList.get(element.getType().ordinal()).remove(element); + getCell(element.getPosition()).Content.remove(element); + } + public Cell<Element> getCell(Position position){ + return cells.get(position.column()).get(position.row()); + } @Override public int getStep() { return step; diff --git a/src/main/java/model/FFUpdater.java b/src/main/java/model/FFUpdater.java index 7760f02d35b84da4b3c7ed50fac246352c8436d5..39e8c2d265f031eefdbfe6fc836c85e4e21279e4 100644 --- a/src/main/java/model/FFUpdater.java +++ b/src/main/java/model/FFUpdater.java @@ -3,24 +3,35 @@ package model; import util.Position; import java.util.ArrayList; +import java.util.Collection; import java.util.List; public class FFUpdater implements Updater { - Element[] elements; + List<Updatable> updatables; + static List<Position> modifiedPositions=new ArrayList<>(); public FFUpdater() { - this.elements=new Element[ModelElement.values().length]; - for (int i = 0; i < ModelElement.values().length; i++) { - this.elements[i]=ModelElement.values()[i].instanciate(); + updatables=new ArrayList<>(); + } + + public void updateSetup(BoardData boardData) { + updatables.clear(); + modifiedPositions=new ArrayList<Position>(); + for (ModelElement modelElement: ModelElement.values()) { + System.out.println(modelElement+" "+modelElement.isUpdatabale()); + if (modelElement.isUpdatabale()) + for (Element e:boardData.getElements().get(modelElement.ordinal())) { + updatables.add((Updatable) e); + } } } @Override public List<Position> updateAll(BoardData boardData) { - List<Position> modifiedList=new ArrayList<Position>(); - for (int i = 0; i < ModelElement.values().length; i++) { - modifiedList=this.elements[i].Update(boardData,modifiedList); + updateSetup(boardData); + for (Updatable u:updatables){ + u.updateSelf(boardData); } - return modifiedList; + return modifiedPositions; } } diff --git a/src/main/java/model/Fire.java b/src/main/java/model/Fire.java index 21a665d5bb23a7a9df308908c85aa0370e466a99..3cb31a89f822c277f506dbe8fea8ceda45d5dcdf 100644 --- a/src/main/java/model/Fire.java +++ b/src/main/java/model/Fire.java @@ -2,25 +2,45 @@ package model; import util.Position; -import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.stream.Stream; -public class Fire extends Element{ +public abstract class Fire implements Element,Updatable{ + int delay; + ModelElement type; + Position position; + static Behavior behavior=new FireBehavior(); + Map<ModelElement,ModelElement> FireDictionary=new HashMap<>(); //.put(MAISON,FEUMAISON) - public Fire() { - super(ModelElement.FIRE, - new FireBehavior(ModelElement.FIRE)); + public Fire(int delay, ModelElement type, Position position) { + this.delay = delay; + this.type = type; + this.position = position; + } + @Override + public Position getPosition() { + return position; } - @Override - public List<Position> Update(BoardData boardData, List<Position> modifPositions) { - List<Position> firePositions = boardData.getPositions().get(this.type.ordinal()); - List<Position> modifiedPositions = new ArrayList<Position>(modifPositions); - List<Position> newFirePositions = behavior.getNext(boardData); - firePositions.removeAll(newFirePositions); - firePositions.addAll(newFirePositions); - modifiedPositions.removeAll(newFirePositions); - modifiedPositions.addAll(newFirePositions); - return modifiedPositions; + public ModelElement getType() { + return type; + } + private Fire getNewFireByType(BoardData boardData,Position position){ + List<ModelElement> s = boardData.getCell(position).Content.stream().map(x -> x.getType()).toList(); + for(Map.Entry<ModelElement,ModelElement> entry: FireDictionary.entrySet()){ + if (s.contains(entry.getKey())) return (Fire) entry.getValue().instanciate(position); + } + return new StandardFire(position); + } + @Override + public List<Position> updateSelf(BoardData boardData) { + List<Position> positions=behavior.update(boardData,this); + for (Position p:positions) { + + boardData.addElement(new StandardFire(p)); + } + return positions; } } diff --git a/src/main/java/model/FireBehavior.java b/src/main/java/model/FireBehavior.java index 2fe93b5b4b149551abde263395926b9b430a790b..4630bd8ef1e32c48c2b8de53763be6dfe2d221fc 100644 --- a/src/main/java/model/FireBehavior.java +++ b/src/main/java/model/FireBehavior.java @@ -5,15 +5,41 @@ import util.Position; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Set; -public class FireBehavior extends FFBehavior implements TangibleBehavior<ModelElement> { +public class FireBehavior extends FFBehavior /*implements TangibleBehavior<ModelElement>*/ { private List<ModelElement> obstacles=List.of(ModelElement.MOUNTAIN); - public FireBehavior(ModelElement element) { - super(element); + @Override + public List<Position> update(BoardData boardData,Element element) { + List<Position> positions=new ArrayList<>(); + if (boardData.getStep()%((Fire)element).delay==0){ + positions=legalNeighbors(boardData,element.getPosition()); + } + return positions; } - + @Override + public List<Position> legalNeighbors(BoardData boardData,Position position) { + List<Position> neighbors=new ArrayList<>(boardData.getNeighbor(position)); + for (Position p:boardData.getNeighbor(position)) { + for (Element e:boardData.getCell(p).Content) { + if (e instanceof Fire) neighbors.remove(p); + for(ModelElement o:obstacles) + if (e.getType()==o) neighbors.remove(p); + } + } + return neighbors; + } @Override + public Map<Position, List<Position>> allLegalNeighbors(BoardData boardData) { + Map<Position, List<Position>> neighbors=Map.copyOf(boardData.getNeighbors()); + Set<Position> positions =boardData.getNeighbors().keySet(); + for (Position pkey: positions) { + neighbors.replace(pkey,legalNeighbors(boardData,pkey)); + } + return neighbors; + } + /*@Override public List<Position> getNext(BoardData boardData) { List<Position> firePositions = boardData.getPositions().get(element.ordinal()); List<Position> newFirePositions = new ArrayList<>(); @@ -42,5 +68,5 @@ public class FireBehavior extends FFBehavior implements TangibleBehavior<ModelEl } } return neigbors; - } + }*/ } diff --git a/src/main/java/model/FireFighter.java b/src/main/java/model/FireFighter.java new file mode 100644 index 0000000000000000000000000000000000000000..d4928111d28559d6dbf07e2b94fd53701e3c7fdf --- /dev/null +++ b/src/main/java/model/FireFighter.java @@ -0,0 +1,39 @@ +package model; + +import util.Position; + +import java.util.ArrayList; +import java.util.List; + +public abstract class FireFighter implements Element,Updatable{ + int speed; + ModelElement type; + Position position; +static Behavior behavior=new FireFighterBehavior(); + +public FireFighter(int speed, ModelElement type, Position position) { + this.speed = speed; + this.type = type; + this.position = position; + } +@Override +public Position getPosition() { + return position; + } +@Override +public ModelElement getType() { + return type; + } +@Override +public List<Position> updateSelf(BoardData boardData) { + List<Position> positions=behavior.update(boardData,this); + List<Position> modifPositions=new ArrayList<>(positions); + modifPositions.add(this.getPosition()); + for (Position p:positions) { + boardData.removeElement(this); + this.position=p; + boardData.addElement(this); + } + return modifPositions; + } +} diff --git a/src/main/java/model/FireFighterBehavior.java b/src/main/java/model/FireFighterBehavior.java new file mode 100644 index 0000000000000000000000000000000000000000..49344199b4fb242fed69f1c33e8522d51275a3af --- /dev/null +++ b/src/main/java/model/FireFighterBehavior.java @@ -0,0 +1,70 @@ +package model; + +import util.Position; +import util.TargetStrategy; +import java.util.*; + +public class FireFighterBehavior extends FFBehavior implements TangibleBehavior<ModelElement> { + private List<ModelElement> obstacles=List.of(ModelElement.MOUNTAIN); + private TargetStrategy ts=new TargetStrategy(); + + List<Position> initializeTargets(BoardData boardData){ + List<Position> targets=new ArrayList<>(); + for (ModelElement me:ModelElement.values()) { + if (me.isFire()){ + System.out.println("0"); + for (Element e:boardData.getElements().get(me.ordinal())) { + targets.add(e.getPosition()); + }} + } + return targets; + } + @Override + public List<Position> update(BoardData boardData,Element element) { + Position position=element.getPosition(); + List<Position> targets=initializeTargets(boardData); + for (int i=0;i<((FireFighter)element).speed;i++) { + position=ts.neighborClosestToFire(position,targets,allLegalNeighbors(boardData)); + extinguish(boardData,position); + targets.remove(position); + targets.removeAll(boardData.getNeighbor(position)); + } + return List.of(position); + } + + @Override + public List<ModelElement> getObstacles() { + return obstacles; + } + + public void extinguish(BoardData boardData, Position position){ + List<Position> l=new ArrayList<>(legalNeighbors(boardData,position)); + l.add(position); + for (Position p:l) { + List<Element> c=new ArrayList<>(boardData.getCell(p).Content); + for (Element e:c) { + if (e instanceof Fire){ + boardData.removeElement(e);} + } + } + } + @Override + public List<Position> legalNeighbors(BoardData boardData,Position position) { + List<Position> neighbors=new ArrayList<>(boardData.getNeighbor(position)); + for (Position p:boardData.getNeighbor(position)) { + for (Element e:boardData.getCell(p).Content) { + for(ModelElement o:getObstacles()) + if (e.getType()==o) neighbors.remove(p); + } + } + return neighbors; + } + @Override + public Map<Position, List<Position>> allLegalNeighbors(BoardData boardData) { + Map<Position, List<Position>> neighbors= new HashMap<>(Map.copyOf(boardData.getNeighbors())); + for (Position pkey: boardData.getNeighbors().keySet()) { + neighbors.replace(pkey,legalNeighbors(boardData,pkey)); + } + return neighbors; + } +} diff --git a/src/main/java/model/FirefighterBehavior.java b/src/main/java/model/FirefighterBehavior.java deleted file mode 100644 index ca3fe1a519dc11e899a0487fbdd801a280880886..0000000000000000000000000000000000000000 --- a/src/main/java/model/FirefighterBehavior.java +++ /dev/null @@ -1,69 +0,0 @@ -package model; - -import util.Position; -import util.TargetStrategy; - -import java.util.*; - -public class FirefighterBehavior extends FFBehavior implements TangibleBehavior<ModelElement>,RemoverBehavior<ModelElement> { - List<ModelElement> obstacles=List.of(ModelElement.MOUNTAIN); - ModelElement removedElement=ModelElement.FIRE; - TargetStrategy targetStrategy=new TargetStrategy(); - - public FirefighterBehavior(ModelElement modelElement) { - super(modelElement); - } - - - @Override - public List<Position> getNext(BoardData boardData) { - List<Position> firefighterPositions = boardData.getPositions().get(element.ordinal()); - List<Position> firePositions = new ArrayList<>(List.copyOf(boardData.getPositions().get(ModelElement.FIRE.ordinal()))); - List<Position> firefighterNewPositions = new ArrayList<>(); - Map<Position,List<Position>> neigbours=legalNeighbors(boardData); - for (Position firefighterPosition : firefighterPositions) { - Position newFirefighterPosition = targetStrategy.neighborClosestToFire(firefighterPosition,firePositions, neigbours); - firefighterNewPositions.add(newFirefighterPosition); - firePositions.remove(newFirefighterPosition); - firePositions.remove(boardData.getNeighbors().get(newFirefighterPosition)); - } - return firefighterNewPositions; - } - public List<Position> remove(BoardData boardData,Position p){ - List<Position> firePositions = boardData.getPositions().get(getElementToRemove().ordinal()); - List<Position> neighborFirePositions = boardData.getNeighbors().get(p).stream() - .filter(firePositions::contains).toList(); - removePartial(boardData,p); - for (Position firePosition : neighborFirePositions) - removePartial(boardData,firePosition); - return neighborFirePositions; - } - - - @Override - public List<ModelElement> getObstacles() { - return obstacles; - } - - @Override - public void removePartial(BoardData boardData,Position p) { - List<Position> firePositions = boardData.getPositions().get(getElementToRemove().ordinal()); - firePositions.remove(p); - } - - @Override - public Map<Position, List<Position>> legalNeighbors(BoardData boardData) { - Map<Position,List<Position>> neigbours= Map.copyOf(super.legalNeighbors(boardData)); - for (Map.Entry<Position,List<Position>> entry: neigbours.entrySet()) { - for (ModelElement e:getObstacles()) { - entry.getValue().removeAll(boardData.getPositions().get(e.ordinal())); - } - } - return neigbours; - } - - @Override - public ModelElement getElementToRemove() { - return removedElement; - } -} diff --git a/src/main/java/model/ModelElement.java b/src/main/java/model/ModelElement.java index 3b1ee918593447f552b5ef951020e1f0ac2c44da..6727141bc57022333c93b0091f9a8ba739244171 100644 --- a/src/main/java/model/ModelElement.java +++ b/src/main/java/model/ModelElement.java @@ -1,34 +1,60 @@ package model; +import util.Position; + import java.lang.reflect.InvocationTargetException; +import java.util.Arrays; +import java.util.List; public enum ModelElement { - FIREFIGHTER(StandardFirefighter.class), - FIRE(Fire.class), + FIREFIGHTER(StandardFireFighter.class), + FIRE(StandardFire.class), CLOUD(Cloud.class), MOUNTAIN(Mountain.class); + public final Class<?> c; - ModelElement(Class<?> c) { - this.c=c; + ModelElement(Class<?>c) { + this.c =c; System.out.println(c); } - public Element instanciate(){ - Object o=null; + public boolean isUpdatabale(){ + List<Class<?>> Interfaces= Arrays.asList(c.getInterfaces()); + return Interfaces.contains(Updatable.class); + } + public boolean isPrintable(){ + Class<?> currentClass=c; + while(!currentClass.equals(Object.class)){ + if (Arrays.asList(currentClass.getInterfaces()).contains(Printable.class)) return true; + currentClass=currentClass.getSuperclass(); + } + return false; + } + public boolean isFire(){ + Class<?> currentClass=c; + while(!currentClass.equals(Object.class)){ + System.out.println(currentClass+" "+currentClass.equals(Fire.class)); + if (currentClass.equals(Fire.class)) return true; + currentClass=currentClass.getSuperclass(); + } + return false; + } + public Element instanciate(Position position){ + Class<?>[] cs=new Class<?>[]{Position.class}; + Element e= null; try { - o = c.getDeclaredConstructor().newInstance(); - o = c.cast(o); - } catch (InstantiationException e) { - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - throw new RuntimeException(e); - } catch (NoSuchMethodException e) { - throw new RuntimeException(e); + e = (Element) c.getDeclaredConstructor(cs).newInstance(position); + } catch (InstantiationException ex) { + throw new RuntimeException(ex); + } catch (IllegalAccessException ex) { + throw new RuntimeException(ex); + } catch (InvocationTargetException ex) { + throw new RuntimeException(ex); + } catch (NoSuchMethodException ex) { + throw new RuntimeException(ex); } - return (Element) o; + return e; } } diff --git a/src/main/java/model/Mountain.java b/src/main/java/model/Mountain.java index c3baafaa6da9d9f1ae30c853edb82f071a4eccbe..0ca1db409dafed5e3c5100ff9622027119214c5b 100644 --- a/src/main/java/model/Mountain.java +++ b/src/main/java/model/Mountain.java @@ -1,18 +1,26 @@ package model; +import model.Element; import util.Position; import java.util.List; -public class Mountain extends Element{ +public class Mountain implements Element { + Position position; + ModelElement type; - public Mountain() { - super(ModelElement.MOUNTAIN, - new NoBehavior(ModelElement.MOUNTAIN)); + public Mountain(Position position) { + this.position = position; + type=ModelElement.MOUNTAIN; } @Override - public List<Position> Update(BoardData boardData, List<Position> modifPositions) { - return modifPositions; + public Position getPosition() { + return position; + } + + @Override + public ModelElement getType() { + return type; } } diff --git a/src/main/java/model/NoBehavior.java b/src/main/java/model/NoBehavior.java deleted file mode 100644 index dcc3b7df06204aaea7439f0c9e8245013b64671e..0000000000000000000000000000000000000000 --- a/src/main/java/model/NoBehavior.java +++ /dev/null @@ -1,18 +0,0 @@ -package model; - -import util.Position; - -import java.util.List; - -public class NoBehavior extends FFBehavior { - - - public NoBehavior(ModelElement element) { - super(element); - } - - @Override - public List<Position> getNext(BoardData boardData) { - return null; - } -} diff --git a/src/main/java/model/Printable.java b/src/main/java/model/Printable.java new file mode 100644 index 0000000000000000000000000000000000000000..ee65b3a57e88f73d3153e5c8e51f2f9ddf3c9b52 --- /dev/null +++ b/src/main/java/model/Printable.java @@ -0,0 +1,9 @@ +package model; + +import util.Position; + +import java.util.List; + +public interface Printable { + +} diff --git a/src/main/java/model/RemoverBehavior.java b/src/main/java/model/RemoverBehavior.java index 0c3e3c2a417138a5d67a3b9aee027a4dee92cb74..f0a36495113f82e57e5b2d23ff377d2022709f40 100644 --- a/src/main/java/model/RemoverBehavior.java +++ b/src/main/java/model/RemoverBehavior.java @@ -5,7 +5,5 @@ import util.Position; import java.util.List; public interface RemoverBehavior<E> extends Behavior { - public void removePartial(BoardData boardData,Position p); - public List<Position> remove(BoardData boardData,Position p); - public E getElementToRemove(); + } diff --git a/src/main/java/model/StandardFire.java b/src/main/java/model/StandardFire.java new file mode 100644 index 0000000000000000000000000000000000000000..73e9c4cefd310919d1196add96ded78056c08a0c --- /dev/null +++ b/src/main/java/model/StandardFire.java @@ -0,0 +1,9 @@ +package model; + +import util.Position; + +public class StandardFire extends Fire implements Updatable{ + public StandardFire(Position position) { + super(2, ModelElement.FIRE, position); + } +} diff --git a/src/main/java/model/StandardFireFighter.java b/src/main/java/model/StandardFireFighter.java new file mode 100644 index 0000000000000000000000000000000000000000..f30186259965ab2d17f1a392f0b3127286d9a44c --- /dev/null +++ b/src/main/java/model/StandardFireFighter.java @@ -0,0 +1,9 @@ +package model; + +import util.Position; + +public class StandardFireFighter extends FireFighter implements Updatable{ + public StandardFireFighter(Position position) { + super(1, ModelElement.FIREFIGHTER, position); + } +} diff --git a/src/main/java/model/StandardFirefighter.java b/src/main/java/model/StandardFirefighter.java deleted file mode 100644 index 86855259ed4d067a3e93df17df02483770fb9c48..0000000000000000000000000000000000000000 --- a/src/main/java/model/StandardFirefighter.java +++ /dev/null @@ -1,41 +0,0 @@ -package model; - -import util.Position; -import util.TargetStrategy; - -import java.util.ArrayList; -import java.util.List; - -public class StandardFirefighter extends Element { - - private TargetStrategy targetStrategy=new TargetStrategy(); - - public StandardFirefighter() { - super(ModelElement.FIREFIGHTER, - new FirefighterBehavior(ModelElement.FIREFIGHTER)); - } - - @Override - public List<Position> Update(BoardData boardData, List<Position> modifiedPositions) { - List<Position> firefighterPositions = boardData.getPositions().get(type.ordinal()); - List<Position> firefighterNewPositions = behavior.getNext(boardData); - List<Position> neighborFirePositions = new ArrayList<>(); - - modifiedPositions.removeAll(firefighterPositions); - modifiedPositions.removeAll(firefighterNewPositions); - modifiedPositions.addAll(firefighterPositions); - modifiedPositions.addAll(firefighterNewPositions); - for (Position p :firefighterNewPositions) { - neighborFirePositions.addAll(((RemoverBehavior)behavior).remove(boardData,p)); - } - modifiedPositions.removeAll(neighborFirePositions); - modifiedPositions.addAll(neighborFirePositions); - boardData.getPositions().set(type.ordinal(),firefighterNewPositions); - return modifiedPositions; - } - - public void remove(BoardData boardData,Position p) { - List<Position> firePositions = boardData.getPositions().get(ModelElement.FIRE.ordinal()); - firePositions.remove(p); - } -} diff --git a/src/main/java/model/TangibleBehavior.java b/src/main/java/model/TangibleBehavior.java index 73aba905b5cf7a5bae2323b449ca7e01978a89cf..ae61eac7760a3e2e759bb97efea10c8a81013fe2 100644 --- a/src/main/java/model/TangibleBehavior.java +++ b/src/main/java/model/TangibleBehavior.java @@ -6,5 +6,5 @@ import java.util.List; public interface TangibleBehavior<E> extends Behavior { public List<E> getObstacles(); - + public void extinguish(BoardData boardData,Position position); } diff --git a/src/main/java/model/Updatable.java b/src/main/java/model/Updatable.java new file mode 100644 index 0000000000000000000000000000000000000000..a40eaafe0053fe285c918778f71295cc38aaecb6 --- /dev/null +++ b/src/main/java/model/Updatable.java @@ -0,0 +1,9 @@ +package model; + +import util.Position; + +import java.util.List; + +public interface Updatable { + public List<Position> updateSelf(BoardData boardData); +} diff --git a/src/test/java/view/StandardFirefighterGridTest.java b/src/test/java/view/FirefighterManagerGridTest.java similarity index 91% rename from src/test/java/view/StandardFirefighterGridTest.java rename to src/test/java/view/FirefighterManagerGridTest.java index 3f3011ecda6ec793597e587f10321414364875d4..956f06bea7a03f6129ca9c4e34ec817dd76775b0 100644 --- a/src/test/java/view/StandardFirefighterGridTest.java +++ b/src/test/java/view/FirefighterManagerGridTest.java @@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; -public class StandardFirefighterGridTest { +public class FirefighterManagerGridTest { @Test void testColumnCount(){ Grid<ViewElement> grid = new FirefighterGrid();