org.diirt.datasource.timecache.ExpressionLanguage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of datasource-timecache Show documentation
Show all versions of datasource-timecache Show documentation
Local cache for time series gathered from multiple sources.
The newest version!
/**
* Copyright (C) 2010-14 diirt developers. See COPYRIGHT.TXT
* All rights reserved. Use is subject to license terms. See LICENSE.TXT
*/
package org.diirt.datasource.timecache;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;
import org.diirt.datasource.BasicTypeSupport;
import org.diirt.datasource.ReadFunction;
import org.diirt.datasource.expression.DesiredRateExpression;
import org.diirt.datasource.expression.DesiredRateExpressionImpl;
import org.diirt.datasource.expression.DesiredRateExpressionListImpl;
import org.diirt.datasource.timecache.query.Query;
import org.diirt.datasource.timecache.query.QueryData;
import org.diirt.datasource.timecache.query.QueryParameters;
import org.diirt.datasource.timecache.query.QueryResult;
import org.diirt.datasource.timecache.util.CacheHelper;
import org.diirt.datasource.vtype.DataTypeSupport;
import org.diirt.util.array.ArrayDouble;
import org.diirt.util.time.Timestamp;
import org.diirt.vtype.VDouble;
import org.diirt.vtype.VTable;
import org.diirt.vtype.VType;
import org.diirt.vtype.ValueFactory;
/**
* PVManager expression language support for additional operations.
*
* @author carcassi
*/
public class ExpressionLanguage {
private ExpressionLanguage() {
}
static {
// Add support for Epics types.
DataTypeSupport.install();
// Add support for Basic types
BasicTypeSupport.install();
}
/**
* A query expression that returns the result formatted as a table.
*
* @param channelName
* @param parameters
* @return a new expression
*/
public static DesiredRateExpression timeTableOf(
final String channelName, QueryParameters parameters) {
final Cache cache = CacheFactory.getCache();
final Query query = cache.createQuery(channelName, VType.class, parameters);
return new DesiredRateExpressionImpl(new DesiredRateExpressionListImpl