Skip to content

Method: toString()

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.net.URI;
21:
22: /**
23: * Describes a simple sequence. </p>
24: * <p/>
25: * Simple lists are classic Lips-style lists (singly-linked lists), where each
26: * node is a subject for axiom referencing the next node.
27: *
28: * @author ledvima1
29: */
30: public class SimpleListDescriptorImpl implements SimpleListDescriptor {
31:
32: protected final ListDescriptor descriptor;
33:
34: public SimpleListDescriptorImpl(NamedResource listOwner, Assertion listProperty,
35: Assertion nextNodeProperty) {
36: this.descriptor = new BaseListDescriptorImpl(listOwner, listProperty, nextNodeProperty);
37: }
38:
39: @Override
40: public void setContext(URI context) {
41: descriptor.setContext(context);
42: }
43:
44: @Override
45: public URI getContext() {
46: return descriptor.getContext();
47: }
48:
49: @Override
50: public NamedResource getListOwner() {
51: return descriptor.getListOwner();
52: }
53:
54: @Override
55: public Assertion getListProperty() {
56: return descriptor.getListProperty();
57: }
58:
59: @Override
60: public Assertion getNextNode() {
61: return descriptor.getNextNode();
62: }
63:
64: @Override
65: public int hashCode() {
66: final int prime = 31;
67: int result = 1;
68: result = prime * result + descriptor.hashCode();
69: return result;
70: }
71:
72: @Override
73: public boolean equals(Object obj) {
74: if (this == obj)
75: return true;
76: if (obj == null)
77: return false;
78: if (getClass() != obj.getClass())
79: return false;
80: SimpleListDescriptorImpl other = (SimpleListDescriptorImpl) obj;
81: if (!descriptor.equals(other.descriptor))
82: return false;
83: return true;
84: }
85:
86: @Override
87: public String toString() {
88: return "[SimpleList: " + descriptor + "]";
89: }
90: }