]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/src/org/simantics/databoard/method/InterfaceDefinition.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / src / org / simantics / databoard / method / InterfaceDefinition.java
1 /*******************************************************************************
2  *  Copyright (c) 2010 Association for Decentralized Information Management in
3  *  Industry THTH ry.
4  *  All rights reserved. This program and the accompanying materials
5  *  are made available under the terms of the Eclipse Public License v1.0
6  *  which accompanies this distribution, and is available at
7  *  http://www.eclipse.org/legal/epl-v10.html
8  *
9  *  Contributors:
10  *      VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.databoard.method;
13
14 public class InterfaceDefinition {
15
16         String name;
17         Interface type;
18         
19         private transient int hash;     
20         
21         public InterfaceDefinition(String name, Interface type)
22         {
23                 this.name = name;
24                 this.type = type;
25                 hash = name.hashCode() + type.hashCode()*7;
26         }
27
28         public String getName() {
29                 return name;
30         }
31
32         public void setName(String name) {
33                 this.name = name;
34                 hash = name.hashCode() + type.hashCode()*7;
35         }
36         
37         public Interface getType() {
38                 return type;
39         }
40         
41         @Override
42         public String toString() {
43                 return name+" = "+type;
44         }
45
46         @Override
47         public int hashCode() {
48                 return hash;
49         }
50         
51         @Override
52         public boolean equals(Object obj) {
53                 if (obj instanceof InterfaceDefinition==false) return false;
54                 InterfaceDefinition other = (InterfaceDefinition) obj;
55                 return other.name.equals(name) && other.type.equals(type);
56         }
57         
58 }
59