Package: MutableRemoveAxiom
MutableRemoveAxiom
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
MutableRemoveAxiom(OWLOntology, OWLAxiom) |
|
|
|
|
|
||||||||||||||||||||
equals(Object) |
|
|
|
|
|
||||||||||||||||||||
getOntology() |
|
|
|
|
|
||||||||||||||||||||
hashCode() |
|
|
|
|
|
||||||||||||||||||||
setOntology(OWLOntology) |
|
|
|
|
|
||||||||||||||||||||
toOwlChanges(OWLOntology) |
|
|
|
|
|
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.owlapi.change;
19:
20: import org.semanticweb.owlapi.model.OWLAxiom;
21: import org.semanticweb.owlapi.model.OWLOntology;
22: import org.semanticweb.owlapi.model.OWLOntologyChange;
23: import org.semanticweb.owlapi.model.RemoveAxiom;
24:
25: import javax.annotation.Nonnull;
26: import java.util.List;
27: import java.util.Objects;
28:
29: /**
30: * Remove axiom wrapper which allows us to set ontology to which it is applied.
31: */
32: public class MutableRemoveAxiom extends RemoveAxiom implements MutableAxiomChange {
33:
34: private OWLOntology ontology;
35:
36: /**
37: * @param ont the ontology to which the change is to be applied
38: * @param axiom Axiom to remove
39: */
40: public MutableRemoveAxiom(OWLOntology ont, OWLAxiom axiom) {
41: super(ont, axiom);
42: this.ontology = ont;
43: }
44:
45: @Override
46: public void setOntology(OWLOntology ontology) {
47: this.ontology = ontology;
48: }
49:
50: @Override
51: public List<OWLOntologyChange> toOwlChanges(OWLOntology targetOntology) {
52: this.ontology = targetOntology;
53: return List.of(this);
54: }
55:
56: @Nonnull
57: @Override
58: public OWLOntology getOntology() {
59: return ontology;
60: }
61:
62: @Override
63: public boolean equals(Object o) {
64:• if (this == o) {
65: return true;
66: }
67:• if (!(o instanceof MutableRemoveAxiom)) {
68: return false;
69: }
70:• if (!super.equals(o)) {
71: return false;
72: }
73: MutableRemoveAxiom that = (MutableRemoveAxiom) o;
74:• return Objects.equals(ontology, that.ontology) && Objects.equals(getAxiom(), that.getAxiom());
75: }
76:
77: @Override
78: public int hashCode() {
79: return Objects.hash(super.hashCode(), ontology);
80: }
81: }