ch.lambdaj.Lambda.sum()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(212)

本文整理了Java中ch.lambdaj.Lambda.sum()方法的一些代码示例,展示了Lambda.sum()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lambda.sum()方法的具体详情如下:
包路径:ch.lambdaj.Lambda
类名称:Lambda
方法名:sum

Lambda.sum介绍

[英]Sums the items in the given iterable of Numbers or the iterable itself if it actually is already a single number. Actually it handles also Maps, Arrays and Iterator by collecting their values. Note that this method accepts an Object in order to be used in conjunction with the Lambda#forEach(Iterable).
[中]求给定iterable数或iterable本身(如果它实际上已经是单个数)中的项的和。实际上,它还通过收集映射、数组和迭代器的值来处理它们。请注意,此方法接受一个对象,以便与Lambda#forEach(Iterable)一起使用。

代码示例

代码示例来源:origin: mariofusco/lambdaj

/**
 * Sums the property values of the items in this iterable defined by the given argument.
 * @param argument An argument defined using the {@link Lambda#on(Class)} method
 * @return The sum of the property values extracted from all the items in the given iterable
 */
public <A> A sum(A argument) {
  return Lambda.sum(getInner(), argument);
}

代码示例来源:origin: net.thucydides/thucydides-core

public Long getDuration() {
  if ((duration == 0) && (testSteps.size() > 0)) {
    return sum(testSteps, on(TestStep.class).getDuration());
  } else {
    return duration;
  }
}

代码示例来源:origin: net.serenity-bdd/core

public Long getDuration() {
  if ((duration == 0) && (testSteps.size() > 0)) {
    return sum(testSteps, on(TestStep.class).getDuration());
  } else {
    return duration;
  }
}

代码示例来源:origin: net.thucydides/thucydides-core

/**
 * @return The total number of test runs in this set (including rows in data-driven tests).
 */
public int getTotal() {
  return sum(outcomes, on(TestOutcome.class).getTestCount());
}

代码示例来源:origin: net.serenity-bdd/core

/**
 * @return The total number of test runs in this set (including rows in data-driven tests).
 */
public int getTotal() {
  return sum(outcomes, on(TestOutcome.class).getTestCount());
}

代码示例来源:origin: net.serenity-bdd/core

protected int countTestsWithResult(TestResult expectedResult, TestType testType) {
  return sum(outcomes, on(TestOutcome.class).countResults(expectedResult, testType));
}

代码示例来源:origin: net.serenity-bdd/core

/**
 * @return The total number of nested steps in these test outcomes.
 */
public int getStepCount() {
  return sum(extract(outcomes, on(TestOutcome.class).getNestedStepCount())).intValue();
}

代码示例来源:origin: net.thucydides/thucydides-core

protected int countTestsWithResult(TestResult expectedResult, TestType testType) {
  return sum(outcomes, on(TestOutcome.class).countResults(expectedResult, testType));
}

代码示例来源:origin: net.thucydides/thucydides-core

/**
 * @return The total number of nested steps in these test outcomes.
 */
public int getStepCount() {
  return sum(extract(outcomes, on(TestOutcome.class).getNestedStepCount())).intValue();
}

代码示例来源:origin: net.thucydides/thucydides-core

public double getOverallStability() {
  if (outcomes.isEmpty()) {
    return 0.0;
  } else {
    return sum(outcomes, on(TestOutcome.class).getOverallStability()) / getTestCount();
  }
}

代码示例来源:origin: net.thucydides/thucydides-core

/**
 * @param testType 'manual' or 'automated' (this is a string because it is mainly called from the freemarker templates
 */
public int successCount(String testType) {
  return sum(outcomes, on(TestOutcome.class).countResults(SUCCESS, TestType.valueOf(testType.toUpperCase())));
}

代码示例来源:origin: net.thucydides/thucydides-core

public double getRecentStability() {
  if (outcomes.isEmpty()) {
    return 0.0;
  } else {
    return sum(outcomes, on(TestOutcome.class).getRecentStability()) / getTestCount();
  }
}

代码示例来源:origin: net.serenity-bdd/core

/**
 * @param testType 'manual' or 'automated' (this is a string because it is mainly called from the freemarker templates
 */
public int successCount(String testType) {
  return sum(outcomes, on(TestOutcome.class).countResults(SUCCESS, TestType.valueOf(testType.toUpperCase())));
}

代码示例来源:origin: net.serenity-bdd/core

public double getRecentStability() {
  if (outcomes.isEmpty()) {
    return 0.0;
  } else {
    return sum(outcomes, on(TestOutcome.class).getRecentStability()) / getTestCount();
  }
}

代码示例来源:origin: net.serenity-bdd/core

public double getOverallStability() {
  if (outcomes.isEmpty()) {
    return 0.0;
  } else {
    return sum(outcomes, on(TestOutcome.class).getOverallStability()) / getTestCount();
  }
}

代码示例来源:origin: net.serenity-bdd/core

private int countStepsWithResult(TestResult expectedResult, TestType testType) {
  int stepCount = sum(outcomes, on(TestOutcome.class).countNestedStepsWithResult(expectedResult, testType));
  if ((stepCount == 0) && aMatchingTestExists(expectedResult, testType)) {
    return (int) Math.round(getAverageTestSize());
  }
  return stepCount;
}

代码示例来源:origin: net.thucydides/thucydides-core

private int countStepsWithResult(TestResult expectedResult, TestType testType) {
  int stepCount = sum(outcomes, on(TestOutcome.class).countNestedStepsWithResult(expectedResult, testType));
  if ((stepCount == 0) && aMatchingTestExists(expectedResult, testType)) {
    return (int) Math.round(getAverageTestSize());
  }
  return stepCount;
}

代码示例来源:origin: net.serenity-bdd/core

public int withResult(TestResult expectedResult) {
  return sum(outcomes.getOutcomes(), on(TestOutcome.class).countResults(expectedResult));
}

代码示例来源:origin: net.thucydides/thucydides-core

public int getTotalDataRows() {
  List<? extends TestOutcome> datadrivenTestOutcomes = filter(having(on(TestOutcome.class).isDataDriven(), is(true)), outcomes);
  return sum(datadrivenTestOutcomes, on(TestOutcome.class).getDataTable().getSize());
}

代码示例来源:origin: net.serenity-bdd/core

public int getTotalDataRows() {
  List<? extends TestOutcome> datadrivenTestOutcomes = filter(having(on(TestOutcome.class).isDataDriven(), is(true)), outcomes);
  return sum(datadrivenTestOutcomes, on(TestOutcome.class).getDataTable().getSize());
}

相关文章