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


Java IntSummaryStatistics.getMax方法代码示例

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


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

示例1: getAsInt

import java.util.IntSummaryStatistics; //导入方法依赖的package包/类
@Override
public int getAsInt() {
    BinaryOperator<Dimension> accumulator = new BinaryOperator<Dimension>() {
        @Override
        public Dimension apply(Dimension t, Dimension u) {
            int w = Math.max(t.width, u.width);
            int h = Math.max(t.height, u.height);
            return new Dimension(w, h);
        }
    };

    Dimension extent = plantingBlockModel.getPlantingBlocks().stream()
        .map(pb -> new Dimension( pb.getX() + pb.getColumnCount() - 1, pb.getY() + pb.getRowCount() - 1 ))
        .reduce(new Dimension(0,0), accumulator);

    IntSummaryStatistics stats = plantingBlockModel.getPlantingBlocks().stream()
        .collect(Collectors.summarizingInt(pb -> pb.getColumnCount() * pb.getRowCount()));

    int maxSize = stats.getMax();
    int maxExtent = extent.width * extent.height;

    return Math.max(maxSize, maxExtent);
}
 
开发者ID:kddart,项目名称:kdxplore,代码行数:24,代码来源:FieldLayoutEditPanel.java

示例2: printRange

import java.util.IntSummaryStatistics; //导入方法依赖的package包/类
private void printRange(String string, IntSummaryStatistics perf) {
	int max = perf.getMax();
	int min = perf.getMin();
	if (min == max) {
		out.printf("%12s: %3d%n", string, max);
	} else {
		out.printf("%12s: %3d - %3d%n", string, min, max);
	}
}
 
开发者ID:Stummi,项目名称:pokemon-iv-tool,代码行数:10,代码来源:StatFindReport.java

示例3: isAllowed

import java.util.IntSummaryStatistics; //导入方法依赖的package包/类
@Override
public boolean isAllowed(Player player) {
    if (Arrays.stream(properties).map(Property::getGroup).distinct().count() != 1) {
        // Can only buy on one group at a time
        return false;
    }
    if (properties[0].getGroup().getHouseCost() <= 0) {
        // Not possible to buy on all groups
        return false;
    }
    if (!properties[0].getGroup().getProperties().stream().allMatch(p -> p.isOwnedBy(player))) {
        // Can only buy if you own the whole group
        return false;
    }
    PropertyGroup group = properties[0].getGroup();
    int[] resultingHouseCount = group.getProperties().stream().mapToInt(Property::getHouseCount).toArray();

    for (int i = 0; i < amount; i++) {
        int index = i % properties.length;
        Property property = properties[index];
        int groupIndex = group.getProperties().indexOf(property);
        resultingHouseCount[groupIndex]++;
    }

    IntSummaryStatistics stats = Arrays.stream(resultingHouseCount).summaryStatistics();
    boolean balanced = stats.getMax() - stats.getMin() <= 1;
    return balanced && player.getGame().isEmptyStack() && player.getGame().getCurrentPlayer() == player && player.getMoney() >= getCost();
}
 
开发者ID:Zomis,项目名称:flexgame-server,代码行数:29,代码来源:BuildAction.java

示例4: 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

示例5: report

import java.util.IntSummaryStatistics; //导入方法依赖的package包/类
@Override
public void report() {
    final IntStream yearStream = yearToMovieCount.keySet().stream().mapToInt(Integer::intValue);
    final IntSummaryStatistics summaryStatistics = yearStream.summaryStatistics();
    final List<Integer> yearWithoutMovies = new ArrayList<>();
    for (int year = summaryStatistics.getMin(); year <= summaryStatistics.getMax(); year++)
        if (!yearToMovieCount.containsKey(year))
            yearWithoutMovies.add(year);
    System.out.println(String.format("Years without movies: %s.", yearWithoutMovies));
}
 
开发者ID:FreekDB,项目名称:groovy-and-java-8,代码行数:11,代码来源:JavaSourceAndSinks.java

示例6: 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

示例7: computeNQ1PlusConcurringDuplexes

import java.util.IntSummaryStatistics; //导入方法依赖的package包/类
@SuppressWarnings("ReferenceEquality")
public int computeNQ1PlusConcurringDuplexes(Histogram concurringDuplexDistances, Parameters param) {
	MutableIntList alignmentStarts = IntLists.mutable.empty();

	final Duplex bestSupporting = getDuplexes().max(getDuplexQualityComparator());

	//Exclude duplexes whose reads all have an unmapped mate from the count
	//of Q1-Q2 duplexes that agree with the mutation; otherwise failed reads
	//may cause an overestimate of that number
	//Also exclude duplexes with clipping greater than maxConcurringDuplexClipping
	final int nConcurringDuplexes = getDuplexes().count(d -> {
		//noinspection ObjectEquality
		if (d == bestSupporting) {
			return true;
		}
		boolean good =
			d.allRecords.size() >= param.minConcurringDuplexReads * 2 /* double to account for mates */ &&
			d.localAndGlobalQuality.getValueIgnoring(assaysToIgnoreIncludingDuplexNStrands()).
				atLeast(Quality.GOOD) &&
			d.allRecords.anySatisfy(r -> !r.record.getMateUnmappedFlag()) &&
			d.allRecords.anySatisfy(r -> concurringDuplexReadClippingOK(r, param)) &&
			d.computeMappingQuality() >= param.minMappingQualityQ1;
		if (good) {
			final int distance = d.distanceTo(bestSupporting);
			alignmentStarts.add(distance);
			if (concurringDuplexDistances != null) {
				concurringDuplexDistances.insert(distance);
			}
		}
		return good;
	});

	if (!alignmentStarts.isEmpty()) {
		IntSummaryStatistics stats = alignmentStarts.summaryStatistics();
		smallestConcurringDuplexDistance = stats.getMin();
		largestConcurringDuplexDistance = stats.getMax();
	}

	nQ1PlusConcurringDuplexes = nConcurringDuplexes;
	return nConcurringDuplexes;
}
 
开发者ID:cinquin,项目名称:mutinack,代码行数:42,代码来源:CandidateSequence.java

示例8: 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

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