1 package org.simantics.sysdyn.adapter;
\r
3 import java.util.ArrayList;
\r
4 import java.util.Collection;
\r
6 import org.simantics.db.ReadGraph;
\r
7 import org.simantics.db.WriteGraph;
\r
8 import org.simantics.db.exception.DatabaseException;
\r
9 import org.simantics.db.layer0.variable.Variable;
\r
10 import org.simantics.modelica.data.DataSet;
\r
11 import org.simantics.sysdyn.manager.SysdynDataSet;
\r
12 import org.simantics.sysdyn.manager.SysdynResult;
\r
14 public class ActiveDatasetsIndexVariable extends IndexVariable< ArrayList<DataSet>> {
\r
16 public ActiveDatasetsIndexVariable(ReadGraph graph, Variable parent, String indexes)
\r
17 throws DatabaseException {
\r
18 super(graph, parent, indexes);
\r
22 public ArrayList<DataSet> getValue() {
\r
23 ArrayList<DataSet> datasets = new ArrayList<DataSet>();
\r
25 if(experiment == null)
\r
28 Collection<SysdynResult> results = experiment.getActiveResults();
\r
29 ArrayList<String> variableNamesWithIndexes = getVariableNamesWithIndexNumbers();
\r
30 ArrayList<String> variableNames = getVariableNames();
\r
32 for(int i = 0; i < variableNamesWithIndexes.size(); i++) {
\r
33 for(SysdynResult result : results) {
\r
34 SysdynDataSet ds = result.getDataSet(variableNamesWithIndexes.get(i));
\r
36 ds.name = variableNames.get(i);
\r
45 public void setIndexedValue(WriteGraph graph, Object value)
\r
46 throws DatabaseException {
\r