1 | package com.renomad.minum.htmlparsing; | |
2 | ||
3 | import java.util.*; | |
4 | ||
5 | /** | |
6 | * tagname and attributes inside an HTML5 tag | |
7 | */ | |
8 | public final class TagInfo { | |
9 | ||
10 | private final TagName tagName; | |
11 | private final Map<String, String> attributes; | |
12 | ||
13 | public TagInfo( | |
14 | TagName tagName, | |
15 | Map<String, String> attributes | |
16 | ) { | |
17 | this.tagName = tagName; | |
18 | this.attributes = new HashMap<>(attributes); | |
19 | } | |
20 | ||
21 | /** | |
22 | * a null object | |
23 | */ | |
24 | public static final TagInfo EMPTY = new TagInfo(TagName.NULL, Map.of()); | |
25 | ||
26 | public TagName getTagName() { | |
27 |
1
1. getTagName : replaced return value with null for com/renomad/minum/htmlparsing/TagInfo::getTagName → KILLED |
return tagName; |
28 | } | |
29 | ||
30 | boolean containsAllAttributes(Set<Map.Entry<String, String>> entries) { | |
31 |
2
1. containsAllAttributes : replaced boolean return with true for com/renomad/minum/htmlparsing/TagInfo::containsAllAttributes → KILLED 2. containsAllAttributes : replaced boolean return with false for com/renomad/minum/htmlparsing/TagInfo::containsAllAttributes → KILLED |
return attributes.entrySet().containsAll(entries); |
32 | } | |
33 | ||
34 | public String getAttribute(String key) { | |
35 |
1
1. getAttribute : replaced return value with "" for com/renomad/minum/htmlparsing/TagInfo::getAttribute → KILLED |
return attributes.get(key); |
36 | } | |
37 | ||
38 | public Map<String, String> getAttributes() { | |
39 |
1
1. getAttributes : replaced return value with Collections.emptyMap for com/renomad/minum/htmlparsing/TagInfo::getAttributes → KILLED |
return new HashMap<>(attributes); |
40 | } | |
41 | ||
42 | @Override | |
43 | public boolean equals(Object o) { | |
44 |
2
1. equals : replaced boolean return with false for com/renomad/minum/htmlparsing/TagInfo::equals → KILLED 2. equals : negated conditional → KILLED |
if (this == o) return true; |
45 |
2
1. equals : replaced boolean return with true for com/renomad/minum/htmlparsing/TagInfo::equals → TIMED_OUT 2. equals : negated conditional → KILLED |
if (!(o instanceof TagInfo tagInfo)) return false; |
46 |
3
1. equals : negated conditional → KILLED 2. equals : replaced boolean return with true for com/renomad/minum/htmlparsing/TagInfo::equals → KILLED 3. equals : negated conditional → KILLED |
return tagName == tagInfo.tagName && Objects.equals(attributes, tagInfo.attributes); |
47 | } | |
48 | ||
49 | @Override | |
50 | public int hashCode() { | |
51 |
1
1. hashCode : replaced int return with 0 for com/renomad/minum/htmlparsing/TagInfo::hashCode → KILLED |
return Objects.hash(tagName, attributes); |
52 | } | |
53 | ||
54 | @Override | |
55 | public String toString() { | |
56 |
1
1. toString : replaced return value with "" for com/renomad/minum/htmlparsing/TagInfo::toString → KILLED |
return "TagInfo{" + |
57 | "tagName=" + tagName + | |
58 | ", attributes=" + attributes + | |
59 | '}'; | |
60 | } | |
61 | ||
62 | } | |
Mutations | ||
27 |
1.1 |
|
31 |
1.1 2.2 |
|
35 |
1.1 |
|
39 |
1.1 |
|
44 |
1.1 2.2 |
|
45 |
1.1 2.2 |
|
46 |
1.1 2.2 3.3 |
|
51 |
1.1 |
|
56 |
1.1 |