1 /*******************************************************************************
\r
2 * Copyright (c) 2012 Association for Decentralized Information Management in
\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
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.modeling.userComponent;
\r
14 import gnu.trove.map.hash.THashMap;
\r
16 import org.simantics.databoard.Datatypes;
\r
17 import org.simantics.databoard.type.ArrayType;
\r
18 import org.simantics.databoard.type.Datatype;
\r
20 public class TypeConversion {
\r
22 private static final THashMap<String,Datatype> CONVERSION_MAP =
\r
23 new THashMap<String,Datatype>();
\r
25 private static void add(String sclType, Datatype dataType) {
\r
26 CONVERSION_MAP.put(sclType, dataType);
\r
27 CONVERSION_MAP.put("[" + sclType + "]", new ArrayType(dataType));
\r
28 CONVERSION_MAP.put("Array " + sclType, new ArrayType(dataType));
\r
29 CONVERSION_MAP.put("Vector " + sclType, new ArrayType(dataType));
\r
33 add("Boolean", Datatypes.BOOLEAN);
\r
34 add("Integer", Datatypes.INTEGER);
\r
35 add("Long", Datatypes.LONG);
\r
36 add("Float", Datatypes.FLOAT);
\r
37 add("Double", Datatypes.DOUBLE);
\r
38 add("String", Datatypes.STRING);
\r
42 * This is a workaround solution currently for converting SCL types
\r
45 public static Datatype convertSCLTypeToDatatype(String type) {
\r
46 return CONVERSION_MAP.get(type);
\r