]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/testcases/org/simantics/databoard/tests/TestArray.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.databoard / testcases / org / simantics / databoard / tests / TestArray.java
1 /*******************************************************************************\r
2  *  Copyright (c) 2010 Association for Decentralized Information Management in\r
3  *  Industry THTH ry.\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
8  *\r
9  *  Contributors:\r
10  *      VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.databoard.tests;
13
14 import org.simantics.databoard.Datatypes;\r
15 import org.simantics.databoard.annotations.Length;\r
16 import org.simantics.databoard.annotations.Optional;\r
17 import org.simantics.databoard.annotations.Range;\r
18 import org.simantics.databoard.annotations.Referable;\r
19 import org.simantics.databoard.annotations.Unit;\r
20 import org.simantics.databoard.type.Datatype;\r
21
22 public @Referable class TestArray {
23         
24         @Length("5") int[] a;
25         
26         float[][][] b;
27         
28         TestArray[] c;
29         
30         @Unit("m") double length;
31         
32         static class ExampleClass {
33                 
34                 @Length({"320", "240"})
35                 int[][] image;
36                 
37                 @Range("[0..100]") double alpha;
38                                 
39                 @Optional
40                 @Unit("m")
41                 double length;          
42         }
43         
44         public static void main(String[] args) throws Exception {
45                 Datatype exampleDataType = Datatypes.getDatatype(ExampleClass.class);
46                 
47                 System.out.println(exampleDataType);
48                                 
49         }
50 }