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