| 1 | package com.takenoko.asset; | |
| 2 | ||
| 3 | /** IrrigationDeck represents the irrigation deck, defaults to 20 irrigation. */ | |
| 4 | public class IrrigationDeck { | |
| 5 | public static final int DEFAULT_SIZE = 20; | |
| 6 | private int size; | |
| 7 | ||
| 8 | /** Creates a new IrrigationDeck with the default size. */ | |
| 9 | public IrrigationDeck() { | |
| 10 | size = DEFAULT_SIZE; | |
| 11 | } | |
| 12 | ||
| 13 | /** Draws an irrigation from the deck. */ | |
| 14 | public void draw() { | |
| 15 |
2
1. draw : changed conditional boundary → TIMED_OUT 2. draw : negated conditional → KILLED |
if (size <= 0) { |
| 16 | throw new IllegalArgumentException("No more irrigation"); | |
| 17 | } | |
| 18 |
1
1. draw : Replaced integer subtraction with addition → KILLED |
size--; |
| 19 | } | |
| 20 | ||
| 21 | /** | |
| 22 | * @return true if the deck has irrigation, false otherwise | |
| 23 | */ | |
| 24 | public boolean hasIrrigation() { | |
| 25 |
3
1. hasIrrigation : changed conditional boundary → TIMED_OUT 2. hasIrrigation : replaced boolean return with true for com/takenoko/asset/IrrigationDeck::hasIrrigation → TIMED_OUT 3. hasIrrigation : negated conditional → KILLED |
return size > 0; |
| 26 | } | |
| 27 | ||
| 28 | /** | |
| 29 | * @return the number of irrigation left in the deck | |
| 30 | */ | |
| 31 | public int getSize() { | |
| 32 |
1
1. getSize : replaced int return with 0 for com/takenoko/asset/IrrigationDeck::getSize → KILLED |
return size; |
| 33 | } | |
| 34 | ||
| 35 | @Override | |
| 36 | public boolean equals(Object o) { | |
| 37 |
2
1. equals : negated conditional → SURVIVED 2. equals : replaced boolean return with false for com/takenoko/asset/IrrigationDeck::equals → NO_COVERAGE |
if (this == o) return true; |
| 38 |
3
1. equals : replaced boolean return with true for com/takenoko/asset/IrrigationDeck::equals → NO_COVERAGE 2. equals : negated conditional → KILLED 3. equals : negated conditional → KILLED |
if (o == null || getClass() != o.getClass()) return false; |
| 39 | ||
| 40 | IrrigationDeck that = (IrrigationDeck) o; | |
| 41 | ||
| 42 |
2
1. equals : replaced boolean return with true for com/takenoko/asset/IrrigationDeck::equals → SURVIVED 2. equals : negated conditional → KILLED |
return size == that.size; |
| 43 | } | |
| 44 | ||
| 45 | @Override | |
| 46 | public int hashCode() { | |
| 47 |
1
1. hashCode : replaced int return with 0 for com/takenoko/asset/IrrigationDeck::hashCode → TIMED_OUT |
return size; |
| 48 | } | |
| 49 | ||
| 50 | @Override | |
| 51 | public String toString() { | |
| 52 |
1
1. toString : replaced return value with "" for com/takenoko/asset/IrrigationDeck::toString → NO_COVERAGE |
return "IrrigationDeck{" + "size=" + size + '}'; |
| 53 | } | |
| 54 | } | |
Mutations | ||
| 15 |
1.1 2.2 |
|
| 18 |
1.1 |
|
| 25 |
1.1 2.2 3.3 |
|
| 32 |
1.1 |
|
| 37 |
1.1 2.2 |
|
| 38 |
1.1 2.2 3.3 |
|
| 42 |
1.1 2.2 |
|
| 47 |
1.1 |
|
| 52 |
1.1 |