1 /*******************************************************************************
2 * Copyright (c) 2010 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.databoard.example.old;
14 import org.simantics.databoard.parser.repository.DataTypeRepository;
15 import org.simantics.databoard.parser.repository.DataTypeSyntaxError;
16 import org.simantics.databoard.type.DataTypeDefinition;
17 import org.simantics.databoard.type.Datatype;
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);