Skip to content

Package: AxiomImpl

AxiomImpl

nameinstructionbranchcomplexitylinemethod
AxiomImpl(NamedResource, Assertion, Value)
M: 0 C: 18
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
equals(Object)
M: 23 C: 44
66%
M: 12 C: 10
45%
M: 9 C: 3
25%
M: 8 C: 12
60%
M: 0 C: 1
100%
getAssertion()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getSubject()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getValue()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
hashCode()
M: 6 C: 39
87%
M: 3 C: 3
50%
M: 3 C: 1
25%
M: 0 C: 6
100%
M: 0 C: 1
100%
toString()
M: 0 C: 22
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (C) 2020 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.model;
16:
17: import java.util.Objects;
18:
19: public final class AxiomImpl<T> implements Axiom<T> {
20:
21: private final NamedResource subject;
22: private final Assertion assertion;
23: private final Value<T> value;
24:
25: public AxiomImpl(NamedResource subject, Assertion assertion, Value<T> value) {
26: this.subject = Objects.requireNonNull(subject);
27: this.assertion = Objects.requireNonNull(assertion);
28: this.value = Objects.requireNonNull(value);
29: }
30:
31: @Override
32: public NamedResource getSubject() {
33: return subject;
34: }
35:
36: @Override
37: public Assertion getAssertion() {
38: return assertion;
39: }
40:
41: @Override
42: public Value<T> getValue() {
43: return value;
44: }
45:
46: @Override
47: public int hashCode() {
48: final int prime = 31;
49: int result = 1;
50:• result = prime * result + ((assertion == null) ? 0 : assertion.hashCode());
51:• result = prime * result + ((subject == null) ? 0 : subject.hashCode());
52:• result = prime * result + ((value == null) ? 0 : value.hashCode());
53: return result;
54: }
55:
56: @Override
57: public boolean equals(Object obj) {
58:• if (this == obj)
59: return true;
60:• if (obj == null)
61: return false;
62:• if (getClass() != obj.getClass())
63: return false;
64: AxiomImpl<?> other = (AxiomImpl<?>) obj;
65:• if (assertion == null) {
66:• if (other.assertion != null)
67: return false;
68:• } else if (!assertion.equals(other.assertion))
69: return false;
70:• if (subject == null) {
71:• if (other.subject != null)
72: return false;
73:• } else if (!subject.equals(other.subject))
74: return false;
75:• if (value == null) {
76:• return other.value == null;
77: } else return value.equals(other.value);
78: }
79:
80: @Override
81: public String toString() {
82: return "[" + subject + " " + assertion + " " + value + "]";
83: }
84: }