Package: ReferencedListDescriptorImpl
ReferencedListDescriptorImpl
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ReferencedListDescriptorImpl(NamedResource, Assertion, Assertion, Assertion) |
|
|
|
|
|
||||||||||||||||||||
ReferencedListDescriptorImpl(NamedResource, Assertion, Assertion, Assertion, boolean) |
|
|
|
|
|
||||||||||||||||||||
equals(Object) |
|
|
|
|
|
||||||||||||||||||||
getContext() |
|
|
|
|
|
||||||||||||||||||||
getListOwner() |
|
|
|
|
|
||||||||||||||||||||
getListProperty() |
|
|
|
|
|
||||||||||||||||||||
getNextNode() |
|
|
|
|
|
||||||||||||||||||||
getNodeContent() |
|
|
|
|
|
||||||||||||||||||||
hashCode() |
|
|
|
|
|
||||||||||||||||||||
isTerminatedByNil() |
|
|
|
|
|
||||||||||||||||||||
setContext(URI) |
|
|
|
|
|
||||||||||||||||||||
toString() |
|
|
|
|
|
Coverage
1: /*
2: * JOPA
3: * Copyright (C) 2024 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.net.URI;
24: import java.util.Objects;
25:
26: /**
27: * Represents singly-linked referenced list.
28: * <p>
29: * In referenced list each node has content linked to it by a separate property. In addition, each node points to its
30: * successor in the sequence. The last node may point to {@literal rdf:nil} or it may just lack a successor.
31: */
32: public class ReferencedListDescriptorImpl implements ReferencedListDescriptor {
33:
34: protected final ListDescriptor descriptor;
35: private final Assertion nodeContent;
36:
37: private final boolean terminatedByNil;
38:
39: public ReferencedListDescriptorImpl(NamedResource listOwner, Assertion listProperty,
40: Assertion nextNode, Assertion nodeContent) {
41: this.descriptor = new BaseListDescriptorImpl(listOwner, listProperty, nextNode);
42: this.nodeContent = Objects.requireNonNull(nodeContent);
43: this.terminatedByNil = false;
44: }
45:
46: public ReferencedListDescriptorImpl(NamedResource listOwner, Assertion listProperty,
47: Assertion nextNode, Assertion nodeContent, boolean terminatedByNil) {
48: this.descriptor = new BaseListDescriptorImpl(listOwner, listProperty, nextNode);
49: this.nodeContent = Objects.requireNonNull(nodeContent);
50: this.terminatedByNil = terminatedByNil;
51: }
52:
53: @Override
54: public URI getContext() {
55: return descriptor.getContext();
56: }
57:
58: @Override
59: public void setContext(URI context) {
60: descriptor.setContext(context);
61: }
62:
63: @Override
64: public NamedResource getListOwner() {
65: return descriptor.getListOwner();
66: }
67:
68: @Override
69: public Assertion getListProperty() {
70: return descriptor.getListProperty();
71: }
72:
73: @Override
74: public Assertion getNextNode() {
75: return descriptor.getNextNode();
76: }
77:
78: @Override
79: public Assertion getNodeContent() {
80: return nodeContent;
81: }
82:
83: @Override
84: public boolean isTerminatedByNil() {
85: return terminatedByNil;
86: }
87:
88: @Override
89: public int hashCode() {
90: final int prime = 31;
91: int result = 1;
92: result = prime * result + descriptor.hashCode();
93: result = prime * result + nodeContent.hashCode();
94: result = prime * result + Boolean.hashCode(terminatedByNil);
95: return result;
96: }
97:
98: @Override
99: public boolean equals(Object obj) {
100:• if (this == obj) {
101: return true;
102: }
103:• if (obj == null) {
104: return false;
105: }
106:• if (getClass() != obj.getClass()) {
107: return false;
108: }
109: ReferencedListDescriptorImpl other = (ReferencedListDescriptorImpl) obj;
110:• return descriptor.equals(other.descriptor) && nodeContent.equals(other.nodeContent) && terminatedByNil == other.terminatedByNil;
111: }
112:
113: @Override
114: public String toString() {
115: return "[ReferencedList: " + descriptor + ", nodeContent = " + nodeContent + "]";
116: }
117: }