Passed
Push — master ( 08cd0d...9eabdf )
by Vincent
07:15
created

fr.arakne.utils.maps.MapCell   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 37
ccs 1
cts 1
cp 1
rs 10
wmc 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A coordinate() 0 2 1
id() 0 1 ?
walkable() 0 1 ?
map() 0 1 ?
1
/*
2
 * This file is part of ArakneUtils.
3
 *
4
 * ArakneUtils is free software: you can redistribute it and/or modify
5
 * it under the terms of the GNU Lesser General Public License as published by
6
 * the Free Software Foundation, either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * ArakneUtils is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU Lesser General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Lesser General Public License
15
 * along with ArakneUtils.  If not, see <https://www.gnu.org/licenses/>.
16
 *
17
 * Copyright (c) 2017-2020 Vincent Quatrevieux
18
 */
19
20
package fr.arakne.utils.maps;
21
22
/**
23
 * Base type for a dofus map cell
24
 */
25
public interface MapCell {
26
    /**
27
     * Get the cell id
28
     *
29
     * @return The cell id. Starts at 0
30
     */
31
    public int id();
32
33
    /**
34
     * Check if the cell is walkable
35
     *
36
     * @return true if walkable
37
     */
38
    public boolean walkable();
39
40
    /**
41
     * Get the container map
42
     *
43
     * @return The parent DofusMap
44
     */
45
    public DofusMap<?> map();
0 ignored issues
show
Comprehensibility introduced by
Remove usage of generic wildcard type.
Loading history...
46
47
    /**
48
     * Get the coordinate of the current cell
49
     * This is equivalent to {@code new CoordinateCell<>(cell)}
50
     *
51
     * Note: this method will always recreate a new {@link CoordinateCell} instance
52
     *
53
     * <pre>{@code
54
     * // Compute distance between two cells
55
     * int distance = current.coordinate().distance(target.coordinate());
56
     * }</pre>
57
     *
58
     * @return The cell coordinate
59
     */
60
    public default CoordinateCell<? extends MapCell> coordinate() {
0 ignored issues
show
Comprehensibility introduced by
Remove usage of generic wildcard type.
Loading history...
61 1
        return new CoordinateCell<>(this);
62
    }
63
}
64