1 | package pro.verron.officestamper.preset; | |
2 | ||
3 | import org.springframework.lang.NonNull; | |
4 | ||
5 | import java.util.*; | |
6 | ||
7 | import static java.util.Collections.singletonList; | |
8 | ||
9 | /// Represents a table with several columns, a header line, and several lines of content | |
10 | /// | |
11 | /// @author Joseph Verron | |
12 | /// @version ${version} | |
13 | /// @since 1.6.2 | |
14 | public class StampTable | |
15 | extends AbstractSequentialList<List<String>> { | |
16 | private final List<String> headers; | |
17 | private final List<List<String>> records; | |
18 | ||
19 | @Override public boolean equals(Object o) { | |
20 |
2
1. equals : negated conditional → NO_COVERAGE 2. equals : replaced boolean return with false for pro/verron/officestamper/preset/StampTable::equals → NO_COVERAGE |
if (this == o) return true; |
21 |
3
1. equals : negated conditional → NO_COVERAGE 2. equals : replaced boolean return with true for pro/verron/officestamper/preset/StampTable::equals → NO_COVERAGE 3. equals : negated conditional → NO_COVERAGE |
if (o == null || getClass() != o.getClass()) return false; |
22 |
2
1. equals : replaced boolean return with true for pro/verron/officestamper/preset/StampTable::equals → NO_COVERAGE 2. equals : negated conditional → NO_COVERAGE |
if (!super.equals(o)) return false; |
23 | StampTable lists = (StampTable) o; | |
24 |
3
1. equals : negated conditional → NO_COVERAGE 2. equals : negated conditional → NO_COVERAGE 3. equals : replaced boolean return with true for pro/verron/officestamper/preset/StampTable::equals → NO_COVERAGE |
return Objects.equals(headers, lists.headers) && Objects.equals(records, lists.records); |
25 | } | |
26 | ||
27 | @Override public int hashCode() { | |
28 |
1
1. hashCode : replaced int return with 0 for pro/verron/officestamper/preset/StampTable::hashCode → NO_COVERAGE |
return Objects.hash(super.hashCode(), headers, records); |
29 | } | |
30 | ||
31 | /// Instantiate an empty table | |
32 | public StampTable() { | |
33 | this.headers = new ArrayList<>(); | |
34 | this.records = new ArrayList<>(); | |
35 | } | |
36 | ||
37 | /// Instantiate a table with headers and several lines | |
38 | /// | |
39 | /// @param headers the header lines | |
40 | /// @param records the lines that the table should contain | |
41 | public StampTable( | |
42 | @NonNull List<String> headers, | |
43 | @NonNull List<List<String>> records | |
44 | ) { | |
45 | this.headers = headers; | |
46 | this.records = records; | |
47 | } | |
48 | ||
49 | @Override | |
50 | public int size() { | |
51 |
1
1. size : replaced int return with 0 for pro/verron/officestamper/preset/StampTable::size → KILLED |
return records.size(); |
52 | } | |
53 | ||
54 | @Override | |
55 | @NonNull | |
56 | public ListIterator<List<String>> listIterator(int index) { | |
57 |
1
1. listIterator : replaced return value with null for pro/verron/officestamper/preset/StampTable::listIterator → KILLED |
return records.listIterator(index); |
58 | } | |
59 | ||
60 | /// empty. | |
61 | /// | |
62 | /// @return a [StampTable] object | |
63 | public static StampTable empty() { | |
64 |
1
1. empty : replaced return value with null for pro/verron/officestamper/preset/StampTable::empty → NO_COVERAGE |
return new StampTable( |
65 | singletonList("placeholder"), | |
66 | singletonList(singletonList("placeholder")) | |
67 | ); | |
68 | } | |
69 | ||
70 | /// headers. | |
71 | /// | |
72 | /// @return a [List] object | |
73 | public List<String> headers() { | |
74 |
1
1. headers : replaced return value with Collections.emptyList for pro/verron/officestamper/preset/StampTable::headers → KILLED |
return headers; |
75 | } | |
76 | ||
77 | } | |
Mutations | ||
20 |
1.1 2.2 |
|
21 |
1.1 2.2 3.3 |
|
22 |
1.1 2.2 |
|
24 |
1.1 2.2 3.3 |
|
28 |
1.1 |
|
51 |
1.1 |
|
57 |
1.1 |
|
64 |
1.1 |
|
74 |
1.1 |