Skip to content

Package: BaseListDescriptorImpl

BaseListDescriptorImpl

nameinstructionbranchcomplexitylinemethod
BaseListDescriptorImpl(NamedResource, Assertion, Assertion)
M: 0 C: 24
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
equals(Object)
M: 59 C: 0
0%
M: 16 C: 0
0%
M: 9 C: 0
0%
M: 16 C: 0
0%
M: 1 C: 0
0%
getContext()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getListOwner()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getListProperty()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getNextNode()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
hashCode()
M: 0 C: 43
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 7
100%
M: 0 C: 1
100%
setContext(URI)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
toString()
M: 10 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (C) 2023 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.ontodriver.descriptor;
16:
17: import cz.cvut.kbss.ontodriver.model.Assertion;
18: import cz.cvut.kbss.ontodriver.model.NamedResource;
19: import cz.cvut.kbss.ontodriver.util.ErrorUtils;
20:
21: import java.net.URI;
22: import java.util.Objects;
23:
24: final class BaseListDescriptorImpl implements ListDescriptor {
25:
26: private final NamedResource listOwner;
27: private final Assertion listProperty;
28: private final Assertion nextNode;
29:
30: private URI context;
31:
32: public BaseListDescriptorImpl(NamedResource listOwner, Assertion listProperty, Assertion nextNode) {
33: this.listOwner = Objects.requireNonNull(listOwner, ErrorUtils.getNPXMessageSupplier("listOwner"));
34: this.listProperty = Objects.requireNonNull(listProperty, ErrorUtils.getNPXMessageSupplier("listProperty"));
35: this.nextNode = Objects.requireNonNull(nextNode, ErrorUtils.getNPXMessageSupplier("nextNode"));
36: }
37:
38: @Override
39: public URI getContext() {
40: return context;
41: }
42:
43: @Override
44: public void setContext(URI context) {
45: // null permitted here
46: this.context = context;
47: }
48:
49: @Override
50: public NamedResource getListOwner() {
51: return listOwner;
52: }
53:
54: @Override
55: public Assertion getListProperty() {
56: return listProperty;
57: }
58:
59: @Override
60: public Assertion getNextNode() {
61: return nextNode;
62: }
63:
64: @Override
65: public int hashCode() {
66: final int prime = 31;
67: int result = 1;
68: result = prime * result + listOwner.hashCode();
69: result = prime * result + listProperty.hashCode();
70: result = prime * result + nextNode.hashCode();
71:• result = prime * result + ((context == null) ? 0 : context.hashCode());
72: return result;
73: }
74:
75: @Override
76: public boolean equals(Object obj) {
77:• if (this == obj)
78: return true;
79:• if (obj == null)
80: return false;
81:• if (getClass() != obj.getClass())
82: return false;
83: BaseListDescriptorImpl other = (BaseListDescriptorImpl) obj;
84:• if (!listOwner.equals(other.listOwner))
85: return false;
86:• if (!listProperty.equals(other.listProperty))
87: return false;
88:• if (!nextNode.equals(other.nextNode))
89: return false;
90:• if (context == null) {
91:• return other.context == null;
92: } else return context.equals(other.context);
93: }
94:
95: @Override
96: public String toString() {
97: return "owner = " + listOwner + ", list = " + listProperty + ", next node = " + nextNode + ", context = " +
98: context;
99: }
100: }