]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/examples/org/simantics/databoard/example/MyTest.java
Fixed ComponentTypeCommands.setUnit to support unit == null
[simantics/platform.git] / bundles / org.simantics.databoard / examples / org / simantics / databoard / example / MyTest.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2012 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;
13
14 import org.simantics.databoard.Bindings;
15 import org.simantics.databoard.binding.Binding;
16 import org.simantics.databoard.binding.util.DefaultValue;
17 import org.simantics.databoard.type.DoubleType;
18 import org.simantics.databoard.type.RecordType;
19 import org.simantics.databoard.util.Limit;
20 import org.simantics.databoard.util.Range;
21
22 public class MyTest {
23
24         public static void main(String[] args) {
25                 
26                 DoubleType t1 = new DoubleType();
27                 DoubleType t2 = new DoubleType();
28                 t2.setUnit("m");
29                 
30                 System.out.println( t1.hashCode() );
31                 System.out.println( t2.hashCode() );
32                 
33                 
34                 RecordType r1 = new RecordType();
35                 RecordType r2 = new RecordType();
36                 r1.addComponent("x", t1);
37                 r2.addComponent("x", t2);
38                 
39                 System.out.println( r1.hashCode() );
40                 System.out.println( r2.hashCode() );
41                 
42                 t1.setRange( new Range(Limit.nolimit(), Limit.nolimit()) );
43                 Binding b = Bindings.getBinding(t1);
44                 DefaultValue dv = new DefaultValue();
45                 System.out.println(  b.accept( dv )  );
46                 
47         }
48         
49 }