1 | package com.takenoko.objective; | |
2 | ||
3 | import com.takenoko.engine.Board; | |
4 | import com.takenoko.engine.BotState; | |
5 | ||
6 | public abstract class Objective { | |
7 | ||
8 | private final ObjectiveType type; | |
9 | ObjectiveState state; | |
10 | private final int points; | |
11 | ||
12 | protected Objective(ObjectiveType type, ObjectiveState state, int points) { | |
13 | this.type = type; | |
14 | this.state = state; | |
15 | this.points = points; | |
16 | } | |
17 | ||
18 | /** Verify state of the objective. */ | |
19 | public abstract void verify(Board board, BotState botState); | |
20 | ||
21 | /** | |
22 | * Whether the objective has been achieved. | |
23 | * | |
24 | * @return if the objective is achieved. | |
25 | */ | |
26 | public boolean isAchieved() { | |
27 |
2
1. isAchieved : negated conditional → KILLED 2. isAchieved : replaced boolean return with true for com/takenoko/objective/Objective::isAchieved → KILLED |
return state == ObjectiveState.ACHIEVED; |
28 | } | |
29 | ||
30 | public ObjectiveType getType() { | |
31 |
1
1. getType : replaced return value with null for com/takenoko/objective/Objective::getType → KILLED |
return type; |
32 | } | |
33 | ||
34 | public ObjectiveState getState() { | |
35 |
1
1. getState : replaced return value with null for com/takenoko/objective/Objective::getState → KILLED |
return state; |
36 | } | |
37 | ||
38 | public abstract void reset(); | |
39 | ||
40 | public abstract Objective copy(); | |
41 | ||
42 | /* | |
43 | * @return the completion of the objective (between 0 and 1) | |
44 | */ | |
45 | public abstract float getCompletion(Board board, BotState botState); | |
46 | ||
47 | public int getPoints() { | |
48 |
1
1. getPoints : replaced int return with 0 for com/takenoko/objective/Objective::getPoints → KILLED |
return points; |
49 | } | |
50 | } | |
Mutations | ||
27 |
1.1 2.2 |
|
31 |
1.1 |
|
35 |
1.1 |
|
48 |
1.1 |