Skip to contentMethod: getSubject()
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.model;
19:
20: import java.util.Objects;
21:
22: public final class AxiomImpl<T> implements Axiom<T> {
23:
24: private final NamedResource subject;
25: private final Assertion assertion;
26: private final Value<T> value;
27:
28: public AxiomImpl(NamedResource subject, Assertion assertion, Value<T> value) {
29: this.subject = Objects.requireNonNull(subject);
30: this.assertion = Objects.requireNonNull(assertion);
31: this.value = Objects.requireNonNull(value);
32: }
33:
34: @Override
35: public NamedResource getSubject() {
36: return subject;
37: }
38:
39: @Override
40: public Assertion getAssertion() {
41: return assertion;
42: }
43:
44: @Override
45: public Value<T> getValue() {
46: return value;
47: }
48:
49: @Override
50: public boolean equals(Object o) {
51: if (this == o) {
52: return true;
53: }
54: if (o == null || getClass() != o.getClass()) {
55: return false;
56: }
57: AxiomImpl<?> axiom = (AxiomImpl<?>) o;
58: return subject.equals(axiom.subject) && assertion.equals(axiom.assertion) && value.equals(axiom.value);
59: }
60:
61: @Override
62: public int hashCode() {
63: return Objects.hash(subject, assertion, value);
64: }
65:
66: @Override
67: public String toString() {
68: return "[" + subject + " " + assertion + " " + value + "]";
69: }
70: }