• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

evolvedbinary / elemental / 982

29 Apr 2025 08:34PM UTC coverage: 56.409% (+0.007%) from 56.402%
982

push

circleci

adamretter
[feature] Improve README.md badges

28451 of 55847 branches covered (50.94%)

Branch coverage included in aggregate %.

77468 of 131924 relevant lines covered (58.72%)

0.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

11.11
/exist-core/src/main/java/org/exist/dom/memtree/DocumentTypeImpl.java
1
/*
2
 * Elemental
3
 * Copyright (C) 2024, Evolved Binary Ltd
4
 *
5
 * admin@evolvedbinary.com
6
 * https://www.evolvedbinary.com | https://www.elemental.xyz
7
 *
8
 * Use of this software is governed by the Business Source License 1.1
9
 * included in the LICENSE file and at www.mariadb.com/bsl11.
10
 *
11
 * Change Date: 2028-04-27
12
 *
13
 * On the date above, in accordance with the Business Source License, use
14
 * of this software will be governed by the Apache License, Version 2.0.
15
 *
16
 * Additional Use Grant: Production use of the Licensed Work for a permitted
17
 * purpose. A Permitted Purpose is any purpose other than a Competing Use.
18
 * A Competing Use means making the Software available to others in a commercial
19
 * product or service that: substitutes for the Software; substitutes for any
20
 * other product or service we offer using the Software that exists as of the
21
 * date we make the Software available; or offers the same or substantially
22
 * similar functionality as the Software.
23
 */
24
package org.exist.dom.memtree;
25

26
import net.jcip.annotations.ThreadSafe;
27
import org.exist.xquery.Expression;
28
import org.exist.xquery.NodeTest;
29
import org.exist.xquery.XPathException;
30
import org.exist.xquery.value.Sequence;
31
import org.w3c.dom.DocumentType;
32
import org.w3c.dom.NamedNodeMap;
33

34
import javax.annotation.Nullable;
35

36
/**
37
 * @author <a href="mailto:adam@evolvedbinary.com">Adam Retter</a>
38
 */
39
@ThreadSafe
40
public class DocumentTypeImpl extends NodeImpl<DocumentTypeImpl> implements DocumentType {
41

42
    private final String publicId;
43
    private final String systemId;
44
    private final String name;
45

46
    public DocumentTypeImpl(final DocumentImpl doc, final int nodeNumber, final String name, final String publicId, final String systemId) {
47
        this(null, doc, nodeNumber, name, publicId, systemId);
×
48
    }
×
49

50
    public DocumentTypeImpl(@Nullable final Expression expression, final DocumentImpl doc, final int nodeNumber, final String name, final String publicId, final String systemId) {
51
        super(expression, doc, nodeNumber);
1✔
52
        this.name = name;
1✔
53
        this.publicId = publicId;
1✔
54
        this.systemId = systemId;
1✔
55
    }
1✔
56

57
    @Override
58
    public String getName() {
59
        return name;
1✔
60
    }
61

62
    @Override
63
    public String getPublicId() {
64
        return publicId;
1✔
65
    }
66

67
    @Override
68
    public String getSystemId() {
69
        return systemId;
1✔
70
    }
71

72
    @Override
73
    public NamedNodeMap getEntities() {
74
        return null;
×
75
    }
76

77
    @Override
78
    public NamedNodeMap getNotations() {
79
        return null;
×
80
    }
81

82
    @Override
83
    public String getInternalSubset() {
84
        return null;
×
85
    }
86

87
    @Override
88
    public String toString() {
89
        final StringBuilder builder = new StringBuilder();
×
90

91
        builder.append("<!DOCTYPE ").append(name);
×
92

93
        if(publicId != null) {
×
94
            builder.append(" PUBLIC \"").append(publicId).append("\"");
×
95
        }
96

97
        if(systemId != null) {
×
98
            if(publicId == null) {
×
99
                builder.append(" SYSTEM");
×
100
            }
101
            builder.append(" \"").append(systemId).append("\"");
×
102
        }
103

104
        builder.append(" >");
×
105

106
        return builder.toString();
×
107
    }
108

109
    @Override
110
    public void selectAttributes(final NodeTest test, final Sequence result) throws XPathException {
111
    }
×
112

113
    @Override
114
    public void selectDescendantAttributes(final NodeTest test, final Sequence result) throws XPathException {
115
    }
×
116

117
    @Override
118
    public void selectChildren(final NodeTest test, final Sequence result) throws XPathException {
119

120
    }
×
121

122
    @Override
123
    public int compareTo(final DocumentTypeImpl other) {
124
        int comparison = name.compareTo(other.name);
×
125
        if (comparison != 0) {
×
126
            return comparison;
×
127
        }
128

129
        if (publicId == null && other.publicId != null) {
×
130
            return -1;
×
131
        } else if (publicId != null && other.publicId == null) {
×
132
            return 1;
×
133
        }
134
        comparison = publicId.compareTo(other.publicId);
×
135
        if (comparison != 0) {
×
136
            return comparison;
×
137
        }
138

139
        if (systemId == null && other.systemId != null) {
×
140
            return -1;
×
141
        } else if (systemId != null && other.systemId == null) {
×
142
            return 1;
×
143
        }
144
        comparison = systemId.compareTo(other.systemId);
×
145
        if (comparison != 0) {
×
146
            return comparison;
×
147
        }
148

149
        return 0;
×
150
    }
151
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc