]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/src/org/simantics/databoard/type/Component.java
Added addFirst/After/Before + remove SCL functions for Ordered Sets
[simantics/platform.git] / bundles / org.simantics.databoard / src / org / simantics / databoard / type / Component.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.type;
13
14 import org.simantics.databoard.util.ObjectUtils;
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