]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/src/org/simantics/databoard/type/Component.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.databoard / src / org / simantics / databoard / type / Component.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.type;
13
14 import org.simantics.databoard.util.ObjectUtils;\r
15
16 public class Component {
17         public String name;
18     public Datatype type;    
19     
20     public Component(String name, Datatype type) {              
21                 this.name = name;
22                 this.type = type;
23         }
24
25         @Override
26     public int hashCode() {
27         return type.hashCode() + 13*ObjectUtils.hashCode(name);
28     }
29     
30     @Override
31     public boolean equals(Object obj) {
32                 if (this==obj) return true;
33                 if (obj instanceof Component == false) return false;
34                 Component other = (Component) obj;
35                 return type.equals(other.type) && ObjectUtils.objectEquals(name, other.name);
36     }
37
38     @Override
39     public String toString() {
40         return name + " = " + type;
41     }
42     
43 }
44