本文整理匯總了Java中de.fraunhofer.iosb.ilt.sta.model.Observation.getResult方法的典型用法代碼示例。如果您正苦於以下問題:Java Observation.getResult方法的具體用法?Java Observation.getResult怎麽用?Java Observation.getResult使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類de.fraunhofer.iosb.ilt.sta.model.Observation
的用法示例。
在下文中一共展示了Observation.getResult方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: calculateAggregateResultFromAggregates
import de.fraunhofer.iosb.ilt.sta.model.Observation; //導入方法依賴的package包/類
public BigDecimal[] calculateAggregateResultFromAggregates(List<Observation> sourceObs) {
BigDecimal[] result;
DescriptiveStatistics stats = new DescriptiveStatistics();
double min = Double.POSITIVE_INFINITY;
double max = Double.NEGATIVE_INFINITY;
int scale = 0;
for (Observation obs : sourceObs) {
Object input = obs.getResult();
if (input instanceof List) {
List list = (List) input;
Number number = handleResult(list.get(0));
scale = Math.max(getScale(number), scale);
stats.addValue(number.doubleValue());
min = Math.min(min, handleResult(list.get(1)).doubleValue());
max = Math.max(max, handleResult(list.get(2)).doubleValue());
} else {
String type = input == null ? "null" : input.getClass().getName();
LOGGER.error("Aggregate input of obs {} should be a List, not a {}", obs.getId(), type);
throw new IllegalArgumentException("Expected List, got " + type);
}
}
result = new BigDecimal[]{
new BigDecimal(stats.getMean()).setScale(scale, RoundingMode.HALF_UP),
new BigDecimal(min).setScale(scale, RoundingMode.HALF_UP),
new BigDecimal(max).setScale(scale, RoundingMode.HALF_UP),
new BigDecimal(stats.getStandardDeviation()).setScale(scale, RoundingMode.HALF_UP)
};
return result;
}