Skip to content

Package: ReferencedListValueDescriptor

ReferencedListValueDescriptor

nameinstructionbranchcomplexitylinemethod
ReferencedListValueDescriptor(NamedResource, Assertion, Assertion, Assertion)
M: 0 C: 12
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
addValue(NamedResource)
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
equals(Object)
M: 39 C: 0
0%
M: 10 C: 0
0%
M: 6 C: 0
0%
M: 10 C: 0
0%
M: 1 C: 0
0%
getValues()
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
hashCode()
M: 15 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
toString()
M: 18 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) 2016 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:
20: import java.util.ArrayList;
21: import java.util.Collections;
22: import java.util.List;
23: import java.util.Objects;
24:
25: public class ReferencedListValueDescriptor extends ReferencedListDescriptorImpl implements
26: ListValueDescriptor {
27:
28: private final List<NamedResource> values;
29:
30: public ReferencedListValueDescriptor(NamedResource listOwner, Assertion listProperty,
31: Assertion nextNode, Assertion nodeContent) {
32: super(listOwner, listProperty, nextNode, nodeContent);
33: this.values = new ArrayList<>();
34: }
35:
36: @Override
37: public List<NamedResource> getValues() {
38: return Collections.unmodifiableList(values);
39: }
40:
41: public void addValue(NamedResource value) {
42: Objects.requireNonNull(value);
43: values.add(value);
44: }
45:
46: @Override
47: public int hashCode() {
48: final int prime = 31;
49: int result = super.hashCode();
50: result = prime * result + values.hashCode();
51: return result;
52: }
53:
54: @Override
55: public boolean equals(Object obj) {
56:• if (this == obj)
57: return true;
58:• if (obj == null || getClass() != obj.getClass())
59: return false;
60: ReferencedListValueDescriptor other = (ReferencedListValueDescriptor) obj;
61:• if (!descriptor.equals(other.descriptor))
62: return false;
63:• if (!getNodeContent().equals(other.getNodeContent()))
64: return false;
65: return values.equals(other.values);
66: }
67:
68: @Override
69: public String toString() {
70: return "[ReferencedListValueDescriptor: owner = " + descriptor.getListOwner() + ", values = " + values + "]";
71: }
72: }