mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2026-10-05 23:11:20 +02:00
463 lines
32 KiB
HTML
463 lines
32 KiB
HTML
<!DOCTYPE HTML>
|
|
<html lang="de">
|
|
<head>
|
|
<!-- Generated by javadoc (20) -->
|
|
<title>ShipMap (model API)</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<meta name="description" content="declaration: package: pp.battleship.model, class: ShipMap">
|
|
<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">
|
|
<script type="text/javascript" src="../../../script.js"></script>
|
|
<script type="text/javascript" src="../../../script-dir/jquery-3.6.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 pathtoroot = "../../../";
|
|
loadScripts(document, 'script');</script>
|
|
<noscript>
|
|
<div>JavaScript ist im Browser deaktiviert.</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"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Navigationslinks umschalten"><span class="nav-bar-toggle-icon"> </span><span class="nav-bar-toggle-icon"> </span><span class="nav-bar-toggle-icon"> </span></button>
|
|
<div class="skip-nav"><a href="#skip-navbar-top" title="Navigations-Links überspringen">Navigations-Links überspringen</a></div>
|
|
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
|
|
<li><a href="../../../index.html">Überblick</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="nav-bar-cell1-rev">Klasse</li>
|
|
<li><a href="package-tree.html">Baum</a></li>
|
|
<li><a href="../../../index-all.html">Index</a></li>
|
|
<li><a href="../../../help-doc.html#class">Hilfe</a></li>
|
|
</ul>
|
|
<ul class="sub-nav-list-small">
|
|
<li>
|
|
<p>Übersicht:</p>
|
|
<ul>
|
|
<li>Verschachtelt</li>
|
|
<li>Feld</li>
|
|
<li><a href="#constructor-summary">Konstruktor</a></li>
|
|
<li><a href="#method-summary">Methode</a></li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>Details:</p>
|
|
<ul>
|
|
<li>Feld</li>
|
|
<li><a href="#constructor-detail">Konstruktor</a></li>
|
|
<li><a href="#method-detail">Methode</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="sub-nav">
|
|
<div id="navbar-sub-list">
|
|
<ul class="sub-nav-list">
|
|
<li>Übersicht: </li>
|
|
<li>Verschachtelt | </li>
|
|
<li>Feld | </li>
|
|
<li><a href="#constructor-summary">Konstruktor</a> | </li>
|
|
<li><a href="#method-summary">Methode</a></li>
|
|
</ul>
|
|
<ul class="sub-nav-list">
|
|
<li>Details: </li>
|
|
<li>Feld | </li>
|
|
<li><a href="#constructor-detail">Konstruktor</a> | </li>
|
|
<li><a href="#method-detail">Methode</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="nav-list-search"><a href="../../../search.html">SEARCH</a>
|
|
<input type="text" id="search-input" disabled placeholder="Suchen">
|
|
<input type="reset" id="reset-button" disabled value="reset">
|
|
</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="package-label-in-type">Package</span> <a href="package-summary.html">pp.battleship.model</a></div>
|
|
<h1 title="Klasse ShipMap" class="title">Klasse ShipMap</h1>
|
|
</div>
|
|
<div class="inheritance" title="Vererbungsbaum"><a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Object.html" title="Klasse oder Schnittstelle in java.lang" class="external-link">java.lang.Object</a>
|
|
<div class="inheritance">pp.battleship.model.ShipMap</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">ShipMap</span>
|
|
<span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Object.html" title="Klasse oder Schnittstelle in java.lang" class="external-link">Object</a></span></div>
|
|
<div class="block">Represents a rectangular map that holds ships and registers shots fired.
|
|
It also supports event notification for game state changes such as item addition or removal.
|
|
Valid positions on this map have x-coordinates in the range of 0 to width-1 and y-coordinates
|
|
in the range of 0 to height-1.</div>
|
|
<dl class="notes">
|
|
<dt>Siehe auch:</dt>
|
|
<dd>
|
|
<ul class="tag-list">
|
|
<li><a href="#getWidth()"><code>getWidth()</code></a></li>
|
|
<li><a href="#getHeight()"><code>getHeight()</code></a></li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
</section>
|
|
<section class="summary">
|
|
<ul class="summary-list">
|
|
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
|
<li>
|
|
<section class="constructor-summary" id="constructor-summary">
|
|
<h2>Konstruktorübersicht</h2>
|
|
<div class="caption"><span>Konstruktoren</span></div>
|
|
<div class="summary-table two-column-summary">
|
|
<div class="table-header col-first">Konstruktor</div>
|
|
<div class="table-header col-last">Beschreibung</div>
|
|
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E(int,int,pp.battleship.notification.GameEventBroker)" class="member-name-link">ShipMap</a><wbr>(int width,
|
|
int height,
|
|
<a href="../notification/GameEventBroker.html" title="Schnittstelle in pp.battleship.notification">GameEventBroker</a> eventBroker)</code></div>
|
|
<div class="col-last even-row-color">
|
|
<div class="block">Constructs an empty map with the given dimensions.</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</li>
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
|
<li>
|
|
<section class="method-summary" id="method-summary">
|
|
<h2>Methodenübersicht</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">Alle Methoden</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">Instanzmethoden</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">Konkrete Methoden</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">Modifizierer und Typ</div>
|
|
<div class="table-header col-second">Methode</div>
|
|
<div class="table-header col-last">Beschreibung</div>
|
|
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
|
|
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#add(pp.battleship.model.Battleship)" class="member-name-link">add</a><wbr>(<a href="Battleship.html" title="Klasse in pp.battleship.model">Battleship</a> ship)</code></div>
|
|
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Adds a battleship to the map and triggers an item addition event.</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="#add(pp.battleship.model.Shot)" class="member-name-link">add</a><wbr>(<a href="Shot.html" title="Klasse in pp.battleship.model">Shot</a> shot)</code></div>
|
|
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Registers a shot on the map, updates the state of the affected ship (if any),
|
|
and triggers an item addition event.</div>
|
|
</div>
|
|
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
|
|
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#clear()" class="member-name-link">clear</a>()</code></div>
|
|
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Removes all items from the map and triggers corresponding removal events for each.</div>
|
|
</div>
|
|
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="Battleship.html" title="Klasse in pp.battleship.model">Battleship</a></code></div>
|
|
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#findShipAt(int,int)" class="member-name-link">findShipAt</a><wbr>(int x,
|
|
int y)</code></div>
|
|
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Finds a battleship at the specified coordinates.</div>
|
|
</div>
|
|
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="Battleship.html" title="Klasse in pp.battleship.model">Battleship</a></code></div>
|
|
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#findShipAt(pp.battleship.model.IntPosition)" class="member-name-link">findShipAt</a><wbr>(<a href="IntPosition.html" title="Schnittstelle in pp.battleship.model">IntPosition</a> position)</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 battleship at the specified position.</div>
|
|
</div>
|
|
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int</code></div>
|
|
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getHeight()" class="member-name-link">getHeight</a>()</code></div>
|
|
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Returns the height (number of rows) of the map.</div>
|
|
</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/20/docs/api/java.base/java/util/List.html" title="Klasse oder Schnittstelle in java.util" class="external-link">List</a><<a href="Item.html" title="Schnittstelle in pp.battleship.model">Item</a>></code></div>
|
|
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getItems()" class="member-name-link">getItems</a>()</code></div>
|
|
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Returns an unmodifiable list of all items currently on the map.</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/20/docs/api/java.base/java/util/List.html" title="Klasse oder Schnittstelle in java.util" class="external-link">List</a><<a href="Battleship.html" title="Klasse in pp.battleship.model">Battleship</a>></code></div>
|
|
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getRemainingShips()" class="member-name-link">getRemainingShips</a>()</code></div>
|
|
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Returns a list of all remaining battleships that have not been destroyed.</div>
|
|
</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/20/docs/api/java.base/java/util/stream/Stream.html" title="Klasse oder Schnittstelle in java.util.stream" class="external-link">Stream</a><<a href="Battleship.html" title="Klasse in pp.battleship.model">Battleship</a>></code></div>
|
|
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getShips()" class="member-name-link">getShips</a>()</code></div>
|
|
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Returns a stream of all battleships currently on the map.</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/20/docs/api/java.base/java/util/stream/Stream.html" title="Klasse oder Schnittstelle in java.util.stream" class="external-link">Stream</a><<a href="Shot.html" title="Klasse in pp.battleship.model">Shot</a>></code></div>
|
|
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getShots()" class="member-name-link">getShots</a>()</code></div>
|
|
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Returns a stream of all shots fired on the map.</div>
|
|
</div>
|
|
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int</code></div>
|
|
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getWidth()" class="member-name-link">getWidth</a>()</code></div>
|
|
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Returns the width (number of columns) of the map.</div>
|
|
</div>
|
|
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
|
|
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#isValid(int,int)" class="member-name-link">isValid</a><wbr>(int x,
|
|
int y)</code></div>
|
|
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Checks if the specified coordinates are within the map boundaries.</div>
|
|
</div>
|
|
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
|
|
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#isValid(pp.battleship.model.Battleship)" class="member-name-link">isValid</a><wbr>(<a href="Battleship.html" title="Klasse in pp.battleship.model">Battleship</a> ship)</code></div>
|
|
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Checks if the given ship is in a valid position (within the map bounds and non-colliding with other ships).</div>
|
|
</div>
|
|
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
|
|
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#isValid(pp.battleship.model.IntPosition)" class="member-name-link">isValid</a><wbr>(<a href="IntPosition.html" title="Schnittstelle in pp.battleship.model">IntPosition</a> pos)</code></div>
|
|
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Validates whether the specified position is within the map boundaries.</div>
|
|
</div>
|
|
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
|
|
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#remove(pp.battleship.model.Item)" class="member-name-link">remove</a><wbr>(<a href="Item.html" title="Schnittstelle in pp.battleship.model">Item</a> item)</code></div>
|
|
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Removes an item from the map and triggers an item removal event.</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/20/docs/api/java.base/java/lang/String.html" title="Klasse oder Schnittstelle in java.lang" class="external-link">String</a></code></div>
|
|
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#toString()" class="member-name-link">toString</a>()</code></div>
|
|
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Returns a string representation of the ship map.</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="inherited-list">
|
|
<h3 id="methods-inherited-from-class-java.lang.Object">Von Klasse geerbte Methoden java.lang.<a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Object.html" title="Klasse oder Schnittstelle in java.lang" class="external-link">Object</a></h3>
|
|
<code><a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Object.html#clone()" title="Klasse oder Schnittstelle in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="Klasse oder Schnittstelle in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Object.html#finalize()" title="Klasse oder Schnittstelle in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Object.html#getClass()" title="Klasse oder Schnittstelle in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Object.html#hashCode()" title="Klasse oder Schnittstelle in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Object.html#notify()" title="Klasse oder Schnittstelle in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Object.html#notifyAll()" title="Klasse oder Schnittstelle in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Object.html#wait()" title="Klasse oder Schnittstelle in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Object.html#wait(long)" title="Klasse oder Schnittstelle in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="Klasse oder Schnittstelle 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>Konstruktordetails</h2>
|
|
<ul class="member-list">
|
|
<li>
|
|
<section class="detail" id="<init>(int,int,pp.battleship.notification.GameEventBroker)">
|
|
<h3>ShipMap</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="element-name">ShipMap</span><wbr><span class="parameters">(int width,
|
|
int height,
|
|
<a href="../notification/GameEventBroker.html" title="Schnittstelle in pp.battleship.notification">GameEventBroker</a> eventBroker)</span></div>
|
|
<div class="block">Constructs an empty map with the given dimensions. The specified event broker
|
|
will handle the notification of changes in the map state, such as adding or removing items.
|
|
Passing null as the event broker is allowed, but in that case, no notifications will occur.</div>
|
|
<dl class="notes">
|
|
<dt>Parameter:</dt>
|
|
<dd><code>width</code> - the number of columns (width) of the map</dd>
|
|
<dd><code>height</code> - the number of rows (height) of the map</dd>
|
|
<dd><code>eventBroker</code> - the event broker used for notifying listeners, or null if event distribution is not needed</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
</li>
|
|
<!-- ============ METHOD DETAIL ========== -->
|
|
<li>
|
|
<section class="method-details" id="method-detail">
|
|
<h2>Methodendetails</h2>
|
|
<ul class="member-list">
|
|
<li>
|
|
<section class="detail" id="add(pp.battleship.model.Battleship)">
|
|
<h3>add</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">add</span><wbr><span class="parameters">(<a href="Battleship.html" title="Klasse in pp.battleship.model">Battleship</a> ship)</span></div>
|
|
<div class="block">Adds a battleship to the map and triggers an item addition event.</div>
|
|
<dl class="notes">
|
|
<dt>Parameter:</dt>
|
|
<dd><code>ship</code> - the battleship to be added to the map</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="add(pp.battleship.model.Shot)">
|
|
<h3>add</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">add</span><wbr><span class="parameters">(<a href="Shot.html" title="Klasse in pp.battleship.model">Shot</a> shot)</span></div>
|
|
<div class="block">Registers a shot on the map, updates the state of the affected ship (if any),
|
|
and triggers an item addition event.</div>
|
|
<dl class="notes">
|
|
<dt>Parameter:</dt>
|
|
<dd><code>shot</code> - the shot to be registered on the map</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="remove(pp.battleship.model.Item)">
|
|
<h3>remove</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">remove</span><wbr><span class="parameters">(<a href="Item.html" title="Schnittstelle in pp.battleship.model">Item</a> item)</span></div>
|
|
<div class="block">Removes an item from the map and triggers an item removal event.</div>
|
|
<dl class="notes">
|
|
<dt>Parameter:</dt>
|
|
<dd><code>item</code> - the item to be removed from the map</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="clear()">
|
|
<h3>clear</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">clear</span>()</div>
|
|
<div class="block">Removes all items from the map and triggers corresponding removal events for each.</div>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="getShips()">
|
|
<h3>getShips</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/util/stream/Stream.html" title="Klasse oder Schnittstelle in java.util.stream" class="external-link">Stream</a><<a href="Battleship.html" title="Klasse in pp.battleship.model">Battleship</a>></span> <span class="element-name">getShips</span>()</div>
|
|
<div class="block">Returns a stream of all battleships currently on the map.</div>
|
|
<dl class="notes">
|
|
<dt>Gibt zurück:</dt>
|
|
<dd>a stream of battleships</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="getRemainingShips()">
|
|
<h3>getRemainingShips</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/util/List.html" title="Klasse oder Schnittstelle in java.util" class="external-link">List</a><<a href="Battleship.html" title="Klasse in pp.battleship.model">Battleship</a>></span> <span class="element-name">getRemainingShips</span>()</div>
|
|
<div class="block">Returns a list of all remaining battleships that have not been destroyed.</div>
|
|
<dl class="notes">
|
|
<dt>Gibt zurück:</dt>
|
|
<dd>a list of remaining battleships</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="getShots()">
|
|
<h3>getShots</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/util/stream/Stream.html" title="Klasse oder Schnittstelle in java.util.stream" class="external-link">Stream</a><<a href="Shot.html" title="Klasse in pp.battleship.model">Shot</a>></span> <span class="element-name">getShots</span>()</div>
|
|
<div class="block">Returns a stream of all shots fired on the map.</div>
|
|
<dl class="notes">
|
|
<dt>Gibt zurück:</dt>
|
|
<dd>a stream of shots</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="getItems()">
|
|
<h3>getItems</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/util/List.html" title="Klasse oder Schnittstelle in java.util" class="external-link">List</a><<a href="Item.html" title="Schnittstelle in pp.battleship.model">Item</a>></span> <span class="element-name">getItems</span>()</div>
|
|
<div class="block">Returns an unmodifiable list of all items currently on the map.</div>
|
|
<dl class="notes">
|
|
<dt>Gibt zurück:</dt>
|
|
<dd>an unmodifiable list of all items</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="getWidth()">
|
|
<h3>getWidth</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">int</span> <span class="element-name">getWidth</span>()</div>
|
|
<div class="block">Returns the width (number of columns) of the map.</div>
|
|
<dl class="notes">
|
|
<dt>Gibt zurück:</dt>
|
|
<dd>the width of the map</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="getHeight()">
|
|
<h3>getHeight</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">int</span> <span class="element-name">getHeight</span>()</div>
|
|
<div class="block">Returns the height (number of rows) of the map.</div>
|
|
<dl class="notes">
|
|
<dt>Gibt zurück:</dt>
|
|
<dd>the height of the map</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="isValid(pp.battleship.model.Battleship)">
|
|
<h3>isValid</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">boolean</span> <span class="element-name">isValid</span><wbr><span class="parameters">(<a href="Battleship.html" title="Klasse in pp.battleship.model">Battleship</a> ship)</span></div>
|
|
<div class="block">Checks if the given ship is in a valid position (within the map bounds and non-colliding with other ships).</div>
|
|
<dl class="notes">
|
|
<dt>Parameter:</dt>
|
|
<dd><code>ship</code> - the battleship to validate</dd>
|
|
<dt>Gibt zurück:</dt>
|
|
<dd>true if the ship's position is valid, false otherwise</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="findShipAt(int,int)">
|
|
<h3>findShipAt</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="Battleship.html" title="Klasse in pp.battleship.model">Battleship</a></span> <span class="element-name">findShipAt</span><wbr><span class="parameters">(int x,
|
|
int y)</span></div>
|
|
<div class="block">Finds a battleship at the specified coordinates.</div>
|
|
<dl class="notes">
|
|
<dt>Parameter:</dt>
|
|
<dd><code>x</code> - the x-coordinate of the position</dd>
|
|
<dd><code>y</code> - the y-coordinate of the position</dd>
|
|
<dt>Gibt zurück:</dt>
|
|
<dd>the ship at the specified coordinates, or null if none is found</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="findShipAt(pp.battleship.model.IntPosition)">
|
|
<h3>findShipAt</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="Battleship.html" title="Klasse in pp.battleship.model">Battleship</a></span> <span class="element-name">findShipAt</span><wbr><span class="parameters">(<a href="IntPosition.html" title="Schnittstelle in pp.battleship.model">IntPosition</a> position)</span></div>
|
|
<div class="block">Finds a battleship at the specified position. This is a convenience method.</div>
|
|
<dl class="notes">
|
|
<dt>Parameter:</dt>
|
|
<dd><code>position</code> - the position within the map</dd>
|
|
<dt>Gibt zurück:</dt>
|
|
<dd>the ship at the specified position, or null if none is found</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="isValid(pp.battleship.model.IntPosition)">
|
|
<h3>isValid</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">boolean</span> <span class="element-name">isValid</span><wbr><span class="parameters">(<a href="IntPosition.html" title="Schnittstelle in pp.battleship.model">IntPosition</a> pos)</span></div>
|
|
<div class="block">Validates whether the specified position is within the map boundaries.</div>
|
|
<dl class="notes">
|
|
<dt>Parameter:</dt>
|
|
<dd><code>pos</code> - the position to validate</dd>
|
|
<dt>Gibt zurück:</dt>
|
|
<dd>true if the position is within the map, false otherwise</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="isValid(int,int)">
|
|
<h3>isValid</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">boolean</span> <span class="element-name">isValid</span><wbr><span class="parameters">(int x,
|
|
int y)</span></div>
|
|
<div class="block">Checks if the specified coordinates are within the map boundaries.</div>
|
|
<dl class="notes">
|
|
<dt>Parameter:</dt>
|
|
<dd><code>x</code> - the x-coordinate to validate</dd>
|
|
<dd><code>y</code> - the y-coordinate to validate</dd>
|
|
<dt>Gibt zurück:</dt>
|
|
<dd>true if the coordinates are valid, false otherwise</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="toString()">
|
|
<h3>toString</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/String.html" title="Klasse oder Schnittstelle in java.lang" class="external-link">String</a></span> <span class="element-name">toString</span>()</div>
|
|
<div class="block">Returns a string representation of the ship map.</div>
|
|
<dl class="notes">
|
|
<dt>Setzt außer Kraft:</dt>
|
|
<dd><code><a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Object.html#toString()" title="Klasse oder Schnittstelle in java.lang" class="external-link">toString</a></code> in Klasse <code><a href="https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Object.html" title="Klasse oder Schnittstelle in java.lang" class="external-link">Object</a></code></dd>
|
|
<dt>Gibt zurück:</dt>
|
|
<dd>a string representation of the ship map</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<!-- ========= END OF CLASS DATA ========= -->
|
|
</main>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|