本文整理了Java中java.math.BigDecimal.min()
方法的一些代码示例,展示了BigDecimal.min()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BigDecimal.min()
方法的具体详情如下:
包路径:java.math.BigDecimal
类名称:BigDecimal
方法名:min
[英]Returns the minimum 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 min = iter.next();
while (iter.hasNext()) {
min = min.min(iter.next());
}
return min;
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public void combine(BigDecimal value) {
min = min == null ? value : value.min(min);
}
代码示例来源:origin: torakiki/sejda
/**
* Sets the percentage for this event
*
* @param percentage
*/
public final void setPercentage(BigDecimal percentage) {
if (BigDecimal.ZERO.compareTo(percentage) > 0) {
this.percentage = UNDETERMINED;
} else {
this.percentage = MAX_PERGENTAGE.min(percentage);
}
}
代码示例来源:origin: org.sejda/sejda-model
/**
* Sets the percentage for this event
*
* @param percentage
*/
public final void setPercentage(BigDecimal percentage) {
if (BigDecimal.ZERO.compareTo(percentage) > 0) {
this.percentage = UNDETERMINED;
} else {
this.percentage = MAX_PERGENTAGE.min(percentage);
}
}
代码示例来源:origin: zzycreate/spring-boot-seed
/**
* 返回两个数中小的一个值
*
* @param v1 需要被对比的第一个数
* @param v2 需要被对比的第二个数
* @return 返回两个数中小的一个值
*/
public static double returnMin(double v1, double v2) {
BigDecimal b1 = new BigDecimal(v1);
BigDecimal b2 = new BigDecimal(v2);
return b1.min(b2).doubleValue();
}
代码示例来源:origin: org.apache.accumulo/accumulo-core
@Override
public BigDecimal typedReduce(Key key, Iterator<BigDecimal> iter) {
if (!iter.hasNext())
return null;
BigDecimal min = iter.next();
while (iter.hasNext()) {
min = min.min(iter.next());
}
return min;
}
}
代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-core
public void collect(CollapseGroup collapseGroup, String number) {
BigDecimal lowestNumber = lowestNumbers.get(collapseGroup);
BigDecimal newNumber = new BigDecimal(number);
if (lowestNumber == null) {
lowestNumbers.put(collapseGroup, newNumber);
} else {
lowestNumbers.put(collapseGroup, lowestNumber.min(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.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: 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: 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: 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);
}
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!