1 /*******************************************************************************
\r
2 * Copyright (c) 2010 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.databoard.example.old;
14 import org.simantics.databoard.parser.repository.DataTypeRepository;
\r
15 import org.simantics.databoard.parser.repository.DataTypeSyntaxError;
\r
16 import org.simantics.databoard.type.DataTypeDefinition;
\r
17 import org.simantics.databoard.type.Datatype;
\r
19 public class ParserExample {
21 public static void main(String[] args) throws DataTypeSyntaxError {
22 DataTypeRepository repository = new DataTypeRepository();
23 repository.addDefinitions(
24 "type Vec2 = { x : Double, y : Double } " +
25 "type Matrix2 = { rowX : Vec2, rowY : Vec2 }"
27 Datatype type = repository.get("Matrix2");
28 Datatype type2 = repository.translate("{ matrix : Matrix2, vector : Vec2 }");
29 System.out.println(type);
31 System.out.println(type2);
33 DataTypeDefinition def = new DataTypeDefinition("Matrix2", repository.get("Matrix2"));
36 System.out.println(def);