]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/ModelledVariablePropertyDescriptorImpl.java
Tried to improve the implementation of getPossibleDomainProperty
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / variable / ModelledVariablePropertyDescriptorImpl.java
1 package org.simantics.db.layer0.variable;
2
3 import org.simantics.db.Resource;
4
5 public class ModelledVariablePropertyDescriptorImpl implements ModelledVariablePropertyDescriptor {
6         final private Variable variable;
7         final private Resource subject;
8         final private Resource property;
9         public ModelledVariablePropertyDescriptorImpl(Variable variable, Resource subject, Resource property) {
10                 this.variable = variable;
11                 this.subject = subject;
12                 this.property = property;
13         }
14         public Variable getVariable() {
15                 return variable;
16         }
17         public Resource getSubject() {
18                 return subject;
19         }
20         public Resource getProperty() {
21                 return property;
22         }
23         @Override
24         public int hashCode() {
25                 return subject.hashCode() ^ 31*property.hashCode() ^ 41*variable.hashCode();
26         }
27         @Override
28         public boolean equals(Object obj) {
29                 if(this == obj) return true;
30                 if(!(obj instanceof ModelledVariablePropertyDescriptorImpl)) return false;
31                 ModelledVariablePropertyDescriptorImpl other = (ModelledVariablePropertyDescriptorImpl)obj;
32                 if(!subject.equals(other.subject)) return false;
33                 if(!property.equals(other.property)) return false;
34                 return variable.equals(other.variable);
35         }
36 }