-/*******************************************************************************\r
- * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\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.simulation.data;\r
-\r
-import java.util.Collection;\r
-import java.util.concurrent.Executor;\r
-import java.util.concurrent.locks.Lock;\r
-\r
-import org.simantics.databoard.binding.Binding;\r
-import org.simantics.databoard.binding.NumberBinding;\r
-import org.simantics.databoard.type.Datatype;\r
-import org.simantics.databoard.util.Bean;\r
-\r
-/**\r
- * Interface for adapting data provider to HistoryCollector.\r
- * \r
- * @author Toni Kalajainen\r
- */\r
-public interface Datasource {\r
- \r
- Collection<String> getVariables();\r
- Datatype getType(String key);\r
- Lock readLock();\r
- void addListener(DatasourceListener listener);\r
- void removeListener(DatasourceListener listener);\r
-\r
- /**\r
- * Try to open a handle to a variable\r
- * \r
- * @param item\r
- * the subscription item to open a handle for\r
- * @param key\r
- * requested handle address, should equal\r
- * SubscriptionItem#variableId\r
- * @param valueBinding\r
- * binding for handling the requested value\r
- * @return Variable Handle or <code>null</code> if handle cannot be resolved\r
- * for any reason\r
- */\r
- VariableHandle openHandle(Bean item, String key, Binding valueBinding);\r
- \r
- public interface DatasourceListener {\r
- \r
- /**\r
- * When listeners are processed, the data source does not proceed.\r
- * It is locked, but this is valid only for listeners with executor\r
- * as null. Values are typically read within a listener.\r
- * \r
- * @param source\r
- */\r
- void onStep(Datasource source);\r
- \r
- /**\r
- * Get executor where listener is handled.\r
- * If returned value is null, listener is handled synchronously in \r
- * current thread.\r
- * \r
- * @return\r
- */\r
- Executor getExecutor();\r
- }\r
-\r
- //\r
- // The following methods produce sensible values only when the source\r
- // is locked or within listener (when it is locked).\r
- // \r
- \r
- Object getTime(NumberBinding binding);\r
-\r
-}\r
-\r
+/*******************************************************************************
+ * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.simulation.data;
+
+import java.util.Collection;
+import java.util.concurrent.Executor;
+import java.util.concurrent.locks.Lock;
+
+import org.simantics.databoard.binding.Binding;
+import org.simantics.databoard.binding.NumberBinding;
+import org.simantics.databoard.type.Datatype;
+import org.simantics.databoard.util.Bean;
+
+/**
+ * Interface for adapting data provider to HistoryCollector.
+ *
+ * @author Toni Kalajainen
+ */
+public interface Datasource {
+
+ Collection<String> getVariables();
+ Datatype getType(String key);
+ Lock readLock();
+ void addListener(DatasourceListener listener);
+ void removeListener(DatasourceListener listener);
+
+ /**
+ * Try to open a handle to a variable
+ *
+ * @param item
+ * the subscription item to open a handle for
+ * @param key
+ * requested handle address, should equal
+ * SubscriptionItem#variableId
+ * @param valueBinding
+ * binding for handling the requested value
+ * @return Variable Handle or <code>null</code> if handle cannot be resolved
+ * for any reason
+ */
+ VariableHandle openHandle(Bean item, String key, Binding valueBinding);
+
+ public interface DatasourceListener {
+
+ /**
+ * When listeners are processed, the data source does not proceed.
+ * It is locked, but this is valid only for listeners with executor
+ * as null. Values are typically read within a listener.
+ *
+ * @param source
+ */
+ void onStep(Datasource source);
+
+ /**
+ * Get executor where listener is handled.
+ * If returned value is null, listener is handled synchronously in
+ * current thread.
+ *
+ * @return
+ */
+ Executor getExecutor();
+ }
+
+ //
+ // The following methods produce sensible values only when the source
+ // is locked or within listener (when it is locked).
+ //
+
+ Object getTime(NumberBinding binding);
+
+}
+