当前位置: 首页>>代码示例>>Java>>正文


Java IntSummaryStatistics.getCount方法代码示例

本文整理汇总了Java中java.util.IntSummaryStatistics.getCount方法的典型用法代码示例。如果您正苦于以下问题:Java IntSummaryStatistics.getCount方法的具体用法?Java IntSummaryStatistics.getCount怎么用?Java IntSummaryStatistics.getCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.IntSummaryStatistics的用法示例。


在下文中一共展示了IntSummaryStatistics.getCount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getGeneratedInputCountFromOutputLines

import java.util.IntSummaryStatistics; //导入方法依赖的package包/类
/**
 * @return a number >= 0 if it is present in the output file, otherwise -1
 */
private static int getGeneratedInputCountFromOutputLines(List<String> outputLines) {
    IntSummaryStatistics ints = outputLines.stream()
            .map(line -> TEST_COUNT_LINE_PATTERN.matcher(line.trim()))
            .filter(m -> m.matches())
            .mapToInt(m -> Integer.parseInt(m.group(1)))
            .summaryStatistics();

    if (ints.getMin() < 0) {
        throw new RuntimeException("RANDOOP: Number of tests is negative:" + outputLines);
    } else if (ints.getCount() > 0) {
        return (int) ints.getSum();
    } else {
        return -1;
    }
}
 
开发者ID:SETTE-Testing,项目名称:sette-tool,代码行数:19,代码来源:RandoopParser.java

示例2: aggregate

import java.util.IntSummaryStatistics; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public RequestAggregationValues aggregate(RequestCollector requests) {

  IntSummaryStatistics stats = requests.getReqTimestamps().stream().collect(Collectors.groupingBy(timestamp -> DateUtils.round(new Date(timestamp), timestampAggregation), Collectors.counting()))
      .values().stream().mapToInt(p -> toInt(p)).summaryStatistics();

  return new RequestAggregationValuesImpl(stats.getMin(), stats.getMax(), stats.getAverage(), stats.getSum(), stats.getCount());
}
 
开发者ID:sealuzh,项目名称:PerformanceHat,代码行数:12,代码来源:SimpleRequestAggregationStrategyImpl.java

示例3: of

import java.util.IntSummaryStatistics; //导入方法依赖的package包/类
/**
 * Return a new value object of the statistical summary, currently
 * represented by the {@code statistics} object.
 *
 * @param statistics the creating (mutable) statistics class
 * @return the statistical moments
 */
public static IntSummary of(final IntSummaryStatistics statistics) {
	return new IntSummary(
		statistics.getCount(),
		statistics.getMin(),
		statistics.getMax(),
		statistics.getSum(),
		statistics.getAverage()
	);
}
 
开发者ID:jenetics,项目名称:jenetics,代码行数:17,代码来源:IntSummary.java

示例4: aggregate

import java.util.IntSummaryStatistics; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public RequestAggregationValues aggregate(RequestCollector requests) {
  double expectedCount = getExpectedNumberOfMeasurementValueGroups();

  /*
   * Group by aggregation interval and create summary statistics with min, avg, max and count
   */
  Collection<Long> groupedByAggregationInterval = requests.getReqTimestamps().stream()
      .collect(Collectors.groupingBy(timestamp -> DateUtils.round(new Date(timestamp), timestampAggregation), Collectors.counting())).values();
  int calculatedCount = groupedByAggregationInterval.size();

  try {
    if (calculatedCount != 0) {
      // use integer summaryStatistics to get min, avg, max
      IntSummaryStatistics stats = groupedByAggregationInterval.stream().mapToInt(p -> toInt(p)).summaryStatistics();

      // no time range selected, just return int summary
      if (expectedCount == 0) {
        return new RequestAggregationValuesImpl(stats.getMin(), stats.getMax(), stats.getAverage(), stats.getSum(), stats.getCount());
      }
      else {
        // if calculated count != expected count --> adjust minimum, average and count value
        if (Double.compare(calculatedCount, expectedCount) != 0) {
          double newAverage = (double) (stats.getSum() / expectedCount);
          return new RequestAggregationValuesImpl(0, stats.getMax(), newAverage, stats.getSum(), (int) expectedCount);
        }
        else {
          return new RequestAggregationValuesImpl(stats.getMin(), stats.getMax(), stats.getAverage(), stats.getSum(), (int) expectedCount);
        }
      }
    }
    else {
      return new RequestAggregationValuesImpl(0, 0, 0, 0, 0);
    }
  }
  catch (ArithmeticException e) {
    System.out.println(e.getMessage());
    return new RequestAggregationValuesImpl(0, 0, 0, 0, 0);
  }
}
 
开发者ID:sealuzh,项目名称:PerformanceHat,代码行数:44,代码来源:RequestAggregationStrategyImpl.java

示例5: SummaryStatistics

import java.util.IntSummaryStatistics; //导入方法依赖的package包/类
public SummaryStatistics(IntSummaryStatistics statistics) {
	this(statistics.getAverage(), statistics.getMax(),
		statistics.getMin(), statistics.getCount(),
		statistics.getSum());
}
 
开发者ID:sing-group,项目名称:GC4S,代码行数:6,代码来源:ColumnSummaryTabeCellRenderer.java


注:本文中的java.util.IntSummaryStatistics.getCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。