Skip to content

Package: SimpleListValueDescriptor

SimpleListValueDescriptor

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