StampTable.java

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

Mutations

37

1.1
Location : empty
Killed by : none
replaced return value with null for pro/verron/officestamper/preset/StampTable::empty → NO_COVERAGE

42

1.1
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : equals
Killed by : none
replaced boolean return with false for pro/verron/officestamper/preset/StampTable::equals → NO_COVERAGE

43

1.1
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : equals
Killed by : none
replaced boolean return with true for pro/verron/officestamper/preset/StampTable::equals → NO_COVERAGE

3.3
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

44

1.1
Location : equals
Killed by : none
replaced boolean return with true for pro/verron/officestamper/preset/StampTable::equals → NO_COVERAGE

2.2
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

46

1.1
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : equals
Killed by : none
replaced boolean return with true for pro/verron/officestamper/preset/StampTable::equals → NO_COVERAGE

51

1.1
Location : hashCode
Killed by : none
replaced int return with 0 for pro/verron/officestamper/preset/StampTable::hashCode → NO_COVERAGE

56

1.1
Location : size
Killed by : pro.verron.officestamper.test.StampTableTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.StampTableTest]/[test-template:stampTableTest(pro.verron.officestamper.test.utils.ContextFactory)]/[test-template-invocation:#2]
replaced int return with 0 for pro/verron/officestamper/preset/StampTable::size → KILLED

61

1.1
Location : listIterator
Killed by : pro.verron.officestamper.test.StampTableTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.StampTableTest]/[test-template:stampTableTest(pro.verron.officestamper.test.utils.ContextFactory)]/[test-template-invocation:#2]
replaced return value with null for pro/verron/officestamper/preset/StampTable::listIterator → KILLED

68

1.1
Location : headers
Killed by : pro.verron.officestamper.test.StampTableTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.StampTableTest]/[test-template:stampTableTest(pro.verron.officestamper.test.utils.ContextFactory)]/[test-template-invocation:#2]
replaced return value with Collections.emptyList for pro/verron/officestamper/preset/StampTable::headers → KILLED

Active mutators

Tests examined


Report generated by PIT 1.25.5 support