Package: ReferencedListValueDescriptor
ReferencedListValueDescriptor
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ReferencedListValueDescriptor(NamedResource, Assertion, Assertion, Assertion) |
|
|
|
|
|
||||||||||||||||||||
addValue(NamedResource) |
|
|
|
|
|
||||||||||||||||||||
equals(Object) |
|
|
|
|
|
||||||||||||||||||||
getValues() |
|
|
|
|
|
||||||||||||||||||||
hashCode() |
|
|
|
|
|
||||||||||||||||||||
toString() |
|
|
|
|
|
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: @Override
42: public void addValue(NamedResource value) {
43: Objects.requireNonNull(value);
44: values.add(value);
45: }
46:
47: @Override
48: public int hashCode() {
49: final int prime = 31;
50: int result = super.hashCode();
51: result = prime * result + values.hashCode();
52: return result;
53: }
54:
55: @Override
56: public boolean equals(Object obj) {
57:• if (this == obj)
58: return true;
59:• if (obj == null || getClass() != obj.getClass())
60: return false;
61: ReferencedListValueDescriptor other = (ReferencedListValueDescriptor) obj;
62:• if (!descriptor.equals(other.descriptor))
63: return false;
64:• if (!getNodeContent().equals(other.getNodeContent()))
65: return false;
66: return values.equals(other.values);
67: }
68:
69: @Override
70: public String toString() {
71: return "[ReferencedListValueDescriptor: owner = " + descriptor.getListOwner() + ", values = " + values + "]";
72: }
73: }