]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/src/org/simantics/databoard/adapter/AdapterRequest.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.databoard / src / org / simantics / databoard / adapter / AdapterRequest.java
1 /*******************************************************************************\r
2  *  Copyright (c) 2010 Association for Decentralized Information Management in\r
3  *  Industry THTH ry.\r
4  *  All rights reserved. This program and the accompanying materials\r
5  *  are made available under the terms of the Eclipse Public License v1.0\r
6  *  which accompanies this distribution, and is available at\r
7  *  http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  *  Contributors:\r
10  *      VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.databoard.adapter;
13
14 import org.simantics.databoard.binding.Binding;\r
15
16 public class AdapterRequest {
17
18         Binding domain;
19         Binding range;
20         boolean mustClone;\r
21         
22         public AdapterRequest(Binding domain, Binding range)
23         {
24                 if (domain==null||range==null) throw new IllegalArgumentException("null arg");
25                 this.domain = domain;
26                 this.range = range;
27         }
28 \r
29         public AdapterRequest(Binding domain, Binding range, boolean mustClone)\r
30         {\r
31                 if (domain==null||range==null) throw new IllegalArgumentException("null arg");\r
32                 this.domain = domain;\r
33                 this.range = range;\r
34                 this.mustClone = mustClone;\r
35         }\r
36         
37         public Binding getDomain() {
38                 return domain;
39         }
40         
41         public Binding getRange() {
42                 return range;
43         }
44
45         @Override
46         public int hashCode() {
47         return domain.hashCode() + 31*range.hashCode() + (mustClone ? 1 : 0);\r
48         }
49 \r
50         @Override\r
51         public boolean equals(Object obj) {\r
52         if (obj == null) return false;\r
53         if (obj instanceof AdapterRequest == false) return false;\r
54         AdapterRequest other = (AdapterRequest) obj;\r
55         return other.domain.equals(domain) && other.range.equals(range) && mustClone==other.mustClone;\r
56         }\r
57         \r
58 }
59