本文整理汇总了Java中java.math.BigDecimal.ZERO属性的典型用法代码示例。如果您正苦于以下问题:Java BigDecimal.ZERO属性的具体用法?Java BigDecimal.ZERO怎么用?Java BigDecimal.ZERO使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.math.BigDecimal
的用法示例。
在下文中一共展示了BigDecimal.ZERO属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeRemainingRevenue
BigDecimal computeRemainingRevenue(String currencyId,
OfferingType offerType) throws XPathExpressionException {
BigDecimal sum = BigDecimal.ZERO;
for (Node marketplace : marketplaceNodes(currencyId)) {
String marketplaceId = XMLConverter.getStringAttValue(marketplace,
BillingShareResultXmlTags.ATTRIBUTE_NAME_ID);
for (Node service : serviceNodes(currencyId, marketplaceId,
offerType)) {
Node revenueShareDetails = XMLConverter.getLastChildNode(
service,
BillingShareResultXmlTags.NODE_NAME_REVENUE_SHARE_DETAILS);
BigDecimal amountForSupplier = XMLConverter
.getBigDecimalAttValue(revenueShareDetails,
BillingShareResultXmlTags.ATTRIBUTE_NAME_AMOUNT_FOR_SUPPLIER);
if (amountForSupplier == null) {
amountForSupplier = XMLConverter.getBigDecimalAttValue(
revenueShareDetails,
BillingShareResultXmlTags.ATTRIBUTE_NAME_NETAMOUNT_FOR_SUPPLIER);
}
if (amountForSupplier != null) {
sum = sum.add(amountForSupplier);
}
}
}
return sum;
}
示例2: StockUpdate
public StockUpdate(String stockSymbol, BigDecimal price, Date date, String twitterStatus) {
if (stockSymbol == null) {
stockSymbol = "";
}
if (twitterStatus == null) {
twitterStatus = "";
}
if (price == null) {
price = BigDecimal.ZERO;
}
this.stockSymbol = stockSymbol;
this.price = price;
this.date = date;
this.twitterStatus = twitterStatus;
this.movingAverage = BigDecimal.ZERO;
}
示例3: valRealFromDecimal
protected BigDecimal valRealFromDecimal() {
/* Note that fix_fields may not be called for Item_avg_field items */
BigDecimal decVal = valDecimal();
if (nullValue)
return BigDecimal.ZERO;
return decVal;
}
示例4: sumCorrelationsOfBucket
static BigDecimal sumCorrelationsOfBucket(RiskClass riskClass, List<WeightedSensitivity> weightedSensitivities) {
BigDecimal sum = BigDecimal.ZERO;
for (WeightedSensitivity weightedSensitivityK : weightedSensitivities) {
for (WeightedSensitivity weightedSensitivityI : weightedSensitivities) {
if (!weightedSensitivityI.equals(weightedSensitivityK)) {
BigDecimal concentrationRisk = RiskConcentration.getDeltaIntraBucketCorrelation(riskClass, weightedSensitivityI, weightedSensitivityK, weightedSensitivities);
BigDecimal correlation = RiskCorrelation.getSensitivityCorrelation(riskClass, weightedSensitivityI.getSensitivity(), weightedSensitivityK.getSensitivity());
BigDecimal value = concentrationRisk.multiply(correlation).multiply(weightedSensitivityI.getWeightedValue()).multiply(weightedSensitivityK.getWeightedValue());
sum = sum.add(value);
}
}
}
return sum;
}
示例5: getFuelUnitPriceLowest
private BigDecimal getFuelUnitPriceLowest() {
Cursor cursor = dbHelper.getReadableDatabase().rawQuery(
"SELECT MIN(" + FillUpEntry.COLUMN_FUEL_PRICE_PER_LITRE
+ ") FROM " + FillUpEntry.TABLE_NAME
+ " WHERE " + FillUpEntry.COLUMN_VEHICLE + "=?",
getAsArgument(mVehicleId));
if (cursor.moveToFirst()) {
BigDecimal result = BigDecimal.valueOf(cursor.getDouble(0));
cursor.close();
return result;
}
Log.e(LOG_TAG, "Cannot retrieve min fuel price per litre for vehicleId=" + mVehicleId);
return BigDecimal.ZERO;
}
示例6: getTotalSize
/**
* Gets the total qty of open orders at the given price level.
*/
BigDecimal getTotalSize(Side side, BigDecimal price) {
if (price == null) {
return BigDecimal.ZERO;
}
OrderBookSide bookSide;
if (side == Side.BUY) {
bookSide = bids;
} else {
bookSide = asks;
}
PriceLevel level = bookSide.priceLevels.get(price);
if (level == null) {
return BigDecimal.ZERO;
} else {
return level.totalSize;
}
}
示例7: testBillingWithSteppedPricesForPriceModelStep2
/**
* Billing test for price model with stepped price.
*
* @throws Exception
*/
@Test
public void testBillingWithSteppedPricesForPriceModelStep2()
throws Exception {
int numUser = 20;
BigDecimal expectedPrice = BigDecimal.valueOf(2621L);
BigDecimal[] priceArray = { BD100, BD90, BD80 };
long[] freeAmountArray = { 1, 2, 3 };
BigDecimal[] additionalPriceArray = { BigDecimal.ZERO, BD1000,
BigDecimal.valueOf(1900) };
testBillingWithSteppedPricesForPriceModel(0, numUser, expectedPrice,
false, limitArray, priceArray, freeAmountArray,
additionalPriceArray);
xmlValidator.validateBillingResultXML();
}
示例8: testPriceModelParameterTagsStructure
/**
* Test for billing xml structure. PricedParameter and PriceModel tags
* position.
*
* @throws Exception
*/
@Test
public void testPriceModelParameterTagsStructure() throws Exception {
final int testMonth = Calendar.APRIL;
final int testDay = 1;
final int testYear = 2010;
final long billingTime = getTimeInMillisForBilling(testYear, testMonth,
testDay);
long subscriptionCreationTime = getTimeInMillisForBilling(testYear,
testMonth - 2, testDay);
BigDecimal[] priceArray = { BD100, BD90, BD80 };
long[] freeAmountArray = { 0, 0, 0 };
BigDecimal[] additionalPriceArray = { BigDecimal.ZERO, BD1000,
BigDecimal.valueOf(1900) };
initData(billingTime, subscriptionCreationTime,
subscriptionCreationTime, limitArray, priceArray,
freeAmountArray, additionalPriceArray);
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
billingService.startBillingRun(billingTime);
return null;
}
});
Document doc = getBillingDocument();
String parameterId = XMLConverter.getNodeTextContentByXPath(doc,
"/BillingDetails/Subscriptions/Subscription/PriceModels/PriceModel/Parameters/Parameter/@id");
Assert.assertEquals("Wrong structure of billin.xml", "integerParam",
parameterId);
xmlValidator.validateBillingResultXML();
}
示例9: computeTotalPrice
@Override
public BigDecimal computeTotalPrice(boolean includeTax) {
BigDecimal tp = BigDecimal.ZERO;
if (q != null && up != null) {
tp = q.multiply(up);
if (dct != null) {
tp = tp.subtract(tp.multiply(dct.divide(new BigDecimal(100), RoundingMode.HALF_UP)));
}
// Check item level tax, if any
BigDecimal tax = getTax();
if (includeTax && BigUtil.notEqualsZero(tax)) {
tp = tp.add(tp.multiply(tax.divide(new BigDecimal(100), RoundingMode.HALF_UP)));
}
}
return tp;
}
示例10: getFactionMaxPower
public static BigDecimal getFactionMaxPower(Faction faction)
{
BigDecimal factionMaxPower = BigDecimal.ZERO;
if(faction.Leader != null && faction.Leader != "")
{
factionMaxPower = factionMaxPower.add(PowerService.getPlayerMaxPower(UUID.fromString(faction.Leader)));
}
if(faction.Officers != null && !faction.Officers.isEmpty())
{
for (String officer: faction.Officers)
{
factionMaxPower = factionMaxPower.add(PowerService.getPlayerMaxPower(UUID.fromString(officer)));
}
}
if(faction.Members != null && !faction.Members.isEmpty())
{
for (String member: faction.Members)
{
factionMaxPower = factionMaxPower.add(PowerService.getPlayerMaxPower(UUID.fromString(member)));
}
}
return factionMaxPower;
}
示例11: sumServiceRevenue
public void sumServiceRevenue(BigDecimal valueToAdd) {
if (serviceRevenue == null) {
serviceRevenue = BigDecimal.ZERO;
}
this.serviceRevenue = serviceRevenue.add(valueToAdd);
}
示例12: testFXV6
@Test // testing 0 value in FXV
public void testFXV6() {
Sensitivity zero = new Sensitivity("RatesFX", "Risk_FXVol", "USDJPY", "", "2w", "", BigDecimal.ZERO);
Assert.assertEquals(BigDecimal.ZERO, simm.calculateStandard(Arrays.asList(zero)).setScale(0, RoundingMode.HALF_UP));
}
示例13: getRevenueRealizable
@Override
public BigDecimal getRevenueRealizable() {
return cassandraRow.get("rrv") != null ? BigUtil
.getZeroIfNull(new BigDecimal(cassandraRow.get("rrv").toString())) : BigDecimal.ZERO;
}
示例14: calculate
public void calculate(BigDecimal marketplaceRevenueSharePercentage,
BigDecimal operatorRevenueSharePercentage,
BigDecimal brokerRevenueSharePercentage,
BigDecimal resellerRevenueSharePercentage) {
serviceRevenue = serviceRevenue.setScale(
PriceConverter.NORMALIZED_PRICE_SCALING,
PriceConverter.ROUNDING_MODE);
if (marketplaceRevenueSharePercentage == null) {
marketplaceRevenueSharePercentage = BigDecimal.ZERO;
}
marketplaceRevenueSharePercentage = marketplaceRevenueSharePercentage
.setScale(PriceConverter.NORMALIZED_PRICE_SCALING,
PriceConverter.ROUNDING_MODE);
marketplaceRevenue = BigDecimals.calculatePercent(
marketplaceRevenueSharePercentage, serviceRevenue);
setAmountForSupplier(serviceRevenue.subtract(marketplaceRevenue));
operatorRevenueSharePercentage = operatorRevenueSharePercentage
.setScale(PriceConverter.NORMALIZED_PRICE_SCALING,
PriceConverter.ROUNDING_MODE);
operatorRevenue = BigDecimals.calculatePercent(
operatorRevenueSharePercentage, serviceRevenue);
setAmountForSupplier(amountForSupplier.subtract(operatorRevenue));
if (brokerRevenueSharePercentage != null) {
brokerRevenueSharePercentage = brokerRevenueSharePercentage
.setScale(PriceConverter.NORMALIZED_PRICE_SCALING,
PriceConverter.ROUNDING_MODE);
brokerRevenue = BigDecimals.calculatePercent(
brokerRevenueSharePercentage, serviceRevenue);
setAmountForSupplier(amountForSupplier.subtract(brokerRevenue));
}
if (resellerRevenueSharePercentage != null) {
resellerRevenueSharePercentage = resellerRevenueSharePercentage
.setScale(PriceConverter.NORMALIZED_PRICE_SCALING,
PriceConverter.ROUNDING_MODE);
resellerRevenue = BigDecimals.calculatePercent(
resellerRevenueSharePercentage, serviceRevenue);
setAmountForSupplier(amountForSupplier.subtract(resellerRevenue));
}
}
示例15: sumMarketplaceRevenue
public void sumMarketplaceRevenue(BigDecimal valueToAdd) {
if (marketplaceRevenue == null) {
marketplaceRevenue = BigDecimal.ZERO;
}
this.marketplaceRevenue = marketplaceRevenue.add(valueToAdd);
}