X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.simulation%2Fsrc%2Forg%2Fsimantics%2Fsimulation%2Fdata%2FDatasource.java;fp=bundles%2Forg.simantics.simulation%2Fsrc%2Forg%2Fsimantics%2Fsimulation%2Fdata%2FDatasource.java;h=32c7d483ab7348902851188c7f6981e1ea56e5f3;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=9d58d3064c428d176e0a9baadee9f17e4ee6656d;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.simulation/src/org/simantics/simulation/data/Datasource.java b/bundles/org.simantics.simulation/src/org/simantics/simulation/data/Datasource.java index 9d58d3064..32c7d483a 100644 --- a/bundles/org.simantics.simulation/src/org/simantics/simulation/data/Datasource.java +++ b/bundles/org.simantics.simulation/src/org/simantics/simulation/data/Datasource.java @@ -1,79 +1,79 @@ -/******************************************************************************* - * 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 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 null 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); - -} - +/******************************************************************************* + * 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 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 null 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); + +} +