]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.simulation/src/org/simantics/simulation/experiment/IExperiment.java
Added Set End Time command and handler as an alternate stepping mode
[simantics/platform.git] / bundles / org.simantics.simulation / src / org / simantics / simulation / experiment / IExperiment.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in 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.simulation.experiment;
13
14 import java.util.concurrent.locks.Lock;
15
16 import org.eclipse.core.runtime.IProgressMonitor;
17 import org.simantics.databoard.accessor.Accessor;
18 import org.simantics.db.ReadGraph;
19 import org.simantics.db.RequestProcessor;
20 import org.simantics.db.Resource;
21 import org.simantics.db.Session;
22 import org.simantics.db.exception.DatabaseException;
23
24 public interface IExperiment {
25
26         <T> T getService(Class<T> clazz);
27         
28     String getIdentifier();
29
30     ExperimentState getState();
31     ExperimentState getState(ReadGraph graph) throws DatabaseException;
32     void changeState(ExperimentState state);
33
34     Resource getResource();
35     Resource getModel();
36
37     /**
38      * @param monitor
39      *            the progress monitor to use for reporting progress to the user
40      *            during the operation. It is the caller's responsibility to
41      *            call done() on the given monitor. Accepts null, indicating
42      *            that no progress should be reported and that the operation
43      *            cannot be cancelled.
44      */
45     void shutdown(IProgressMonitor monitor);
46
47     void addListener(IExperimentListener listener);
48     void removeListener(IExperimentListener listener);
49
50     void addStatusListener(IExperimentStatusListener listener);
51     void removeStatusListener(IExperimentStatusListener listener);
52
53     //Historian getDataSession();
54     
55     /**
56      * Get the lock object to the datasource. Lock must be acquired
57      * for write operations.  
58      */
59     Lock getDatasourceLock();
60     
61     /**
62      * Get an accessor to the experiment.
63      * The returned accessor follows Datasource Contract.
64      * https://www.simantics.org/wiki/index.php/Databoard_Specification#Datasource_Contract
65      * 
66      * @return valuation accessor
67      */
68     Accessor getAccessor();
69
70     /**
71      * Synchronizes the running experiment with configuration.
72      */
73     public void refresh(Session session);
74     public void refresh(RequestProcessor session);
75     
76 }