CommentReferenceRemoverVisitor.java

1
package pro.verron.officestamper.preset.preprocessors.malformedcomments;
2
3
import org.docx4j.utils.TraversalUtilVisitor;
4
import org.docx4j.wml.R;
5
import org.slf4j.Logger;
6
import org.slf4j.LoggerFactory;
7
8
import java.math.BigInteger;
9
import java.util.HashMap;
10
import java.util.List;
11
import java.util.Map;
12
13
class CommentReferenceRemoverVisitor
14
        extends TraversalUtilVisitor<R.CommentReference> {
15
    private static final Logger log = LoggerFactory.getLogger(CommentReferenceRemoverVisitor.class);
16
17
    private final List<BigInteger> ids;
18
    private final Map<Object, List<Object>> toRemove = new HashMap<>();
19
20
    CommentReferenceRemoverVisitor(List<BigInteger> ids) {
21
        this.ids = ids;
22
    }
23
24
    @Override
25
    public void apply(R.CommentReference element, Object parent, List<Object> siblings) {
26 1 1. apply : negated conditional → TIMED_OUT
        if (ids.contains(element.getId())) toRemove.put(element, siblings);
27
    }
28
29
    void run() {
30
        if (!toRemove.isEmpty()) log.debug("Removed Comment References: {}", toRemove);
31 1 1. run : removed call to java/util/Map::forEach → TIMED_OUT
        toRemove.forEach((object, siblings) -> siblings.remove(object));
32
    }
33
}

Mutations

26

1.1
Location : apply
Killed by : none
negated conditional → TIMED_OUT

31

1.1
Location : run
Killed by : none
removed call to java/util/Map::forEach → TIMED_OUT

Active mutators

Tests examined


Report generated by PIT 1.22.0