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