| 1 | package com.takenoko.actions.irrigation; | |
| 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.irrigation.EdgePosition; | |
| 10 | import java.util.Objects; | |
| 11 | ||
| 12 | /** Action to place an irrigation channel on the board. */ | |
| 13 | @ActionAnnotation(ActionType.FORCED) | |
| 14 | public class PlaceIrrigationAction implements Action { | |
| 15 | final EdgePosition edgePosition; | |
| 16 | ||
| 17 | public PlaceIrrigationAction(EdgePosition edgePosition) { | |
| 18 | this.edgePosition = edgePosition; | |
| 19 | } | |
| 20 | ||
| 21 | @Override | |
| 22 | public ActionResult execute(Board board, BotManager botManager) { | |
| 23 |
1
1. execute : removed call to com/takenoko/engine/BotManager::displayMessage → TIMED_OUT |
botManager.displayMessage( |
| 24 | botManager.getName() + " placed an irrigation channel at " + edgePosition); | |
| 25 |
1
1. execute : removed call to com/takenoko/stats/SingleBotStatistics::incrementIrrigationsPlaced → KILLED |
botManager.getSingleBotStatistics().incrementIrrigationsPlaced(); |
| 26 |
1
1. execute : removed call to com/takenoko/stats/SingleBotStatistics::updateActions → KILLED |
botManager.getSingleBotStatistics().updateActions(getClass().getSimpleName()); |
| 27 |
1
1. execute : removed call to com/takenoko/engine/Board::placeIrrigation → KILLED |
board.placeIrrigation(edgePosition); |
| 28 |
1
1. execute : replaced return value with null for com/takenoko/actions/irrigation/PlaceIrrigationAction::execute → KILLED |
return new ActionResult(1); |
| 29 | } | |
| 30 | ||
| 31 | @Override | |
| 32 | public boolean equals(Object o) { | |
| 33 |
2
1. equals : negated conditional → NO_COVERAGE 2. equals : replaced boolean return with false for com/takenoko/actions/irrigation/PlaceIrrigationAction::equals → NO_COVERAGE |
if (this == o) return true; |
| 34 |
3
1. equals : negated conditional → NO_COVERAGE 2. equals : negated conditional → NO_COVERAGE 3. equals : replaced boolean return with true for com/takenoko/actions/irrigation/PlaceIrrigationAction::equals → NO_COVERAGE |
if (o == null || getClass() != o.getClass()) return false; |
| 35 | PlaceIrrigationAction that = (PlaceIrrigationAction) o; | |
| 36 |
2
1. equals : replaced boolean return with false for com/takenoko/actions/irrigation/PlaceIrrigationAction::equals → NO_COVERAGE 2. equals : replaced boolean return with true for com/takenoko/actions/irrigation/PlaceIrrigationAction::equals → NO_COVERAGE |
return Objects.equals(edgePosition, that.edgePosition); |
| 37 | } | |
| 38 | ||
| 39 | @Override | |
| 40 | public int hashCode() { | |
| 41 |
1
1. hashCode : replaced int return with 0 for com/takenoko/actions/irrigation/PlaceIrrigationAction::hashCode → NO_COVERAGE |
return Objects.hash(edgePosition); |
| 42 | } | |
| 43 | } | |
Mutations | ||
| 23 |
1.1 |
|
| 25 |
1.1 |
|
| 26 |
1.1 |
|
| 27 |
1.1 |
|
| 28 |
1.1 |
|
| 33 |
1.1 2.2 |
|
| 34 |
1.1 2.2 3.3 |
|
| 36 |
1.1 2.2 |
|
| 41 |
1.1 |