本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例9: fromJson
import de.qaware.chronix.converter.BinaryTimeSeries; //导入依赖的package包/类
private void fromJson(BinaryTimeSeries binaryTimeSeries, long queryStart, long queryEnd, MetricTimeSeries.Builder builder) {
throw new UnsupportedOperationException();
}
示例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);
}
示例11: to
import de.qaware.chronix.converter.BinaryTimeSeries; //导入依赖的package包/类
@Override
public BinaryTimeSeries to(MetricTimeSeries timeSeries) {
throw new UnsupportedOperationException();
}
示例12: from
import de.qaware.chronix.converter.BinaryTimeSeries; //导入依赖的package包/类
@Override
public BinaryTimeSeries from(BinaryTimeSeries binaryStorageDocument, long queryStart, long queryEnd) {
return binaryStorageDocument;
}
示例13: to
import de.qaware.chronix.converter.BinaryTimeSeries; //导入依赖的package包/类
@Override
public BinaryTimeSeries to(BinaryTimeSeries timeSeries) {
return timeSeries;
}
示例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;
}
示例15: to
import de.qaware.chronix.converter.BinaryTimeSeries; //导入依赖的package包/类
@Override
public BinaryTimeSeries to(BinaryTimeSeries timeSeries) {
//Just return the binary time series
return timeSeries;
}