本文整理了Java中java.math.BigDecimal.max()
方法的一些代码示例,展示了BigDecimal.max()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BigDecimal.max()
方法的具体详情如下:
包路径:java.math.BigDecimal
类名称:BigDecimal
方法名:max
[英]Returns the maximum of this BigDecimal and val.
[中]返回此BigDecimal和val的最大值。
代码示例来源:origin: prestodb/presto
public void addValue(BigDecimal value)
{
requireNonNull(value, "value is null");
nonNullValueCount++;
if (minimum == null) {
minimum = value;
maximum = value;
}
else {
minimum = minimum.min(value);
maximum = maximum.max(value);
}
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public void value(BigDecimal each)
{
this.count++;
if (each != null)
{
this.sum = this.sum.add(each);
this.min = this.min == null ? each : this.min.min(each);
this.max = this.max == null ? each : this.max.max(each);
}
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public void value(BigDecimal each)
{
this.count++;
if (each != null)
{
this.sum = this.sum.add(each);
this.min = this.min == null ? each : this.min.min(each);
this.max = this.max == null ? each : this.max.max(each);
}
}
代码示例来源:origin: eclipse/eclipse-collections
public BigDecimalSummaryStatistics merge(BigDecimalSummaryStatistics summaryStatistics)
{
this.count += summaryStatistics.count;
this.sum = this.sum.add(summaryStatistics.sum);
if (summaryStatistics.min != null)
{
this.min = this.min == null ? summaryStatistics.min : this.min.min(summaryStatistics.min);
}
if (summaryStatistics.max != null)
{
this.max = this.max == null ? summaryStatistics.max : this.max.max(summaryStatistics.max);
}
return this;
}
}
代码示例来源:origin: eclipse/eclipse-collections
public BigDecimalSummaryStatistics merge(BigDecimalSummaryStatistics summaryStatistics)
{
this.count += summaryStatistics.count;
this.sum = this.sum.add(summaryStatistics.sum);
if (summaryStatistics.min != null)
{
this.min = this.min == null ? summaryStatistics.min : this.min.min(summaryStatistics.min);
}
if (summaryStatistics.max != null)
{
this.max = this.max == null ? summaryStatistics.max : this.max.max(summaryStatistics.max);
}
return this;
}
}
代码示例来源:origin: prestodb/presto
private void addDecimalStatistics(long valueCount, DecimalStatistics value)
{
requireNonNull(value, "value is null");
requireNonNull(value.getMin(), "value.getMin() is null");
requireNonNull(value.getMax(), "value.getMax() is null");
nonNullValueCount += valueCount;
if (minimum == null) {
minimum = value.getMin();
maximum = value.getMax();
}
else {
minimum = minimum.min(value.getMin());
maximum = maximum.max(value.getMax());
}
}
代码示例来源:origin: apache/accumulo
@Override
public BigDecimal typedReduce(Key key, Iterator<BigDecimal> iter) {
if (!iter.hasNext())
return null;
BigDecimal max = iter.next();
while (iter.hasNext()) {
max = max.max(iter.next());
}
return max;
}
}
代码示例来源:origin: org.incode.module.base/incode-module-base-dom
public static BigDecimal max(BigDecimal... input){
BigDecimal max = BigDecimal.ZERO;
for (BigDecimal value : input){
if (value != null){
max = max.max(value);
}
}
return max;
}
代码示例来源:origin: com.hazelcast/hazelcast-all
@Override
public void reduce(BigDecimal value) {
max = max == null ? value : value.max(max);
}
代码示例来源:origin: ChenSen5/api_autotest
@Override
public String execute(String[] args) {
BigDecimal maxValue=new BigDecimal(args[0]);
for(String numerial :args){
maxValue = maxValue.max(new BigDecimal(numerial));
}
return String.valueOf(maxValue);
}
代码示例来源:origin: zzycreate/spring-boot-seed
/**
* 返回两个数中大的一个值
*
* @param v1 需要被对比的第一个数
* @param v2 需要被对比的第二个数
* @return 返回两个数中大的一个值
*/
public static double returnMax(double v1, double v2) {
BigDecimal b1 = new BigDecimal(v1);
BigDecimal b2 = new BigDecimal(v2);
return b1.max(b2).doubleValue();
}
代码示例来源:origin: org.apache.accumulo/accumulo-core
@Override
public BigDecimal typedReduce(Key key, Iterator<BigDecimal> iter) {
if (!iter.hasNext())
return null;
BigDecimal max = iter.next();
while (iter.hasNext()) {
max = max.max(iter.next());
}
return max;
}
}
代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-core
public void collect(CollapseGroup collapseGroup, String number) {
BigDecimal higestNumber = higestNumbers.get(collapseGroup);
BigDecimal newNumber = new BigDecimal(number);
if (higestNumber == null) {
higestNumbers.put(collapseGroup, newNumber);
} else {
higestNumbers.put(collapseGroup, higestNumber.max(newNumber));
}
}
代码示例来源:origin: com.github.liuzhongkai/spider-boot-bean
public BigDecimalSummaryStatistics combine(BigDecimalSummaryStatistics summaryStatistics) {
this.count += summaryStatistics.count;
this.sum = this.sum.add(summaryStatistics.sum);
if (summaryStatistics.min != null) {
this.min = this.min == null ? summaryStatistics.min : this.min.min(summaryStatistics.min);
}
if (summaryStatistics.max != null) {
this.max = this.max == null ? summaryStatistics.max : this.max.max(summaryStatistics.max);
}
return this;
}
代码示例来源:origin: org.eclipse.collections/eclipse-collections
@Override
public void value(BigDecimal each)
{
this.count++;
if (each != null)
{
this.sum = this.sum.add(each);
this.min = this.min == null ? each : this.min.min(each);
this.max = this.max == null ? each : this.max.max(each);
}
}
代码示例来源:origin: org.openhab.binding/org.openhab.binding.plex
private void updateProgress() {
if (duration > 0) {
BigDecimal progress = new BigDecimal("100")
.divide(new BigDecimal(duration), new MathContext(100, RoundingMode.HALF_UP))
.multiply(new BigDecimal(viewOffset))
.setScale(2, RoundingMode.HALF_UP);
progress = BigDecimal.ZERO.max(progress);
progress = new BigDecimal("100").min(progress);
this.progress = progress;
this.endTime = new Date(System.currentTimeMillis() + (duration - viewOffset));
}
}
代码示例来源:origin: com.github.liuzhongkai/spider-boot-bean
@Override
public void accept(BigDecimal each) {
this.count++;
if (each != null) {
this.sum = this.sum.add(each);
this.min = this.min == null ? each : this.min.min(each);
this.max = this.max == null ? each : this.max.max(each);
}
}
代码示例来源:origin: com.threewks.thundr/thundr-gae
@SuppressWarnings("unchecked")
@Override
public <In> BigDecimal normalise(TransformerManager transformerManager, In value) {
Class<In> valueClass = (Class<In>) value.getClass();
BigDecimal bigDecimalValue = transformerManager.transform(valueClass, BigDecimal.class, value);
bigDecimalValue = bigDecimalValue.movePointLeft(shift).setScale(shift + scale, RoundingMode.DOWN);
bigDecimalValue = bigDecimalValue.min(Max).max(Min);
return bigDecimalValue;
}
代码示例来源:origin: com.github.robozonky/robozonky-strategy-natural
public RangeCondition(final Function<T, Number> targetAccessor, final Number minValueInclusive,
final Number maxValueInclusive) {
this.targetAccessor = targetAccessor;
final BigDecimal min = toBigDecimal(minValueInclusive);
final BigDecimal max = toBigDecimal(maxValueInclusive);
this.minInclusive = min.min(max);
this.maxInclusive = min.max(max);
}
代码示例来源:origin: RoboZonky/robozonky
public RangeCondition(final Function<T, Number> targetAccessor, final Number minValueInclusive,
final Number maxValueInclusive) {
this.targetAccessor = targetAccessor;
final BigDecimal min = toBigDecimal(minValueInclusive);
final BigDecimal max = toBigDecimal(maxValueInclusive);
this.minInclusive = min.min(max);
this.maxInclusive = min.max(max);
}
内容来源于网络,如有侵权,请联系作者删除!