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


Java BigDecimal.min方法代码示例

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


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

示例1: create

import java.math.BigDecimal; //导入方法依赖的package包/类
/**
 * Create a graph
 * @param goalInKg the goal set
 * @param measurements the measurement data
 * @return a chart 
 */
public Chart create(BigDecimal goalInKg, Iterable<WeightMeasurement> measurements) {
	BigDecimal minValue = goalInKg;
	BigDecimal maxValue = goalInKg;
	List<List<Object>> dataPoints = new ArrayList<>();
	for (WeightMeasurement wm : measurements) {
		if (minValue == null) {
			minValue = wm.getWeightInKg();
		} else {
			minValue = minValue.min(wm.getWeightInKg());
		}
		if (maxValue == null) {
			maxValue = wm.getWeightInKg();
		} else {
			maxValue = maxValue.max(wm.getWeightInKg());
		}
		dataPoints.add(Lists.newArrayList(wm.getDateTime().toInstant(ZoneOffset.UTC).toEpochMilli(),wm.getWeightInKg()));
	}
	if (minValue != null) {
		minValue = minValue.subtract(BigDecimal.valueOf(1));
	} 
	if (maxValue != null) {
		maxValue = maxValue.add(BigDecimal.valueOf(1));
	}
	return Chart.of(minValue, maxValue, goalInKg, dataPoints, calculareTrend(dataPoints));
}
 
开发者ID:xabgesagtx,项目名称:fat-lining,代码行数:32,代码来源:ChartFactory.java

示例2: doLogic

import java.math.BigDecimal; //导入方法依赖的package包/类
public static boolean doLogic(BigDecimal valueOne, Operator.Logic operator, BigDecimal valueTwo)
{
	switch (operator)
	{
		case EQUALS:
			return valueOne.equals(valueTwo);
		case NOTEQUALS:
			return !valueOne.equals(valueTwo);
		case GREATER:
			BigDecimal max = valueOne.max(valueTwo);
			return max.equals(valueOne);
		case SMALLER:
			BigDecimal min = valueOne.min(valueTwo);
			return min.equals(valueOne);
		default:
			return false;
	}
}
 
开发者ID:DirkDeVisser,项目名称:pifuck,代码行数:19,代码来源:BasicBigDecimal.java

示例3: calculateTheta

import java.math.BigDecimal; //导入方法依赖的package包/类
public static BigDecimal calculateTheta(List<WeightedSensitivity> weightedSensitivies) {
  BigDecimal sumOfRiskExposures = WeightedSensitivityUtils.sumWeightSensitivities(weightedSensitivies);
  BigDecimal sumOfAbsRiskExposures = WeightedSensitivityUtils.sumAbsoluteValues(weightedSensitivies);

  // need to chack to make sure that sums are not equal to zero
  if (sumOfAbsRiskExposures.stripTrailingZeros().equals(BigDecimal.ZERO)) {
    return BigDecimal.ZERO;
  } else {
    BigDecimal quotient = BigDecimalUtils.divideWithPrecision(sumOfRiskExposures, sumOfAbsRiskExposures);
    return quotient.min(BigDecimal.ZERO);
  }
}
 
开发者ID:AcadiaSoft,项目名称:simm-lib,代码行数:13,代码来源:CurvatureMarginLambdaUtils.java

示例4: calculateMin

import java.math.BigDecimal; //导入方法依赖的package包/类
/**
 * Calculate Minimum
 * 
 * @param fileContents
 * @param target
 * @return sumValue
 */
private BigDecimal calculateMin(FileContents fileContents,
        final String target) {
    /* Calculate Minimum Column Value */
    BigDecimal minValue = BigDecimal.valueOf(Double.MAX_VALUE);
    for (final FileRecord fileRecord : fileContents.getData()) {
        BigDecimal expressionValue = new BigDecimal(String.valueOf(
                evaluateExpression(fileContents, fileRecord, target)));
        minValue = minValue.min(expressionValue);
    }
    return minValue;
}
 
开发者ID:ukubuka,项目名称:ukubuka-core,代码行数:19,代码来源:UkubukaTransformer.java

示例5: min

import java.math.BigDecimal; //导入方法依赖的package包/类
@Override
public BigDecimal min(BigDecimal arg0, BigDecimal arg1) {
    return arg0.min(arg1);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:5,代码来源:BigRealAlgebra.java

示例6: min

import java.math.BigDecimal; //导入方法依赖的package包/类
public static BigDecimal min( BigDecimal a, BigDecimal b ) {
   return a.min( b );
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:4,代码来源:Math.java

示例7: adjustBuyBoundaryPrice

import java.math.BigDecimal; //导入方法依赖的package包/类
@Override
protected BigDecimal adjustBuyBoundaryPrice(Context context, Request request, BigDecimal price) {

    if (price == null) {
        return null;
    }

    Key key = getUnderlyingKey(request);

    if (key == null) {
        return price;
    }

    BigDecimal bid = context.getBestBidPrice(key);

    BigDecimal comm = context.getCommissionRate(key);

    BigDecimal spread = request.getTradingSpread();

    BigDecimal dailyRate = getDecimalProperty(KEY_SWAP_B, SWAP_RATE);

    BigDecimal swap = calculateSwapRate(context, request, dailyRate);

    if (bid == null || comm == null || swap == null) {
        return null;
    }

    BigDecimal theoretical = bid.multiply(ONE.subtract(comm).subtract(spread).subtract(swap));

    return price.min(theoretical);

}
 
开发者ID:after-the-sunrise,项目名称:cryptotrader,代码行数:33,代码来源:BitflyerAdviser.java

示例8: calculateBuyLimitPrice

import java.math.BigDecimal; //导入方法依赖的package包/类
@VisibleForTesting
BigDecimal calculateBuyLimitPrice(Context context, Request request, BigDecimal weighedPrice, BigDecimal basis) {

    if (weighedPrice == null || basis == null) {

        log.trace("Buy price not available : weighed=[{}] basis=[{}]", weighedPrice, basis);

        return null;

    }

    Key key = Key.from(request);

    BigDecimal bound = calculateBuyBoundaryPrice(context, request, basis);

    if (bound == null) {

        log.trace("Buy price not available : No bound price.");

        return null;

    }

    BigDecimal basisPrice = weighedPrice.multiply(ONE.subtract(basis));

    BigDecimal boundPrice = basisPrice.min(bound);

    BigDecimal rounded = context.roundTickSize(key, boundPrice, DOWN);

    log.trace("Buy price : {} (target=[{}] basis=[{}])", rounded, boundPrice, basisPrice);

    return rounded;

}
 
开发者ID:after-the-sunrise,项目名称:cryptotrader,代码行数:35,代码来源:TemplateAdviser.java

示例9: getDecimal

import java.math.BigDecimal; //导入方法依赖的package包/类
@VisibleForTesting
BigDecimal getDecimal(String site, String instrument,
                      PropertyType type, BigDecimal min, BigDecimal max, BigDecimal defaultValue) {

    try {

        BigDecimal value = get(type, site, instrument, Configuration::getBigDecimal);

        BigDecimal adjusted = value;

        if (min != null) {
            adjusted = adjusted.max(min);
        }

        if (max != null) {
            adjusted = adjusted.min(max);
        }

        log.trace("Fetched {} ({}.{}) : {} -> {}", type, site, instrument, value, adjusted);

        return adjusted;

    } catch (RuntimeException e) {

        log.warn(format("Invalid %s (%s.%s)", type, site, instrument), e);

        return defaultValue;

    }

}
 
开发者ID:after-the-sunrise,项目名称:cryptotrader,代码行数:32,代码来源:PropertyManagerImpl.java

示例10: min

import java.math.BigDecimal; //导入方法依赖的package包/类
public static BigDecimal min(BigDecimal a, BigDecimal b) { return a.min(b); } 
开发者ID:CenPC434,项目名称:java-tools,代码行数:2,代码来源:Lang.java


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