| 1 | package com.takenoko.actions.irrigation; | |
| 2 | ||
| 3 | import com.takenoko.actions.ActionResult; | |
| 4 | import com.takenoko.actions.DefaultAction; | |
| 5 | import com.takenoko.actions.annotations.ActionAnnotation; | |
| 6 | import com.takenoko.actions.annotations.ActionCanBePlayedMultipleTimesPerTurn; | |
| 7 | import com.takenoko.actions.annotations.ActionType; | |
| 8 | import com.takenoko.engine.Board; | |
| 9 | import com.takenoko.engine.BotManager; | |
| 10 | import com.takenoko.engine.BotState; | |
| 11 | import com.takenoko.layers.irrigation.EdgePosition; | |
| 12 | import java.util.Objects; | |
| 13 | ||
| 14 | @ActionAnnotation(ActionType.DEFAULT) | |
| 15 | @ActionCanBePlayedMultipleTimesPerTurn | |
| 16 | public class PlaceIrrigationFromInventoryAction implements DefaultAction { | |
| 17 | final EdgePosition positionVector; | |
| 18 | ||
| 19 | public PlaceIrrigationFromInventoryAction(EdgePosition positionVector) { | |
| 20 | this.positionVector = positionVector; | |
| 21 | } | |
| 22 | ||
| 23 | @Override | |
| 24 | public ActionResult execute(Board board, BotManager botManager) { | |
| 25 |
1
1. execute : removed call to com/takenoko/engine/BotManager::displayMessage → TIMED_OUT |
botManager.displayMessage( |
| 26 | botManager.getName() | |
| 27 | + " placed irrigation at " | |
| 28 | + positionVector | |
| 29 | + " from inventory"); | |
| 30 |
1
1. execute : removed call to com/takenoko/inventory/Inventory::useIrrigationChannel → KILLED |
botManager.getInventory().useIrrigationChannel(); |
| 31 |
1
1. execute : removed call to com/takenoko/engine/Board::placeIrrigation → KILLED |
board.placeIrrigation(positionVector); |
| 32 |
1
1. execute : replaced return value with null for com/takenoko/actions/irrigation/PlaceIrrigationFromInventoryAction::execute → KILLED |
return new ActionResult(0); |
| 33 | } | |
| 34 | ||
| 35 | public static boolean canBePlayed(Board board, BotState botState) { | |
| 36 |
3
1. canBePlayed : changed conditional boundary → TIMED_OUT 2. canBePlayed : negated conditional → TIMED_OUT 3. canBePlayed : replaced boolean return with true for com/takenoko/actions/irrigation/PlaceIrrigationFromInventoryAction::canBePlayed → KILLED |
return botState.getInventory().getIrrigationChannelsCount() > 0 |
| 37 |
1
1. canBePlayed : negated conditional → TIMED_OUT |
&& !board.getAvailableIrrigationPositions().isEmpty(); |
| 38 | } | |
| 39 | ||
| 40 | @Override | |
| 41 | public boolean equals(Object o) { | |
| 42 |
2
1. equals : negated conditional → NO_COVERAGE 2. equals : replaced boolean return with false for com/takenoko/actions/irrigation/PlaceIrrigationFromInventoryAction::equals → NO_COVERAGE |
if (this == o) return true; |
| 43 |
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/PlaceIrrigationFromInventoryAction::equals → NO_COVERAGE |
if (o == null || getClass() != o.getClass()) return false; |
| 44 | PlaceIrrigationFromInventoryAction that = (PlaceIrrigationFromInventoryAction) o; | |
| 45 |
2
1. equals : replaced boolean return with false for com/takenoko/actions/irrigation/PlaceIrrigationFromInventoryAction::equals → NO_COVERAGE 2. equals : replaced boolean return with true for com/takenoko/actions/irrigation/PlaceIrrigationFromInventoryAction::equals → NO_COVERAGE |
return Objects.equals(positionVector, that.positionVector); |
| 46 | } | |
| 47 | ||
| 48 | @Override | |
| 49 | public int hashCode() { | |
| 50 |
1
1. hashCode : replaced int return with 0 for com/takenoko/actions/irrigation/PlaceIrrigationFromInventoryAction::hashCode → TIMED_OUT |
return Objects.hash(positionVector); |
| 51 | } | |
| 52 | } | |
Mutations | ||
| 25 |
1.1 |
|
| 30 |
1.1 |
|
| 31 |
1.1 |
|
| 32 |
1.1 |
|
| 36 |
1.1 2.2 3.3 |
|
| 37 |
1.1 |
|
| 42 |
1.1 2.2 |
|
| 43 |
1.1 2.2 3.3 |
|
| 45 |
1.1 2.2 |
|
| 50 |
1.1 |