]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/examples/org/simantics/databoard/example/old/ParserExample.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / examples / org / simantics / databoard / example / old / ParserExample.java
1 /*******************************************************************************
2  *  Copyright (c) 2010 Association for Decentralized Information Management in
3  *  Industry THTH ry.
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
8  *
9  *  Contributors:
10  *      VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.databoard.example.old;
13
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;
18
19 public class ParserExample {
20
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 }"
26                 );
27             Datatype type = repository.get("Matrix2");
28             Datatype type2 = repository.translate("{ matrix : Matrix2, vector : Vec2 }");
29             System.out.println(type);
30             System.out.println();
31             System.out.println(type2);
32             
33             DataTypeDefinition def = new DataTypeDefinition("Matrix2", repository.get("Matrix2"));
34             System.out.println();
35             System.out.println();
36             System.out.println(def);
37         }
38         
39 }
40