Skip to contentMethod: setOntology(OWLOntology)
1: /**
2: * Copyright (C) 2020 Czech Technical University in Prague
3: * <p>
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: * <p>
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.owlapi.util;
16:
17: import org.semanticweb.owlapi.model.OWLAxiom;
18: import org.semanticweb.owlapi.model.OWLOntology;
19: import org.semanticweb.owlapi.model.RemoveAxiom;
20:
21: import javax.annotation.Nonnull;
22: import java.util.Objects;
23:
24: /**
25: * Remove axiom wrapper which allows us to set ontology to which it is applied.
26: */
27: public class MutableRemoveAxiom extends RemoveAxiom implements MutableAxiomChange {
28:
29: private OWLOntology ontology;
30:
31: /**
32: * @param ont the ontology to which the change is to be applied
33: * @param axiom Axiom to remove
34: */
35: public MutableRemoveAxiom(OWLOntology ont, OWLAxiom axiom) {
36: super(ont, axiom);
37: this.ontology = ont;
38: }
39:
40: @Override
41: public void setOntology(OWLOntology ontology) {
42: this.ontology = ontology;
43: }
44:
45: @Nonnull
46: @Override
47: public OWLOntology getOntology() {
48: return ontology;
49: }
50:
51: @Override
52: public boolean equals(Object o) {
53: if (this == o) {
54: return true;
55: }
56: if (!(o instanceof MutableRemoveAxiom)) {
57: return false;
58: }
59: if (!super.equals(o)) {
60: return false;
61: }
62: MutableRemoveAxiom that = (MutableRemoveAxiom) o;
63: return Objects.equals(ontology, that.ontology) && Objects.equals(getAxiom(), that.getAxiom());
64: }
65:
66: @Override
67: public int hashCode() {
68: return Objects.hash(super.hashCode(), ontology);
69: }
70: }