]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/src/org/simantics/databoard/type/DataTypeDefinition.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.databoard / src / org / simantics / databoard / type / DataTypeDefinition.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
15 public class DataTypeDefinition {
16
17         String name;
18         Datatype dataType;
19         
20         public DataTypeDefinition(String name, Datatype dataType)
21         {
22                 this.name = name;
23                 this.dataType = dataType;
24         }
25
26         public String getName() {
27                 return name;
28         }
29
30         public void setName(String name) {
31                 this.name = name;
32         }
33         
34         public Datatype getDataType() {
35                 return dataType;
36         }
37         
38         @Override
39         public String toString() {
40                 return name+" = "+dataType.toString();
41         }
42
43         @Override
44         public int hashCode() {
45                 return name.hashCode() + dataType.hashCode()*7;
46         }
47         
48         @Override
49         public boolean equals(Object obj) {
50                 if (obj instanceof DataTypeDefinition==false) return false;
51                 DataTypeDefinition other = (DataTypeDefinition) obj;
52                 return other.name.equals(name) && other.dataType.equals(dataType);
53         }
54         
55 }
56