Commit f709c349 authored by Carl Johan Gützkow's avatar Carl Johan Gützkow 🎮
Browse files

enhance: checklist of part 3, dialogs, file handler test, and removed unused methods

parent c7a5a479
# Default ignored files
/shelf/
/.idea/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
/target/
/.idea/
wargames.iml
\ No newline at end of file
......@@ -10,3 +10,14 @@ test:
script:
- mvn clean test
pages:
stage: deploy
script:
- mkdir .public
- cp -r javadoc/* .public
- mv .public public
artifacts:
paths:
- public
only:
- master
......@@ -2,6 +2,22 @@
A repository containing a simulation of two armies attacking each other. The project will be done in may.
## Running the program
To run the program you need jdk-17 and maven 3.8.5.
If you need to use another jdk over 11, you can change the version in the pom.xml file.
Change instances of 17, except javafx version, to your required version. (11 or above)
Install the program by zip, tar or `git clone git@gitlab.stud.idi.ntnu.no:carljgu/Wargames.git`
`cd Wargames`
`mvn clean javafx:run`
## Release 1.0
Added classes
......@@ -23,3 +39,19 @@ Added classes
Added methods
- get*Units: Methods using streams to get Infantry,
Ranged, Cavalry and Commander units.
## Realease 3.0
Added a GUI to the program, a terrain enum, a unit factory and dialogbox with respective builder.
Added classes
- DialogBox: A dialog box that extends alert to use a builder to build a dialog box.
- DialogBoxBuilder: A builder class which simplifies the creation process of a DialogBox object.
- BattleController: A controller class which handles events in the fxml file.
- App: Class that extends Application from javafx. Responsibility for creating the stage
- Main: The main class that is run when the application is called upon.
- UnitFactory: A class to simply and elegantly create units. Either one by one or many at once.
- UnitFactoryTest: A test class to test the unit factory
Added enums
- Terrain: An enum that represents the different terrains
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Sun May 01 19:43:43 CEST 2022 -->
<title>All Classes and Interfaces</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="dc.created" content="2022-05-01">
<meta name="description" content="class index">
<meta name="generator" content="javadoc/AllClassesIndexWriter">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="script-dir/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="script-dir/jquery-ui.min.js"></script>
</head>
<body class="all-classes-index-page">
<script type="text/javascript">var evenRowColor = "even-row-color";
var oddRowColor = "odd-row-color";
var tableTab = "table-tab";
var activeTableTab = "active-table-tab";
var pathtoroot = "./";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top">
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="edu.ntnu.idatt2001.carljgu.client/module-summary.html">Module</a></li>
<li>Package</li>
<li>Class</li>
<li><a href="overview-tree.html">Tree</a></li>
<li><a href="index-files/index-1.html">Index</a></li>
<li><a href="help-doc.html#all-classes">Help</a></li>
</ul>
</div>
<div class="sub-nav">
<div class="nav-list-search"><label for="search-input">SEARCH:</label>
<input type="text" id="search-input" value="search" disabled="disabled">
<input type="reset" id="reset-button" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<div class="header">
<h1 title="All Classes and Interfaces" class="title">All Classes and Interfaces</h1>
</div>
<div id="all-classes-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="all-classes-table-tab0" role="tab" aria-selected="true" aria-controls="all-classes-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('all-classes-table', 'all-classes-table', 2)" class="active-table-tab">All Classes and Interfaces</button><button id="all-classes-table-tab2" role="tab" aria-selected="false" aria-controls="all-classes-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('all-classes-table', 'all-classes-table-tab2', 2)" class="table-tab">Classes</button><button id="all-classes-table-tab3" role="tab" aria-selected="false" aria-controls="all-classes-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('all-classes-table', 'all-classes-table-tab3', 2)" class="table-tab">Enum Classes</button><button id="all-classes-table-tab5" role="tab" aria-selected="false" aria-controls="all-classes-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('all-classes-table', 'all-classes-table-tab5', 2)" class="table-tab">Exceptions</button></div>
<div id="all-classes-table.tabpanel" role="tabpanel">
<div class="summary-table two-column-summary" aria-labelledby="all-classes-table-tab0">
<div class="table-header col-first">Class</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color all-classes-table all-classes-table-tab2"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/client/App.html" title="class in edu.ntnu.idatt2001.carljgu.client">App</a></div>
<div class="col-last even-row-color all-classes-table all-classes-table-tab2">
<div class="block">Class that extends Application
from javafx.</div>
</div>
<div class="col-first odd-row-color all-classes-table all-classes-table-tab2"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/units/Army.html" title="class in edu.ntnu.idatt2001.carljgu.units">Army</a></div>
<div class="col-last odd-row-color all-classes-table all-classes-table-tab2">
<div class="block">public class Army.</div>
</div>
<div class="col-first even-row-color all-classes-table all-classes-table-tab2"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/ArmyFileHandler.html" title="class in edu.ntnu.idatt2001.carljgu">ArmyFileHandler</a></div>
<div class="col-last even-row-color all-classes-table all-classes-table-tab2">
<div class="block">Handles writing, reading and importing
armies to and from a file.</div>
</div>
<div class="col-first odd-row-color all-classes-table all-classes-table-tab2"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/battle/Battle.html" title="class in edu.ntnu.idatt2001.carljgu.battle">Battle</a></div>
<div class="col-last odd-row-color all-classes-table all-classes-table-tab2">
<div class="block">Class Battle that simulates a battle between two armies.</div>
</div>
<div class="col-first even-row-color all-classes-table all-classes-table-tab2"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/client/BattleController.html" title="class in edu.ntnu.idatt2001.carljgu.client">BattleController</a></div>
<div class="col-last even-row-color all-classes-table all-classes-table-tab2">
<div class="block">A controller class which
handles events in the fxml file.</div>
</div>
<div class="col-first odd-row-color all-classes-table all-classes-table-tab2"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/units/specialized/CavalryUnit.html" title="class in edu.ntnu.idatt2001.carljgu.units.specialized">CavalryUnit</a></div>
<div class="col-last odd-row-color all-classes-table all-classes-table-tab2">
<div class="block">Class CavalryUnit that inherits from Unit.</div>
</div>
<div class="col-first even-row-color all-classes-table all-classes-table-tab2"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/units/specialized/CommanderUnit.html" title="class in edu.ntnu.idatt2001.carljgu.units.specialized">CommanderUnit</a></div>
<div class="col-last even-row-color all-classes-table all-classes-table-tab2">
<div class="block">Class CommanderUnit that inherits from CavalryUnit.</div>
</div>
<div class="col-first odd-row-color all-classes-table all-classes-table-tab2"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/client/dialogs/DialogBox.html" title="class in edu.ntnu.idatt2001.carljgu.client.dialogs">DialogBox</a></div>
<div class="col-last odd-row-color all-classes-table all-classes-table-tab2">
<div class="block">A dialog box that extends alert to use
a builder to build a dialog box.</div>
</div>
<div class="col-first even-row-color all-classes-table all-classes-table-tab2"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/client/dialogs/DialogBoxBuilder.html" title="class in edu.ntnu.idatt2001.carljgu.client.dialogs">DialogBoxBuilder</a></div>
<div class="col-last even-row-color all-classes-table all-classes-table-tab2">
<div class="block">A builder class which simplifies the
DialogBox class.</div>
</div>
<div class="col-first odd-row-color all-classes-table all-classes-table-tab5"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/FileExtensionException.html" title="class in edu.ntnu.idatt2001.carljgu">FileExtensionException</a></div>
<div class="col-last odd-row-color all-classes-table all-classes-table-tab5">
<div class="block">Thrown if an extension of a file is invalid
The exception thrown needs to have a message</div>
</div>
<div class="col-first even-row-color all-classes-table all-classes-table-tab2"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/units/specialized/InfantryUnit.html" title="class in edu.ntnu.idatt2001.carljgu.units.specialized">InfantryUnit</a></div>
<div class="col-last even-row-color all-classes-table all-classes-table-tab2">
<div class="block">Class InfantryUnit that inherits from Unit.</div>
</div>
<div class="col-first odd-row-color all-classes-table all-classes-table-tab2"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/client/Main.html" title="class in edu.ntnu.idatt2001.carljgu.client">Main</a></div>
<div class="col-last odd-row-color all-classes-table all-classes-table-tab2">
<div class="block">The main class that is run when the application
is called upon.</div>
</div>
<div class="col-first even-row-color all-classes-table all-classes-table-tab2"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/units/specialized/RangedUnit.html" title="class in edu.ntnu.idatt2001.carljgu.units.specialized">RangedUnit</a></div>
<div class="col-last even-row-color all-classes-table all-classes-table-tab2">
<div class="block">Class RangedUnit that inherits from Unit.</div>
</div>
<div class="col-first odd-row-color all-classes-table all-classes-table-tab2"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/battle/SimulationAttack.html" title="class in edu.ntnu.idatt2001.carljgu.battle">SimulationAttack</a></div>
<div class="col-last odd-row-color all-classes-table all-classes-table-tab2">
<div class="block">A class for keeping track of which unit
has attacked which unit.</div>
</div>
<div class="col-first even-row-color all-classes-table all-classes-table-tab3"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/Terrain.html" title="enum class in edu.ntnu.idatt2001.carljgu">Terrain</a></div>
<div class="col-last even-row-color all-classes-table all-classes-table-tab3">
<div class="block">En enum that represents the different terrain
that the battles can occur on.</div>
</div>
<div class="col-first odd-row-color all-classes-table all-classes-table-tab2"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/units/Unit.html" title="class in edu.ntnu.idatt2001.carljgu.units">Unit</a></div>
<div class="col-last odd-row-color all-classes-table all-classes-table-tab2">
<div class="block">The abstract class Unit.</div>
</div>
<div class="col-first even-row-color all-classes-table all-classes-table-tab2"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/units/UnitFactory.html" title="class in edu.ntnu.idatt2001.carljgu.units">UnitFactory</a></div>
<div class="col-last even-row-color all-classes-table all-classes-table-tab2">
<div class="block">A class to simply and elegantly create units.</div>
</div>
</div>
</div>
</div>
</main>
</div>
</div>
</body>
</html>
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Sun May 01 19:43:43 CEST 2022 -->
<title>All Packages</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="dc.created" content="2022-05-01">
<meta name="description" content="package index">
<meta name="generator" content="javadoc/AllPackagesIndexWriter">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="script-dir/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="script-dir/jquery-ui.min.js"></script>
</head>
<body class="all-packages-index-page">
<script type="text/javascript">var pathtoroot = "./";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top">
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="edu.ntnu.idatt2001.carljgu.client/module-summary.html">Module</a></li>
<li>Package</li>
<li>Class</li>
<li><a href="overview-tree.html">Tree</a></li>
<li><a href="index-files/index-1.html">Index</a></li>
<li><a href="help-doc.html#all-packages">Help</a></li>
</ul>
</div>
<div class="sub-nav">
<div class="nav-list-search"><label for="search-input">SEARCH:</label>
<input type="text" id="search-input" value="search" disabled="disabled">
<input type="reset" id="reset-button" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<div class="header">
<h1 title="All&amp;nbsp;Packages" class="title">All&nbsp;Packages</h1>
</div>
<div class="caption"><span>Package Summary</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Package</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/package-summary.html">edu.ntnu.idatt2001.carljgu</a></div>
<div class="col-last even-row-color">&nbsp;</div>
<div class="col-first odd-row-color"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/battle/package-summary.html">edu.ntnu.idatt2001.carljgu.battle</a></div>
<div class="col-last odd-row-color">&nbsp;</div>
<div class="col-first even-row-color"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/client/package-summary.html">edu.ntnu.idatt2001.carljgu.client</a></div>
<div class="col-last even-row-color">&nbsp;</div>
<div class="col-first odd-row-color"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/client/dialogs/package-summary.html">edu.ntnu.idatt2001.carljgu.client.dialogs</a></div>
<div class="col-last odd-row-color">&nbsp;</div>
<div class="col-first even-row-color"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/units/package-summary.html">edu.ntnu.idatt2001.carljgu.units</a></div>
<div class="col-last even-row-color">&nbsp;</div>
<div class="col-first odd-row-color"><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/units/specialized/package-summary.html">edu.ntnu.idatt2001.carljgu.units.specialized</a></div>
<div class="col-last odd-row-color">&nbsp;</div>
</div>
</main>
</div>
</div>
</body>
</html>
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Sun May 01 19:43:43 CEST 2022 -->
<title>Constant Field Values</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="dc.created" content="2022-05-01">
<meta name="description" content="summary of constants">
<meta name="generator" content="javadoc/ConstantsSummaryWriterImpl">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="script-dir/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="script-dir/jquery-ui.min.js"></script>
</head>
<body class="constants-summary-page">
<script type="text/javascript">var pathtoroot = "./";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top">
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="edu.ntnu.idatt2001.carljgu.client/module-summary.html">Module</a></li>
<li>Package</li>
<li>Class</li>
<li><a href="overview-tree.html">Tree</a></li>
<li><a href="index-files/index-1.html">Index</a></li>
<li><a href="help-doc.html#constant-values">Help</a></li>
</ul>
</div>
<div class="sub-nav">
<div class="nav-list-search"><label for="search-input">SEARCH:</label>
<input type="text" id="search-input" value="search" disabled="disabled">
<input type="reset" id="reset-button" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<div class="header">
<h1 title="Constant Field Values" class="title">Constant Field Values</h1>
<section class="packages">
<h2 title="Contents">Contents</h2>
<ul>
<li><a href="#edu.ntnu">edu.ntnu.*</a></li>
</ul>
</section>
</div>
<section class="constants-summary" id="edu.ntnu.idatt2001.carljgu.client.dialogs">
<h2 title="edu.ntnu">edu.ntnu.*</h2>
<ul class="block-list">
<li>
<div class="caption"><span>edu.ntnu.idatt2001.carljgu.client.dialogs.<a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/client/dialogs/DialogBoxBuilder.html" title="class in edu.ntnu.idatt2001.carljgu.client.dialogs">DialogBoxBuilder</a></span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Constant Field</div>
<div class="table-header col-last">Value</div>
<div class="col-first even-row-color"><code id="edu.ntnu.idatt2001.carljgu.client.dialogs.DialogBoxBuilder.recurringDialogMessage">public&nbsp;static&nbsp;final&nbsp;<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second even-row-color"><code><a href="edu.ntnu.idatt2001.carljgu.client/edu/ntnu/idatt2001/carljgu/client/dialogs/DialogBoxBuilder.html#recurringDialogMessage">recurringDialogMessage</a></code></div>
<div class="col-last even-row-color"><code>"If this a recurring and unsolvable event, please contact the creator of this program."</code></div>
</div>
</li>
</ul>
</section>
</main>
</div>
</div>
</body>
</html>
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Sun May 01 19:43:43 CEST 2022 -->
<title>ArmyFileHandler</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="dc.created" content="2022-05-01">
<meta name="description" content="declaration: module: edu.ntnu.idatt2001.carljgu.client, package: edu.ntnu.idatt2001.carljgu, class: ArmyFileHandler">
<meta name="generator" content="javadoc/ClassWriterImpl">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">var evenRowColor = "even-row-color";
var oddRowColor = "odd-row-color";
var tableTab = "table-tab";
var activeTableTab = "active-table-tab";
var pathtoroot = "../../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top">
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../module-summary.html">Module</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html#class">Help</a></li>
</ul>
</div>
<div class="sub-nav">
<div>
<ul class="sub-nav-list">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor-summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method-summary">Method</a></li>
</ul>
<ul class="sub-nav-list">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor-detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method-detail">Method</a></li>
</ul>
</div>
<div class="nav-list-search"><label for="search-input">SEARCH:</label>
<input type="text" id="search-input" value="search" disabled="disabled">
<input type="reset" id="reset-button" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="sub-title"><span class="module-label-in-type">Module</span>&nbsp;<a href="../../../../module-summary.html">edu.ntnu.idatt2001.carljgu.client</a></div>
<div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">edu.ntnu.idatt2001.carljgu</a></div>
<h1 title="Class ArmyFileHandler" class="title">Class ArmyFileHandler</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">java.lang.Object</a>
<div class="inheritance">edu.ntnu.idatt2001.carljgu.ArmyFileHandler</div>
</div>
<section class="class-description" id="class-description">
<hr>
<div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">ArmyFileHandler</span>
<span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span></div>
<div class="block">Handles writing, reading and importing
armies to and from a file.</div>
<dl class="notes">
<dt>Version:</dt>
<dd>1.4 1.05.2022</dd>
<dt>Author:</dt>
<dd>Carl Gützkow</dd>
</dl>
</section>
<section class="summary">
<ul class="summary-list">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<li>
<section class="constructor-summary" id="constructor-summary">
<h2>Constructor Summary</h2>
<div class="caption"><span>Constructors</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Constructor</div>
<div class="table-header col-last">Description</div>
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E()" class="member-name-link">ArmyFileHandler</a>()</code></div>
<div class="col-last even-row-color">
<div class="block">Constructor which initiates the readLinesSkipped arraylist</div>
</div>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel">
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getFilePath()" class="member-name-link">getFilePath</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Uses the system default file explorer to get
a file path of the user's choice.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link">ArrayList</a>&lt;<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&gt;</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getReadLinesSkipped()" class="member-name-link">getReadLinesSkipped</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Gets the amount of units
that were skipped when reading from file.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="units/Army.html" title="class in edu.ntnu.idatt2001.carljgu.units">Army</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#readArmyFromFile(java.lang.String)" class="member-name-link">readArmyFromFile</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;filePath)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Finds a specified csv file
and converts it to an army if it can.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#writeToFile(edu.ntnu.idatt2001.carljgu.units.Army,java.lang.String)" class="member-name-link">writeToFile</a><wbr>(<a href="units/Army.html" title="class in edu.ntnu.idatt2001.carljgu.units">Army</a>&nbsp;army,
<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;filePath)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Creates a file to write on or writes to an existing file.</div>
</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-java.lang.Object">Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<li>
<section class="constructor-details" id="constructor-detail">
<h2>Constructor Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="&lt;init&gt;()">
<h3>ArmyFileHandler</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">ArmyFileHandler</span>()</div>
<div class="block">Constructor which initiates the readLinesSkipped arraylist</div>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="getReadLinesSkipped()">
<h3>getReadLinesSkipped</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link">ArrayList</a>&lt;<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&gt;</span>&nbsp;<span class="element-name">getReadLinesSkipped</span>()</div>
<div class="block">Gets the amount of units
that were skipped when reading from file.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>readLinesSkipped - amount of lines skipped when
reading army from file because of invalid unit.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="writeToFile(edu.ntnu.idatt2001.carljgu.units.Army,java.lang.String)">
<h3>writeToFile</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">writeToFile</span><wbr><span class="parameters">(<a href="units/Army.html" title="class in edu.ntnu.idatt2001.carljgu.units">Army</a>&nbsp;army,
<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;filePath)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a>,
<a href="FileExtensionException.html" title="class in edu.ntnu.idatt2001.carljgu">FileExtensionException</a>,
<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Creates a file to write on or writes to an existing file.
The client should handle any exception that is thrown
with an error message the client creates.</div>
<dl class="notes">
<dt>Parameters:</dt>