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