當前位置: 首頁>>代碼示例>>Java>>正文


Java BinaryTimeSeries類代碼示例

本文整理匯總了Java中de.qaware.chronix.converter.BinaryTimeSeries的典型用法代碼示例。如果您正苦於以下問題:Java BinaryTimeSeries類的具體用法?Java BinaryTimeSeries怎麽用?Java BinaryTimeSeries使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BinaryTimeSeries類屬於de.qaware.chronix.converter包,在下文中一共展示了BinaryTimeSeries類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: convert

import de.qaware.chronix.converter.BinaryTimeSeries; //導入依賴的package包/類
/**
 * Converts a time series of type <T> to lucene document.
 * Handles the default java object types (e.g. double, int, array, collections, ...)
 * and wraps them into the matching lucene fields (int -> IntField).
 *
 * @param ts the time series of type <T>
 * @return a filled lucene document
 */
private static <T> Document convert(T ts, TimeSeriesConverter<T> converter) {
    BinaryTimeSeries series = converter.to(ts);
    Document document = new Document();

    series.getFields().entrySet().forEach(entry -> {

        if (entry.getValue() instanceof Number) {
            handleNumbers(document, entry.getKey(), entry.getValue());
        } else if (entry.getValue() instanceof String || entry.getValue() instanceof byte[]) {
            handleStringsAndBytes(document, entry.getKey(), entry.getValue());
        } else if (entry.getValue() instanceof Collection || entry.getValue() instanceof Object[]) {
            handleArraysAndIterable(document, entry.getKey(), entry.getValue());
        } else {
            LOGGER.debug("Field {} could not be handled. Type is not supported", entry);
        }
    });
    return document;
}
 
開發者ID:ChronixDB,項目名稱:chronix.storage,代碼行數:27,代碼來源:LuceneAddingService.java

示例2: call

import de.qaware.chronix.converter.BinaryTimeSeries; //導入依賴的package包/類
/**
 * Converts the solr document given in the constructor into a time series of type <T>
 *
 * @return a time series of type <T>
 * @throws Exception if bad things happen.
 */
@Override
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public T call() throws Exception {
    BinaryTimeSeries.Builder timeSeriesBuilder = new BinaryTimeSeries.Builder();
    document.forEach(attributeField -> timeSeriesBuilder.field(attributeField.getKey(), attributeField.getValue()));
    LOGGER.debug("Calling document converter with {}", document);
    T timeSeries = documentConverter.from(timeSeriesBuilder.build(), queryStart, queryEnd);
    LOGGER.debug("Returning time series {} to callee", timeSeries);
    return timeSeries;
}
 
開發者ID:ChronixDB,項目名稱:chronix.spark,代碼行數:17,代碼來源:TimeSeriesConverterCaller.java

示例3: convertFromTuple

import de.qaware.chronix.converter.BinaryTimeSeries; //導入依賴的package包/類
/**
 * Converts a tuple into a MetricTimeSeries
 *
 * @param tuple the tuple
 * @return a MetricTimeSeries containing the tuple data
 */
private MetricTimeSeries convertFromTuple(Tuple tuple) {
    BinaryTimeSeries.Builder timeSeriesBuilder = new BinaryTimeSeries.Builder();
    tuple.fields.forEach((k, v) ->
            timeSeriesBuilder.field(k.toString(), v));
    MetricTimeSeries timeSeries = converter.from(timeSeriesBuilder.build(), 0l, 0l); //MetricTimeSeriesConverter does not use queryStart / queryEnd
    return timeSeries;
}
 
開發者ID:ChronixDB,項目名稱:chronix.spark,代碼行數:14,代碼來源:SolrTupleStreamingService.java

示例4: call

import de.qaware.chronix.converter.BinaryTimeSeries; //導入依賴的package包/類
/**
 * Converts the solr document given in the constructor into a time series of type <T>
 *
 * @return a time series of type <T>
 * @throws Exception if bad things happen.
 */
@Override
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public T call() throws Exception {
    BinaryTimeSeries.Builder timeSeriesBuilder = new BinaryTimeSeries.Builder();

    document.forEach(attributeField -> timeSeriesBuilder.field(attributeField.getKey(), attributeField.getValue()));
    LOGGER.debug("Calling document converter with {}", document);
    T timeSeries = documentConverter.from(timeSeriesBuilder.build(), queryStart, queryEnd);
    LOGGER.debug("Returning time series {} to callee", timeSeries);
    return timeSeries;
}
 
開發者ID:ChronixDB,項目名稱:chronix.server,代碼行數:18,代碼來源:TimeSeriesConverterCaller.java

示例5: convert

import de.qaware.chronix.converter.BinaryTimeSeries; //導入依賴的package包/類
/**
 * Converts a time series of type <T> to SolInputDocument
 *
 * @param ts - the time series
 * @return a filled SolrInputDocument
 */
private static <T> SolrInputDocument convert(T ts, TimeSeriesConverter<T> converter) {
    BinaryTimeSeries series = converter.to(ts);
    SolrInputDocument solrDocument = new SolrInputDocument();
    series.getFields().entrySet().forEach(entry -> solrDocument.addField(entry.getKey(), entry.getValue()));
    return solrDocument;
}
 
開發者ID:ChronixDB,項目名稱:chronix.server,代碼行數:13,代碼來源:SolrAddingService.java

示例6: call

import de.qaware.chronix.converter.BinaryTimeSeries; //導入依賴的package包/類
/**
 * Converts the solr document given in the constructor into a time series of type <T>
 *
 * @return a time series of type <T>
 * @throws Exception if bad things happen.
 */
@Override
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public T call() throws Exception {
    BinaryTimeSeries.Builder timeSeriesBuilder = new BinaryTimeSeries.Builder();

    Map<String, List<Object>> multivalued = new HashMap<>();

    document.forEach(attributeField -> {
        String key = attributeField.name();

        if (key.contains(ChronixLuceneStorageConstants.MULTI_VALUE_FIELD_DELIMITER)) {
            key = key.substring(0, key.indexOf(ChronixLuceneStorageConstants.MULTI_VALUE_FIELD_DELIMITER));
            //Handle multivalued fields
            if (!multivalued.containsKey(key)) {
                multivalued.put(key, new ArrayList<>());
            }
            multivalued.get(key).add(convert(attributeField));

        } else {
            timeSeriesBuilder.field(key, convert(attributeField));
        }
    });
    multivalued.forEach(timeSeriesBuilder::field);

    LOGGER.debug("Calling document converter with {}", document);
    T timeSeries = documentConverter.from(timeSeriesBuilder.build(), queryStart, queryEnd);
    LOGGER.debug("Returning time series {} to callee", timeSeries);
    return timeSeries;
}
 
開發者ID:ChronixDB,項目名稱:chronix.storage,代碼行數:36,代碼來源:TimeSeriesConverterCaller.java

示例7: from

import de.qaware.chronix.converter.BinaryTimeSeries; //導入依賴的package包/類
@Override
public SimpleTimeSeries from(BinaryTimeSeries binaryTimeSeries, long queryStart, long queryEnd) {
    SimpleTimeSeries doc = new SimpleTimeSeries();
    binaryTimeSeries.getFields().forEach(doc::add);

    return doc;
}
 
開發者ID:ChronixDB,項目名稱:chronix.storage,代碼行數:8,代碼來源:SimpleTimeSeriesConverter.java

示例8: fromProtocolBuffers

import de.qaware.chronix.converter.BinaryTimeSeries; //導入依賴的package包/類
private void fromProtocolBuffers(BinaryTimeSeries binaryTimeSeries, long queryStart, long queryEnd, MetricTimeSeries.Builder builder) {
    ProtoBufMetricTimeSeriesSerializer.from(binaryTimeSeries.getPoints(), binaryTimeSeries.getStart(), binaryTimeSeries.getEnd(), queryStart, queryEnd, builder);
}
 
開發者ID:ChronixDB,項目名稱:chronix.spark,代碼行數:4,代碼來源:MetricTimeSeriesConverter.java

示例9: fromJson

import de.qaware.chronix.converter.BinaryTimeSeries; //導入依賴的package包/類
private void fromJson(BinaryTimeSeries binaryTimeSeries, long queryStart, long queryEnd, MetricTimeSeries.Builder builder) {
    throw new UnsupportedOperationException();
}
 
開發者ID:ChronixDB,項目名稱:chronix.spark,代碼行數:4,代碼來源:MetricTimeSeriesConverter.java

示例10: meanDate

import de.qaware.chronix.converter.BinaryTimeSeries; //導入依賴的package包/類
private long meanDate(BinaryTimeSeries binaryTimeSeries) {
    long start = binaryTimeSeries.getStart();
    long end = binaryTimeSeries.getEnd();

    return start + ((end - start) / 2);
}
 
開發者ID:ChronixDB,項目名稱:chronix.spark,代碼行數:7,代碼來源:MetricTimeSeriesConverter.java

示例11: to

import de.qaware.chronix.converter.BinaryTimeSeries; //導入依賴的package包/類
@Override
public BinaryTimeSeries to(MetricTimeSeries timeSeries) {
    throw new UnsupportedOperationException();
}
 
開發者ID:ChronixDB,項目名稱:chronix.spark,代碼行數:5,代碼來源:MetricTimeSeriesConverter.java

示例12: from

import de.qaware.chronix.converter.BinaryTimeSeries; //導入依賴的package包/類
@Override
public BinaryTimeSeries from(BinaryTimeSeries binaryStorageDocument, long queryStart, long queryEnd) {
    return binaryStorageDocument;
}
 
開發者ID:ChronixDB,項目名稱:chronix.spark,代碼行數:5,代碼來源:DefaultTimeSeriesConverter.java

示例13: to

import de.qaware.chronix.converter.BinaryTimeSeries; //導入依賴的package包/類
@Override
public BinaryTimeSeries to(BinaryTimeSeries timeSeries) {
    return timeSeries;
}
 
開發者ID:ChronixDB,項目名稱:chronix.spark,代碼行數:5,代碼來源:DefaultTimeSeriesConverter.java

示例14: from

import de.qaware.chronix.converter.BinaryTimeSeries; //導入依賴的package包/類
@Override
public BinaryTimeSeries from(BinaryTimeSeries binaryTimeSeries, long queryStart, long queryEnd) {
    //Just return the binary time series
    return binaryTimeSeries;
}
 
開發者ID:ChronixDB,項目名稱:chronix.server,代碼行數:6,代碼來源:DefaultTimeSeriesConverter.java

示例15: to

import de.qaware.chronix.converter.BinaryTimeSeries; //導入依賴的package包/類
@Override
public BinaryTimeSeries to(BinaryTimeSeries timeSeries) {
    //Just return the binary time series
    return timeSeries;
}
 
開發者ID:ChronixDB,項目名稱:chronix.server,代碼行數:6,代碼來源:DefaultTimeSeriesConverter.java


注:本文中的de.qaware.chronix.converter.BinaryTimeSeries類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。