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.path; |
21
|
|
|
|
22
|
|
|
import fr.arakne.utils.maps.MapCell; |
23
|
|
|
import fr.arakne.utils.maps.constant.Direction; |
24
|
|
|
import org.checkerframework.checker.nullness.qual.NonNull; |
25
|
|
|
import org.checkerframework.dataflow.qual.Pure; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Step for a path |
29
|
|
|
*/ |
30
|
|
|
public final class PathStep<C extends @NonNull MapCell> { |
31
|
|
|
private final C cell; |
32
|
|
|
private final Direction direction; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @param cell The cell |
36
|
|
|
* @param direction The direction |
37
|
|
|
*/ |
38
|
1 |
|
public PathStep(C cell, Direction direction) { |
39
|
1 |
|
this.cell = cell; |
40
|
1 |
|
this.direction = direction; |
41
|
1 |
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @return The cell |
45
|
|
|
*/ |
46
|
|
|
@Pure |
47
|
|
|
public C cell() { |
48
|
1 |
|
return cell; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return The direction |
53
|
|
|
*/ |
54
|
|
|
@Pure |
55
|
|
|
public Direction direction() { |
56
|
1 |
|
return direction; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
@Override |
60
|
|
|
public String toString() { |
61
|
|
|
return "{" + cell + ", " + direction + "}"; |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|