Skip to contentMethod: equals(Object)
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.net.URI;
18: import java.util.Random;
19:
20: class PropertyAssertion extends Assertion {
21:
22:         static final URI UNSPECIFIED_PROPERTY = URI.create("http://" + new Random().nextInt());
23:
24:         private static final long serialVersionUID = 8288252700890646040L;
25:
26:         PropertyAssertion(boolean isInferred) {
27:                 super(UNSPECIFIED_PROPERTY, isInferred);
28:         }
29:
30:         PropertyAssertion(URI identifier, boolean isInferred) {
31:                 super(identifier, isInferred);
32:         }
33:
34:         @Override
35:         public AssertionType getType() {
36:                 return AssertionType.PROPERTY;
37:         }
38:
39:         @Override
40:         public int hashCode() {
41:                 int prime = 31;
42:                 return prime * super.hashCode();
43:         }
44:
45:         @Override
46:         public boolean equals(Object obj) {
47:•                if (this == obj)
48:                         return true;
49:•                if (!super.equals(obj))
50:                         return false;
51:•                if (getClass() != obj.getClass())
52:                         return false;
53:                 return true;
54:         }
55: }