| 1 | package com.takenoko.actions.bamboo; | |
| 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 com.takenoko.layers.bamboo.LayerBambooStack; | |
| 10 | import com.takenoko.vector.PositionVector; | |
| 11 | import java.util.Objects; | |
| 12 | ||
| 13 | /** Action that grows bamboo at a given position. */ | |
| 14 | @ActionAnnotation(ActionType.FORCED) | |
| 15 | public class GrowBambooAction implements Action { | |
| 16 | ||
| 17 | final PositionVector position; | |
| 18 | ||
| 19 | public GrowBambooAction(PositionVector position) { | |
| 20 | this.position = position; | |
| 21 | } | |
| 22 | ||
| 23 | @Override | |
| 24 | public ActionResult execute(Board board, BotManager botManager) { | |
| 25 |
1
1. execute : negated conditional → KILLED |
if (board.isBambooGrowableAt(position)) { |
| 26 | LayerBambooStack layerBambooStack = board.growBamboo(position); | |
| 27 |
1
1. execute : removed call to com/takenoko/engine/BotManager::displayMessage → TIMED_OUT |
botManager.displayMessage("Grew bamboo at " + position); |
| 28 | botManager | |
| 29 | .getSingleBotStatistics() | |
| 30 |
1
1. execute : removed call to com/takenoko/stats/SingleBotStatistics::updatePlantedBambooCounter → TIMED_OUT |
.updatePlantedBambooCounter( |
| 31 | board.getTileAt(position).getColor(), | |
| 32 | layerBambooStack.getBambooCount()); | |
| 33 |
1
1. execute : replaced return value with null for com/takenoko/actions/bamboo/GrowBambooAction::execute → KILLED |
return new ActionResult(); |
| 34 | } | |
| 35 | throw new IllegalStateException("Cannot grow bamboo at " + position); | |
| 36 | } | |
| 37 | ||
| 38 | @Override | |
| 39 | public boolean equals(Object o) { | |
| 40 |
2
1. equals : negated conditional → SURVIVED 2. equals : replaced boolean return with false for com/takenoko/actions/bamboo/GrowBambooAction::equals → NO_COVERAGE |
if (this == o) return true; |
| 41 |
3
1. equals : negated conditional → SURVIVED 2. equals : negated conditional → SURVIVED 3. equals : replaced boolean return with true for com/takenoko/actions/bamboo/GrowBambooAction::equals → SURVIVED |
if (o == null || getClass() != o.getClass()) return false; |
| 42 | GrowBambooAction that = (GrowBambooAction) o; | |
| 43 |
2
1. equals : replaced boolean return with false for com/takenoko/actions/bamboo/GrowBambooAction::equals → NO_COVERAGE 2. equals : replaced boolean return with true for com/takenoko/actions/bamboo/GrowBambooAction::equals → NO_COVERAGE |
return Objects.equals(position, that.position); |
| 44 | } | |
| 45 | ||
| 46 | @Override | |
| 47 | public int hashCode() { | |
| 48 |
1
1. hashCode : replaced int return with 0 for com/takenoko/actions/bamboo/GrowBambooAction::hashCode → SURVIVED |
return Objects.hash(position); |
| 49 | } | |
| 50 | } | |
Mutations | ||
| 25 |
1.1 |
|
| 27 |
1.1 |
|
| 30 |
1.1 |
|
| 33 |
1.1 |
|
| 40 |
1.1 2.2 |
|
| 41 |
1.1 2.2 3.3 |
|
| 43 |
1.1 2.2 |
|
| 48 |
1.1 |