import org.simantics.databoard.accessor.error.AccessorConstructionException;\r
import org.simantics.databoard.accessor.error.AccessorException;\r
import org.simantics.databoard.accessor.java.JavaRecord;\r
-import org.simantics.databoard.accessor.reference.AccessorReference;\r
-import org.simantics.databoard.accessor.reference.ArrayIndexReference;\r
-import org.simantics.databoard.accessor.reference.FieldNameReference;\r
+import org.simantics.databoard.accessor.reference.ChildReference;\r
+import org.simantics.databoard.accessor.reference.ComponentReference;\r
+import org.simantics.databoard.accessor.reference.IndexReference;\r
import org.simantics.databoard.accessor.reference.KeyReference;\r
-import org.simantics.databoard.accessor.reference.VariantValueReference;\r
-import org.simantics.databoard.annotations.KeyType;\r
-import org.simantics.databoard.annotations.ValueType;\r
+import org.simantics.databoard.accessor.reference.NameReference;\r
+import org.simantics.databoard.annotations.Arguments;\r
import org.simantics.databoard.binding.Binding;\r
import org.simantics.databoard.binding.RecordBinding;\r
import org.simantics.databoard.binding.error.BindingException;\r
-import org.simantics.databoard.binding.java.DoubleBindingDefault;\r
-import org.simantics.databoard.binding.mutable.ImmutableVariantBinding;\r
import org.simantics.databoard.binding.mutable.Variant;\r
-import org.simantics.databoard.serialization.SerializationException;\r
-import org.simantics.databoard.type.DataType;\r
+import org.simantics.databoard.type.Datatype;\r
import org.simantics.modelica.data.DataSet;\r
import org.simantics.modelica.data.SimulationResult;\r
\r
public void setResult(SimulationResult result) {\r
try {\r
// Create Memory Historian\r
- DataType recordingSessionType = Historian.getRecordingSessionType();\r
+ Datatype recordingSessionType = Historian.getRecordingSessionType();\r
RecordBinding sessionBinding = (RecordBinding) Bindings.getBinding( recordingSessionType );\r
RecordBinding recordingBinding = (RecordBinding) Bindings.getBinding( Recording.class );\r
Object session = sessionBinding.createDefault(); \r
for(DataSet ds : datasets){\r
// Add recording to session\r
Recording recording = createRecording(ds);\r
- recordings.put(ImmutableVariantBinding.INSTANCE, recording.nodeId, ImmutableVariantBinding.INSTANCE, new Variant(recordingBinding, recording));\r
+ recordings.put(Bindings.VARIANT, recording.nodeId, Bindings.VARIANT, new Variant(recordingBinding, recording));\r
}\r
\r
// Add initial values\r
for(DataSet ds : result.getInitialValueDataSets()){\r
Variant nodeId = Variant.ofInstance( ds.name );\r
- if (recordings.containsKey(ImmutableVariantBinding.INSTANCE, nodeId)) continue;\r
+ if (recordings.containsKey(Bindings.VARIANT, nodeId)) continue;\r
// Add recording to session\r
Recording recording = createRecording(ds);\r
- recordings.put(ImmutableVariantBinding.INSTANCE, recording.nodeId, ImmutableVariantBinding.INSTANCE, new Variant(recordingBinding, recording));\r
+ recordings.put(Bindings.VARIANT, recording.nodeId, Bindings.VARIANT, new Variant(recordingBinding, recording));\r
}\r
\r
} catch (Exception e) {\r
Files.createFile(file, binding, value);\r
} catch (IOException e) {\r
e.printStackTrace();\r
- } catch (SerializationException e) {\r
- e.printStackTrace();\r
- } catch (BindingException e) {\r
- e.printStackTrace();\r
} catch (AccessorException e) {\r
e.printStackTrace();\r
}\r
\r
public static class Recording {\r
public Variant nodeId;\r
- public @KeyType(String.class) @ValueType(String.class) TreeMap<String, String> labels;\r
- public @KeyType(Double.class) @ValueType(Double.class) TreeMap<Double, Double>[] segments;\r
+ public @Arguments({String.class, String.class}) TreeMap<String, String> labels;\r
+ public @Arguments({Double.class, Double.class}) TreeMap<Double, Double>[] segments;\r
}\r
\r
public SysdynDataSet getDataSet(String variable) {\r
if(accessor != null) {\r
try {\r
- AccessorReference ref = AccessorReference.compile(\r
- new FieldNameReference("recordings"),\r
- new KeyReference( ImmutableVariantBinding.INSTANCE, Variant.ofInstance(variable) ),\r
- new VariantValueReference(),\r
- new FieldNameReference("segments"),\r
- new ArrayIndexReference(0)\r
+ ChildReference ref = ChildReference.compile(\r
+ new NameReference("recordings"),\r
+ new KeyReference( Bindings.VARIANT, Variant.ofInstance(variable) ),\r
+ new ComponentReference(),\r
+ new NameReference("segments"),\r
+ new IndexReference(0)\r
);\r
\r
- MapAccessor ma = accessor.getAccessor( ref );\r
+ MapAccessor ma = accessor.getComponent( ref );\r
int size = ma.size();\r
Double[] times = new Double[size];\r
Double[] values = new Double[size];\r
\r
- ma.getAll(DoubleBindingDefault.INSTANCE, DoubleBindingDefault.INSTANCE, times, values);\r
+ ma.getAll(Bindings.DOUBLE, Bindings.DOUBLE, times, values);\r
\r
List<Double> times_ = new ArrayList<Double>(size);\r
List<Double> values_ = new ArrayList<Double>(size);\r