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