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