--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.modeling.userComponent;\r
+\r
+import gnu.trove.map.hash.THashMap;\r
+\r
+import org.simantics.databoard.Datatypes;\r
+import org.simantics.databoard.type.ArrayType;\r
+import org.simantics.databoard.type.Datatype;\r
+\r
+public class TypeConversion {\r
+\r
+ private static final THashMap<String,Datatype> CONVERSION_MAP = \r
+ new THashMap<String,Datatype>();\r
+ \r
+ private static void add(String sclType, Datatype dataType) {\r
+ CONVERSION_MAP.put(sclType, dataType);\r
+ CONVERSION_MAP.put("[" + sclType + "]", new ArrayType(dataType));\r
+ CONVERSION_MAP.put("Array " + sclType, new ArrayType(dataType));\r
+ CONVERSION_MAP.put("Vector " + sclType, new ArrayType(dataType));\r
+ }\r
+ \r
+ static {\r
+ add("Boolean", Datatypes.BOOLEAN);\r
+ add("Integer", Datatypes.INTEGER);\r
+ add("Long", Datatypes.LONG);\r
+ add("Float", Datatypes.FLOAT);\r
+ add("Double", Datatypes.DOUBLE);\r
+ add("String", Datatypes.STRING);\r
+ }\r
+ \r
+ /**\r
+ * This is a workaround solution currently for converting SCL types\r
+ * to datatypes.\r
+ */\r
+ public static Datatype convertSCLTypeToDatatype(String type) {\r
+ return CONVERSION_MAP.get(type);\r
+ }\r
+ \r
+}\r