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: * <p>
4: * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
5: * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
6: * version.
7: * <p>
8: * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
9: * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
10: * details. You should have received a copy of the GNU General Public License along with this program. If not, see
11: * <http://www.gnu.org/licenses/>.
12: */
13: package cz.cvut.kbss.ontodriver.descriptor;
14:
15: import cz.cvut.kbss.ontodriver.model.Assertion;
16: import cz.cvut.kbss.ontodriver.model.NamedResource;
17:
18: import java.util.ArrayList;
19: import java.util.Collections;
20: import java.util.List;
21: import java.util.Objects;
22:
23: /**
24: * Represents values of a simple sequence.
25: *
26: * @author kidney
27: * @see SimpleListDescriptorImpl
28: */
29: public class SimpleListValueDescriptor extends SimpleListDescriptorImpl implements
30: ListValueDescriptor {
31:
32: private final List<NamedResource> values;
33:
34: public SimpleListValueDescriptor(NamedResource listOwner, Assertion listProperty,
35: Assertion nextNodeProperty) {
36: super(listOwner, listProperty, nextNodeProperty);
37: this.values = new ArrayList<>();
38: }
39:
40: @Override
41: public List<NamedResource> getValues() {
42: return Collections.unmodifiableList(values);
43: }
44:
45: @Override
46: public void addValue(NamedResource value) {
47: Objects.requireNonNull(value);
48: values.add(value);
49: }
50:
51: @Override
52: public int hashCode() {
53: final int prime = 31;
54: int result = super.hashCode();
55: result = prime * result + values.hashCode();
56: return result;
57: }
58:
59: @Override
60: public boolean equals(Object obj) {
61:• if (this == obj)
62: return true;
63:• if (obj == null || getClass() != obj.getClass())
64: return false;
65: SimpleListValueDescriptor other = (SimpleListValueDescriptor) obj;
66:• if (!descriptor.equals(other.descriptor)) {
67: return false;
68: }
69: return values.equals(other.values);
70: }
71:
72: @Override
73: public String toString() {
74: return "[SimpleListValueDescriptor: owner = " + descriptor.getListOwner() + ", values = " + values + "]";
75: }
76: }