]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.databoard/testcases/org/simantics/databoard/tests/TestData.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.databoard / testcases / org / simantics / databoard / tests / TestData.java
diff --git a/bundles/org.simantics.databoard/testcases/org/simantics/databoard/tests/TestData.java b/bundles/org.simantics.databoard/testcases/org/simantics/databoard/tests/TestData.java
new file mode 100644 (file)
index 0000000..543cd00
--- /dev/null
@@ -0,0 +1,345 @@
+/*******************************************************************************\r
+ *  Copyright (c) 2010 Association for Decentralized Information Management in\r
+ *  Industry THTH ry.\r
+ *  All rights reserved. This program and the accompanying materials\r
+ *  are made available under the terms of the Eclipse Public License v1.0\r
+ *  which accompanies this distribution, and is available at\r
+ *  http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ *  Contributors:\r
+ *      VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.databoard.tests;
+
+import java.util.ArrayList;\r
+import java.util.HashMap;\r
+import java.util.LinkedList;\r
+import java.util.List;\r
+import java.util.TreeMap;\r
+\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.databoard.Datatypes;\r
+import org.simantics.databoard.annotations.Optional;\r
+import org.simantics.databoard.annotations.Referable;\r
+import org.simantics.databoard.annotations.Union;\r
+import org.simantics.databoard.binding.ArrayBinding;\r
+import org.simantics.databoard.binding.Binding;\r
+import org.simantics.databoard.binding.BooleanBinding;\r
+import org.simantics.databoard.binding.ByteBinding;\r
+import org.simantics.databoard.binding.DoubleBinding;\r
+import org.simantics.databoard.binding.FloatBinding;\r
+import org.simantics.databoard.binding.IntegerBinding;\r
+import org.simantics.databoard.binding.LongBinding;\r
+import org.simantics.databoard.binding.MapBinding;\r
+import org.simantics.databoard.binding.OptionalBinding;\r
+import org.simantics.databoard.binding.RecordBinding;\r
+import org.simantics.databoard.binding.StringBinding;\r
+import org.simantics.databoard.binding.UnionBinding;\r
+import org.simantics.databoard.binding.VariantBinding;\r
+import org.simantics.databoard.type.ArrayType;\r
+import org.simantics.databoard.type.Component;\r
+import org.simantics.databoard.type.Datatype;\r
+import org.simantics.databoard.type.IntegerType;\r
+import org.simantics.databoard.type.LongType;\r
+import org.simantics.databoard.type.MapType;\r
+import org.simantics.databoard.type.OptionalType;\r
+import org.simantics.databoard.type.RecordType;\r
+
+/**
+ * Bunch of types, bindings, ands instances for various use cases
+ *
+ * @author Toni Kalajainen <toni.kalajainen@vtt.fi>
+ */
+public class TestData {
+
+       public @Referable static class Foo {
+               public List<String> list;
+               public String[] array;
+               public LinkedList<String> linkedList;           
+               public HashMap<Integer, String> hashMap;
+               public TreeMap<Integer, String> treeMap;
+                       
+               public Foo() {                  
+               }
+               
+               public Foo(String[] list, int[] keys, String values[]) {
+                       this.list = new ArrayList<String>(list.length);
+                       this.linkedList = new LinkedList<String>();
+                       array = list.clone();
+                       for (int i=0; i<list.length; i++) {
+                               this.list.add( list[i] ); 
+                               this.linkedList.add( list[i] );
+                       }
+                       hashMap = new HashMap<Integer, String>();
+                       treeMap = new TreeMap<Integer, String>();
+                       for (int i=0; i<keys.length; i++) {
+                               hashMap.put( keys[i] , values[i] );
+                               treeMap.put( keys[i] , values[i] );
+                       }
+               }
+       }
+
+       public static @Union({Bar.class, Pub.class}) class Restaurant {}                
+       
+       public static class Bar extends Restaurant {
+               public @Optional String name; 
+       }
+       
+       public static class Pub extends Restaurant {
+               public @Optional Integer value; 
+       }
+       
+       public static class Tmp {
+               public Object variant;
+       }       
+
+       public static class Tmp2 {
+               public int[][] array;
+       }       
+       
+       public static String[] stringArray0 = new String[] {"xyz", "123", "abcdefghij"};  
+       public static String[] stringArray1 = new String[] {"XyZ", "123_", "ABCDefghij", "QWERTY"};
+
+       public static Boolean[] BooleanArray0 = new Boolean[] {false, false, true};
+       public static Boolean[] BooleanArray1 = new Boolean[] {false, false, true, true};
+       
+       public static Byte[] ByteArray0 = new Byte[] {0, 1, 2};
+       public static Byte[] ByteArray1 = new Byte[] {0, 1, 2, 3};
+       
+       public static int[] intArray0 = new int[] {1, 2, 3};
+       public static int[] intArray1 = new int[] {5, 6, 7, 8};
+       
+       public static Integer[] IntegerArray0 = new Integer[] {1, 2, 3};
+       public static Integer[] IntegerArray1 = new Integer[] {5, 6, 7, 8};
+       
+       public static Long[] LongArray0 = new Long[] {1L, 2L, 3L};
+       public static Long[] LongArray1 = new Long[] {5L, 6L, 7L, 8L};
+       
+       public static long[] longArray0 = new long[] {1, 2, 3};
+       public static long[] longArray1 = new long[] {5, 6, 7, 8};
+
+       public static Float[] FloatArray0 = new Float[] {1.f, 2.f, 3.f};
+       public static Float[] FloatArray1 = new Float[] {5.f, 6.f, 7.f, 8.f};
+       
+       public static float[] floatArray0 = new float[] {1, 2, 3};
+       public static float[] floatArray1 = new float[] {5, 6, 7, 8};
+       
+       public static Double[] DoubleArray0 = new Double[] {1., 2., 3.};
+       public static Double[] DoubleArray1 = new Double[] {5., 6., 7., 8.};
+       
+       public static double[] doubleArray0 = new double[] {1, 2, 3};
+       public static double[] doubleArray1 = new double[] {5, 6, 7, 8};
+       
+       public static Foo foo0 = new Foo(stringArray0, intArray0, stringArray0);
+       public static Foo foo1 = new Foo(stringArray1, intArray1, stringArray1);
+       
+       public static int[][] int2DArray0 = new int[][] { intArray0, intArray1, intArray0 };
+       public static int[][] int2DArray1 = new int[][] { intArray1, intArray1, intArray0, intArray0 };         
+
+       public static Integer[][] Integer2DArray0 = new Integer[][] { new Integer[]{0}, new Integer[]{1, 2} };
+       public static Integer[][] Integer2DArray1 = new Integer[][] { new Integer[]{4}, new Integer[]{5, 6}, new Integer[]{7, 8, 9} };          
+       
+       // Boolean
+       public static Datatype boolean_type = Datatypes.BOOLEAN;
+       public static BooleanBinding boolean_binding_ref = (BooleanBinding) Bindings.getBindingUnchecked( Boolean.class );
+       public static BooleanBinding boolean_binding_gen = (BooleanBinding) Bindings.getMutableBinding( boolean_type );
+       public static Object boolean_value_ref_0 = boolean_binding_ref.createUnchecked( false ); 
+       public static Object boolean_value_ref_1 = boolean_binding_ref.createUnchecked( true ); 
+       public static Object boolean_value_gen_0 = boolean_binding_gen.createUnchecked( false ); 
+       public static Object boolean_value_gen_1 = boolean_binding_gen.createUnchecked( true ); 
+       
+       // Byte
+       public static Datatype byte_type = Datatypes.BYTE;
+       public static ByteBinding byte_binding_ref = (ByteBinding) Bindings.getBindingUnchecked( Byte.class );
+       public static ByteBinding byte_binding_gen = (ByteBinding) Bindings.getMutableBinding( byte_type );
+       public static Object byte_value_ref_0 = byte_binding_ref.createUnchecked( 0 ); 
+       public static Object byte_value_ref_1 = byte_binding_ref.createUnchecked( 100 ); 
+       public static Object byte_value_gen_0 = byte_binding_gen.createUnchecked( 0 ); 
+       public static Object byte_value_gen_1 = byte_binding_gen.createUnchecked( 100 );
+       
+       // Integer
+       public static Datatype integer_type = Datatypes.INTEGER;
+       public static IntegerBinding integer_binding_ref = (IntegerBinding) Bindings.getBindingUnchecked( Integer.class );
+       public static IntegerBinding integer_binding_gen = (IntegerBinding) Bindings.getMutableBinding( integer_type );
+       public static Object integer_value_ref_0 = integer_binding_ref.createUnchecked( 1 ); 
+       public static Object integer_value_ref_1 = integer_binding_ref.createUnchecked( 101 ); 
+       public static Object integer_value_gen_0 = integer_binding_gen.createUnchecked( 1 ); 
+       public static Object integer_value_gen_1 = integer_binding_gen.createUnchecked( 101 );
+       
+       // Long
+       public static Datatype long_type = Datatypes.LONG;
+       public static LongBinding long_binding_ref = (LongBinding) Bindings.getBindingUnchecked( Long.class );
+       public static LongBinding long_binding_gen = (LongBinding) Bindings.getMutableBinding( long_type );
+       public static Object long_value_ref_0 = long_binding_ref.createUnchecked( 2 ); 
+       public static Object long_value_ref_1 = long_binding_ref.createUnchecked( 102 ); 
+       public static Object long_value_gen_0 = long_binding_gen.createUnchecked( 2 ); 
+       public static Object long_value_gen_1 = long_binding_gen.createUnchecked( 102 );
+       
+       // Float
+       public static Datatype float_type = Datatypes.FLOAT;
+       public static FloatBinding float_binding_ref = (FloatBinding) Bindings.getBindingUnchecked( Float.class );
+       public static FloatBinding float_binding_gen = (FloatBinding) Bindings.getMutableBinding( float_type );
+       public static Object float_value_ref_0 = float_binding_ref.createUnchecked( 3.f ); 
+       public static Object float_value_ref_1 = float_binding_ref.createUnchecked( 103.f ); 
+       public static Object float_value_gen_0 = float_binding_gen.createUnchecked( 3.f ); 
+       public static Object float_value_gen_1 = float_binding_gen.createUnchecked( 103.f );
+       
+       // Double
+       public static Datatype double_type = Datatypes.DOUBLE;
+       public static DoubleBinding double_binding_ref = (DoubleBinding) Bindings.getBindingUnchecked( Double.class );
+       public static DoubleBinding double_binding_gen = (DoubleBinding) Bindings.getMutableBinding( double_type );
+       public static Object double_value_ref_0 = double_binding_ref.createUnchecked( 4.0 ); 
+       public static Object double_value_ref_1 = double_binding_ref.createUnchecked( 104.0 ); 
+       public static Object double_value_gen_0 = double_binding_gen.createUnchecked( 4.0 ); 
+       public static Object double_value_gen_1 = double_binding_gen.createUnchecked( 104.0 );
+               
+       // String
+       public static Datatype string_type = Datatypes.STRING;
+       public static StringBinding string_binding_ref = (StringBinding) Bindings.getBindingUnchecked( String.class );
+       public static StringBinding string_binding_gen = (StringBinding) Bindings.getMutableBinding( string_type );
+       public static Object string_value_ref_0 = string_binding_ref.createUnchecked( "Hello" ); 
+       public static Object string_value_ref_1 = string_binding_ref.createUnchecked( "World" ); 
+       public static Object string_value_gen_0 = string_binding_gen.createUnchecked( "Hello" ); 
+       public static Object string_value_gen_1 = string_binding_gen.createUnchecked( "World" );
+       
+       // Array
+       public static Datatype array_type = new ArrayType( Datatypes.STRING );
+       public static ArrayBinding array_binding_ref = (ArrayBinding) Bindings.getBindingUnchecked( String[].class );
+       public static ArrayBinding array_binding_gen = (ArrayBinding) Bindings.getMutableBinding( array_type );
+       public static Object array_value_ref_0 = array_binding_ref.createUnchecked( new Object[] {"abc", "xyz" } );
+       public static Object array_value_ref_1 = array_binding_ref.createUnchecked( new Object[] {"abc", "xyz", "abcdefghij01234567890" } ); 
+       public static Object array_value_gen_0 = array_binding_gen.createUnchecked( new Object[] { string_binding_gen.createUnchecked("abc"), string_binding_gen.createUnchecked("xyz") } ); 
+       public static Object array_value_gen_1 = array_binding_gen.createUnchecked( new Object[] { string_binding_gen.createUnchecked("abc"), string_binding_gen.createUnchecked("xyz"), string_binding_gen.createUnchecked("abcdefghij01234567890") } ); 
+       
+       // BooleanArray
+       public static Datatype boolean_array_type = new ArrayType( Datatypes.BOOLEAN );
+       public static ArrayBinding boolean_array_binding_ref = (ArrayBinding) Bindings.getBindingUnchecked( boolean[].class );
+       public static ArrayBinding boolean_array_binding_gen = (ArrayBinding) Bindings.getMutableBinding( boolean_array_type );
+       public static Object boolean_array_value_ref_0 = boolean_array_binding_ref.createUnchecked( (Object[]) BooleanArray0 ); 
+       public static Object boolean_array_value_ref_1 = boolean_array_binding_ref.createUnchecked( (Object[]) BooleanArray1 ); 
+       public static Object boolean_array_value_gen_0 = boolean_array_binding_gen.createUnchecked( boolean_binding_gen.createUnchecked(BooleanArray0[0]), boolean_binding_gen.createUnchecked(BooleanArray0[1]), boolean_binding_gen.createUnchecked(BooleanArray0[2]) ); 
+       public static Object boolean_array_value_gen_1 = boolean_array_binding_gen.createUnchecked( boolean_binding_gen.createUnchecked(BooleanArray1[0]), boolean_binding_gen.createUnchecked(BooleanArray1[1]), boolean_binding_gen.createUnchecked(BooleanArray1[2]), boolean_binding_gen.createUnchecked(BooleanArray1[3]) ); 
+       
+       // ByteArray
+       public static Datatype byte_array_type = new ArrayType( Datatypes.BYTE );
+       public static ArrayBinding byte_array_binding_ref = (ArrayBinding) Bindings.getBindingUnchecked( byte[].class );
+       public static ArrayBinding byte_array_binding_gen = (ArrayBinding) Bindings.getMutableBinding( byte_array_type );
+       public static Object byte_array_value_ref_0 = byte_array_binding_ref.createUnchecked( (Object[]) ByteArray0 ); 
+       public static Object byte_array_value_ref_1 = byte_array_binding_ref.createUnchecked( (Object[]) ByteArray1 ); 
+       public static Object byte_array_value_gen_0 = byte_array_binding_gen.createUnchecked( byte_binding_gen.createUnchecked(ByteArray0[0]), byte_binding_gen.createUnchecked(ByteArray0[1]), byte_binding_gen.createUnchecked(ByteArray0[2]) ); 
+       public static Object byte_array_value_gen_1 = byte_array_binding_gen.createUnchecked( byte_binding_gen.createUnchecked(ByteArray1[0]), byte_binding_gen.createUnchecked(ByteArray1[1]), byte_binding_gen.createUnchecked(ByteArray1[2]), byte_binding_gen.createUnchecked(ByteArray1[3]) );
+       
+       // IntegerArray
+       public static Datatype int_array_type = new ArrayType( Datatypes.INTEGER );
+       public static ArrayBinding int_array_binding_ref = (ArrayBinding) Bindings.getBindingUnchecked( int[].class );
+       public static ArrayBinding int_array_binding_gen = (ArrayBinding) Bindings.getMutableBinding( int_array_type );
+       public static Object int_array_value_ref_0 = int_array_binding_ref.createUnchecked( (Object[]) IntegerArray0 ); 
+       public static Object int_array_value_ref_1 = int_array_binding_ref.createUnchecked( (Object[]) IntegerArray1 ); 
+       public static Object int_array_value_gen_0 = int_array_binding_gen.createUnchecked( integer_binding_gen.createUnchecked(IntegerArray0[0]), integer_binding_gen.createUnchecked(IntegerArray0[1]), integer_binding_gen.createUnchecked(IntegerArray0[2]) ); 
+       public static Object int_array_value_gen_1 = int_array_binding_gen.createUnchecked( integer_binding_gen.createUnchecked(IntegerArray1[0]), integer_binding_gen.createUnchecked(IntegerArray1[1]), integer_binding_gen.createUnchecked(IntegerArray1[2]), integer_binding_gen.createUnchecked(IntegerArray1[3]) );
+
+       // Integer2DArray
+       public static ArrayBinding int_array_2d_binding_ref = (ArrayBinding) Bindings.getBindingUnchecked( int[][].class );
+       public static Datatype int_array_2d_type = new ArrayType( new ArrayType( Datatypes.INTEGER ) );
+       public static ArrayBinding int_array_2d_binding_gen = (ArrayBinding) Bindings.getMutableBinding( int_array_2d_type );
+       public static Object int_array_2d_value_ref_0 = int_array_2d_binding_ref.createUnchecked( (Object[]) int2DArray0 ); 
+       public static Object int_array_2d_value_ref_1 = int_array_2d_binding_ref.createUnchecked( (Object[]) int2DArray1 ); 
+       public static Object int_array_2d_value_gen_0 = int_array_2d_binding_gen.createUnchecked( int_array_value_gen_0, int_array_value_gen_1, int_array_value_gen_0 ); 
+       public static Object int_array_2d_value_gen_1 = int_array_2d_binding_gen.createUnchecked( int_array_value_gen_1, int_array_value_gen_1, int_array_value_gen_0, int_array_value_gen_0 );
+       
+       // LongArray
+       public static Datatype long_array_type = new ArrayType( Datatypes.LONG );
+       public static ArrayBinding long_array_binding_ref = (ArrayBinding) Bindings.getBindingUnchecked( long[].class );
+       public static ArrayBinding long_array_binding_gen = (ArrayBinding) Bindings.getMutableBinding( long_array_type );
+       public static Object long_array_value_ref_0 = long_array_binding_ref.createUnchecked( (Object[]) LongArray0 ); 
+       public static Object long_array_value_ref_1 = long_array_binding_ref.createUnchecked( (Object[]) LongArray1 ); 
+       public static Object long_array_value_gen_0 = long_array_binding_gen.createUnchecked( long_binding_gen.createUnchecked(LongArray0[0]), long_binding_gen.createUnchecked(LongArray0[1]), long_binding_gen.createUnchecked(LongArray0[2]) ); 
+       public static Object long_array_value_gen_1 = long_array_binding_gen.createUnchecked( long_binding_gen.createUnchecked(LongArray1[0]), long_binding_gen.createUnchecked(LongArray1[1]), long_binding_gen.createUnchecked(LongArray1[2]), long_binding_gen.createUnchecked(LongArray1[3]) );
+       
+       // FloatArray
+       public static Datatype float_array_type = new ArrayType( Datatypes.FLOAT );
+       public static ArrayBinding float_array_binding_ref = (ArrayBinding) Bindings.getBindingUnchecked( float[].class );
+       public static ArrayBinding float_array_binding_gen = (ArrayBinding) Bindings.getMutableBinding( float_array_type );
+       public static Object float_array_value_ref_0 = float_array_binding_ref.createUnchecked( (Object[]) FloatArray0 ); 
+       public static Object float_array_value_ref_1 = float_array_binding_ref.createUnchecked( (Object[]) FloatArray1 ); 
+       public static Object float_array_value_gen_0 = float_array_binding_gen.createUnchecked( float_binding_gen.createUnchecked(FloatArray0[0]), float_binding_gen.createUnchecked(FloatArray0[1]), float_binding_gen.createUnchecked(FloatArray0[2]) ); 
+       public static Object float_array_value_gen_1 = float_array_binding_gen.createUnchecked( float_binding_gen.createUnchecked(FloatArray1[0]), float_binding_gen.createUnchecked(FloatArray1[1]), float_binding_gen.createUnchecked(FloatArray1[2]), float_binding_gen.createUnchecked(FloatArray1[3]) );
+       
+       // DoubleArray
+       public static Datatype double_array_type = new ArrayType( Datatypes.DOUBLE );
+       public static ArrayBinding double_array_binding_ref = (ArrayBinding) Bindings.getBindingUnchecked( double[].class );
+       public static ArrayBinding double_array_binding_gen = (ArrayBinding) Bindings.getMutableBinding( double_array_type );
+       public static Object double_array_value_ref_0 = double_array_binding_ref.createUnchecked( (Object[]) DoubleArray0 ); 
+       public static Object double_array_value_ref_1 = double_array_binding_ref.createUnchecked( (Object[]) DoubleArray1 ); 
+       public static Object double_array_value_gen_0 = double_array_binding_gen.createUnchecked( double_binding_gen.createUnchecked(DoubleArray0[0]), double_binding_gen.createUnchecked(DoubleArray0[1]), double_binding_gen.createUnchecked(DoubleArray0[2]) ); 
+       public static Object double_array_value_gen_1 = double_array_binding_gen.createUnchecked( double_binding_gen.createUnchecked(DoubleArray1[0]), double_binding_gen.createUnchecked(DoubleArray1[1]), double_binding_gen.createUnchecked(DoubleArray1[2]), double_binding_gen.createUnchecked(DoubleArray1[3]) );
+
+       // StringArray
+       public static Datatype string_array_type = new ArrayType( Datatypes.STRING );
+       public static ArrayBinding string_array_binding_ref = (ArrayBinding) Bindings.getBindingUnchecked( String[].class );
+       public static ArrayBinding string_array_binding_gen = (ArrayBinding) Bindings.getMutableBinding( string_array_type );
+       public static Object string_array_value_ref_0 = string_array_binding_ref.createUnchecked( (Object[]) stringArray0 );
+       public static Object string_array_value_ref_1 = string_array_binding_ref.createUnchecked( (Object[]) stringArray1 ); 
+       public static Object string_array_value_gen_0 = string_array_binding_gen.createUnchecked( string_binding_gen.createUnchecked(stringArray0[0]), string_binding_gen.createUnchecked(stringArray0[1]), string_binding_gen.createUnchecked(stringArray0[2]) ); 
+       public static Object string_array_value_gen_1 = string_array_binding_gen.createUnchecked( string_binding_gen.createUnchecked(stringArray1[0]), string_binding_gen.createUnchecked(stringArray1[1]), string_binding_gen.createUnchecked(stringArray1[2]), string_binding_gen.createUnchecked(stringArray1[3]) ); 
+       
+       // Record
+       public static Datatype record_type = Datatypes.getDatatypeUnchecked( Foo.class );
+       public static RecordBinding record_binding_ref = (RecordBinding) Bindings.getBindingUnchecked( Foo.class ); 
+       public static RecordBinding record_binding_gen = (RecordBinding) Bindings.getMutableBinding( record_type );
+       
+       // Map
+       public static Datatype map_type = new MapType( Datatypes.INTEGER, Datatypes.STRING );
+       public static MapBinding map_binding_ref = (MapBinding) record_binding_ref.getComponentBindings()[3];
+       public static MapBinding map_binding_gen = (MapBinding) Bindings.getMutableBinding( map_type );
+       public static Object map_value_ref_0 = map_binding_ref.createUnchecked( IntegerArray0, stringArray0 );
+       public static Object map_value_ref_1 = map_binding_ref.createUnchecked( IntegerArray1, stringArray1 ); 
+       public static Object map_value_gen_0 = map_binding_gen.createUnchecked( (List<Object>) int_array_value_gen_0, (List<Object>) string_array_value_gen_0 ); 
+       public static Object map_value_gen_1 = map_binding_gen.createUnchecked( (List<Object>) int_array_value_gen_1, (List<Object>) string_array_value_gen_1 ); 
+
+       // Record ... continues
+       public static Object record_value_ref_0 = record_binding_ref.createUnchecked( foo0.list, foo0.array, foo0.linkedList, foo0.hashMap, foo0.treeMap );
+       public static Object record_value_ref_1 = record_binding_ref.createUnchecked( foo1.list, foo1.array, foo1.linkedList, foo1.hashMap, foo1.treeMap );
+       public static Object record_value_gen_0 = record_binding_gen.createUnchecked( string_array_value_gen_0, string_array_value_gen_0, string_array_value_gen_0, map_value_gen_0, map_value_gen_0 );
+       public static Object record_value_gen_1 = record_binding_gen.createUnchecked( string_array_value_gen_1, string_array_value_gen_1, string_array_value_gen_1, map_value_gen_1, map_value_gen_1 );
+       
+       // Optional
+       public static Datatype optional_type = new OptionalType( Datatypes.STRING );
+       public static OptionalBinding optional_binding_ref = (OptionalBinding) ((RecordBinding) Bindings.getBindingUnchecked(Bar.class)).componentBindings[0];
+       public static OptionalBinding optional_binding_gen = (OptionalBinding) Bindings.getMutableBinding(optional_type);
+       public static Object optional_value_ref_0 = optional_binding_ref.createNoValueUnchecked(); 
+       public static Object optional_value_ref_1 = optional_binding_ref.createValueUnchecked( string_value_ref_0 ); 
+       public static Object optional_value_gen_0 = optional_binding_gen.createNoValueUnchecked(); 
+       public static Object optional_value_gen_1 = optional_binding_gen.createValueUnchecked( string_value_gen_0 ); 
+       
+       // Union
+       public static Datatype union_type = Datatypes.getDatatypeUnchecked( Restaurant.class );
+       public static UnionBinding union_binding_ref = (UnionBinding) Bindings.getBindingUnchecked( Restaurant.class );
+       public static UnionBinding union_binding_gen = (UnionBinding) Bindings.getMutableBinding( union_type );
+       public static RecordBinding bar_binding_gen = (RecordBinding) union_binding_gen.getComponentBindings()[0];
+       public static RecordBinding pub_binding_gen = (RecordBinding) union_binding_gen.getComponentBindings()[1];
+       public static Object union_value_ref_0 = union_binding_ref.createUnchecked(0, new Bar());
+       public static Object union_value_ref_1 = union_binding_ref.createUnchecked(1, new Pub());
+       public static Object union_value_gen_0 = union_binding_gen.createUnchecked(0, bar_binding_gen.createUnchecked( optional_binding_gen.createNoValueUnchecked() ));
+       public static Object union_value_gen_1 = union_binding_gen.createUnchecked(1, pub_binding_gen.createUnchecked( optional_binding_gen.createNoValueUnchecked() ));
+       
+       // Variant
+       public static Datatype variant_type = Datatypes.VARIANT;
+       public static VariantBinding variant_binding_ref = (VariantBinding) Bindings.getBindingUnchecked( Object.class );
+       public static VariantBinding variant_binding_gen = (VariantBinding) Bindings.getMutableBinding( variant_type );
+       public static Object variant_value_ref_0 = variant_binding_ref.createUnchecked(string_binding_ref, string_value_ref_0);
+       public static Object variant_value_ref_1 = variant_binding_ref.createUnchecked(integer_binding_ref, integer_value_ref_0);
+       public static Object variant_value_gen_0 = variant_binding_gen.createUnchecked(string_binding_gen, string_value_gen_0);
+       public static Object variant_value_gen_1 = variant_binding_gen.createUnchecked(integer_binding_gen, integer_value_gen_0);
+       
+       // Variant
+       public static Datatype datatype_value_0 = new OptionalType( new ArrayType( new RecordType(false, new Component("field", new LongType())) ) );
+       public static Datatype datatype_value_1 = new IntegerType("m", "[100..200]" );
+       public static Datatype datatype_type = Datatypes.getDatatypeUnchecked( Datatype.class );
+       public static Binding datatype_binding_ref = Bindings.getBindingUnchecked( Datatype.class );
+       public static Binding datatype_binding_gen = Bindings.getMutableBinding( datatype_type );
+       public static Object datatype_value_ref_0 = datatype_value_0;
+       public static Object datatype_value_ref_1 = datatype_value_1;   
+       
+}
+