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: 27 C: 42
61%
M: 15 C: 9
38%
M: 12 C: 1
8%
M: 12 C: 11
48%
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: 22 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /**
2: * Copyright (C) 2016 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:•                        if (other.value != null)
77:                                 return false;
78:•                } else if (!value.equals(other.value))
79:                         return false;
80:                 return true;
81:         }
82:
83:         @Override
84:         public String toString() {
85:                 return "[" + subject + " " + assertion + " " + value + "]";
86:         }
87: }