1 | package fr.sii.ogham.core.condition; | |
2 | ||
3 | import fr.sii.ogham.core.util.EqualsBuilder; | |
4 | import fr.sii.ogham.core.util.HashCodeBuilder; | |
5 | ||
6 | /** | |
7 | * Basic condition that always give the same result: the result you provided at | |
8 | * construction. | |
9 | * | |
10 | * @author Aurélien Baudet | |
11 | * | |
12 | * @param <T> | |
13 | * the type of the object to test | |
14 | */ | |
15 | public class FixedCondition<T> implements Condition<T> { | |
16 | private final boolean accept; | |
17 | ||
18 | /** | |
19 | * Initializes with the value that will always be returned when calling | |
20 | * {@link #accept(Object)}. | |
21 | * | |
22 | * @param accept | |
23 | * true to always accept, false to always reject | |
24 | */ | |
25 | public FixedCondition(boolean accept) { | |
26 | super(); | |
27 | this.accept = accept; | |
28 | } | |
29 | ||
30 | @Override | |
31 | public boolean accept(T obj) { | |
32 |
10
1. accept : replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::accept → NO_COVERAGE 2. accept : replaced boolean return with true for fr/sii/ogham/core/condition/FixedCondition::accept → SURVIVED 3. accept : replaced boolean return with true for fr/sii/ogham/core/condition/FixedCondition::accept → NO_COVERAGE 4. accept : replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::accept → TIMED_OUT 5. accept : replaced boolean return with true for fr/sii/ogham/core/condition/FixedCondition::accept → TIMED_OUT 6. accept : replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::accept → KILLED 7. accept : replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::accept → KILLED 8. accept : replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::accept → KILLED 9. accept : replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::accept → KILLED 10. accept : replaced boolean return with true for fr/sii/ogham/core/condition/FixedCondition::accept → KILLED |
return accept; |
33 | } | |
34 | ||
35 | @Override | |
36 | public boolean equals(Object obj) { | |
37 |
2
1. equals : replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::equals → NO_COVERAGE 2. equals : replaced boolean return with true for fr/sii/ogham/core/condition/FixedCondition::equals → NO_COVERAGE |
return new EqualsBuilder(this, obj).appendFields("accept").isEqual(); |
38 | } | |
39 | ||
40 | @Override | |
41 | public int hashCode() { | |
42 |
1
1. hashCode : replaced int return with 0 for fr/sii/ogham/core/condition/FixedCondition::hashCode → NO_COVERAGE |
return new HashCodeBuilder().append(accept).hashCode(); |
43 | } | |
44 | ||
45 | @Override | |
46 | public String toString() { | |
47 | StringBuilder builder = new StringBuilder(); | |
48 | builder.append(accept); | |
49 |
1
1. toString : replaced return value with "" for fr/sii/ogham/core/condition/FixedCondition::toString → NO_COVERAGE |
return builder.toString(); |
50 | } | |
51 | } | |
Mutations | ||
32 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 9.9 10.10 |
|
37 |
1.1 2.2 |
|
42 |
1.1 |
|
49 |
1.1 |