1 | package com.takenoko.actions.weather; | |
2 | ||
3 | import com.takenoko.actions.Action; | |
4 | import com.takenoko.actions.ActionResult; | |
5 | import com.takenoko.actions.annotations.ActionAnnotation; | |
6 | import com.takenoko.actions.annotations.ActionType; | |
7 | import com.takenoko.engine.Board; | |
8 | import com.takenoko.engine.BotManager; | |
9 | import java.util.Objects; | |
10 | ||
11 | /** Action to choose whether to apply the weather or not */ | |
12 | @ActionAnnotation(ActionType.FORCED) | |
13 | public class ChooseIfApplyWeatherAction implements Action { | |
14 | private final boolean applyWeather; | |
15 | ||
16 | public ChooseIfApplyWeatherAction(boolean applyWeather) { | |
17 | this.applyWeather = applyWeather; | |
18 | } | |
19 | ||
20 | @Override | |
21 | public ActionResult execute(Board board, BotManager botManager) { | |
22 |
1
1. execute : negated conditional → KILLED |
if (applyWeather) { |
23 |
1
1. execute : removed call to com/takenoko/engine/BotManager::displayMessage → TIMED_OUT |
botManager.displayMessage( |
24 | botManager.getName() + " applied the weather " + board.peekWeather()); | |
25 |
1
1. execute : replaced return value with null for com/takenoko/actions/weather/ChooseIfApplyWeatherAction::execute → KILLED |
return new ActionResult(board.peekWeather().apply(board, botManager), 0); |
26 | } | |
27 |
1
1. execute : removed call to com/takenoko/engine/BotManager::displayMessage → TIMED_OUT |
botManager.displayMessage( |
28 | botManager.getName() + " did not apply the weather " + board.peekWeather()); | |
29 |
1
1. execute : replaced return value with null for com/takenoko/actions/weather/ChooseIfApplyWeatherAction::execute → KILLED |
return new ActionResult(0); |
30 | } | |
31 | ||
32 | @Override | |
33 | public boolean equals(Object o) { | |
34 |
2
1. equals : negated conditional → SURVIVED 2. equals : replaced boolean return with false for com/takenoko/actions/weather/ChooseIfApplyWeatherAction::equals → NO_COVERAGE |
if (this == o) return true; |
35 |
3
1. equals : replaced boolean return with true for com/takenoko/actions/weather/ChooseIfApplyWeatherAction::equals → NO_COVERAGE 2. equals : negated conditional → KILLED 3. equals : negated conditional → KILLED |
if (o == null || getClass() != o.getClass()) return false; |
36 | ChooseIfApplyWeatherAction that = (ChooseIfApplyWeatherAction) o; | |
37 |
2
1. equals : replaced boolean return with true for com/takenoko/actions/weather/ChooseIfApplyWeatherAction::equals → SURVIVED 2. equals : negated conditional → KILLED |
return applyWeather == that.applyWeather; |
38 | } | |
39 | ||
40 | @Override | |
41 | public int hashCode() { | |
42 |
1
1. hashCode : replaced int return with 0 for com/takenoko/actions/weather/ChooseIfApplyWeatherAction::hashCode → TIMED_OUT |
return Objects.hash(applyWeather); |
43 | } | |
44 | } | |
Mutations | ||
22 |
1.1 |
|
23 |
1.1 |
|
25 |
1.1 |
|
27 |
1.1 |
|
29 |
1.1 |
|
34 |
1.1 2.2 |
|
35 |
1.1 2.2 3.3 |
|
37 |
1.1 2.2 |
|
42 |
1.1 |