Skip to contentMethod: equals(Object)
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.jopa.oom;
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: * Pending assertion represents reference to an instance which has not been persisted, yet.
28: */
29: class PendingAssertion {
30: private final NamedResource owner;
31: private final Assertion assertion;
32: private final URI context;
33:
34:
35: PendingAssertion(NamedResource owner, Assertion assertion, URI context) {
36: this.owner = owner;
37: this.assertion = assertion;
38: this.context = context;
39: }
40:
41: public NamedResource getOwner() {
42: return owner;
43: }
44:
45: public Assertion getAssertion() {
46: return assertion;
47: }
48:
49: public URI getContext() {
50: return context;
51: }
52:
53: @Override
54: public boolean equals(Object o) {
55:• if (this == o) {
56: return true;
57: }
58:• if (o == null || getClass() != o.getClass()) {
59: return false;
60: }
61:
62: PendingAssertion that = (PendingAssertion) o;
63:
64:• return owner.equals(that.owner) && assertion.equals(that.assertion) && (Objects.equals(context, that.context));
65: }
66:
67: @Override
68: public int hashCode() {
69: int result = owner.hashCode();
70: result = 31 * result + assertion.hashCode();
71: result = 31 * result + (context != null ? context.hashCode() : 0);
72: return result;
73: }
74:
75: @Override
76: public String toString() {
77: return "PendingAssertion{" +
78: owner + " -> " + assertion +
79: ", context=" + context +
80: '}';
81: }
82: }