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


Java BigDecimal.ZERO属性代码示例

本文整理汇总了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;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:26,代码来源:SupplierRevenueShareBuilder.java

示例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;
}
 
开发者ID:PacktPublishing,项目名称:Reactive-Android-Programming,代码行数:19,代码来源:StockUpdate.java

示例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;
}
 
开发者ID:actiontech,项目名称:dble,代码行数:7,代码来源:Item.java

示例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;
}
 
开发者ID:AcadiaSoft,项目名称:simm-lib,代码行数:16,代码来源:DeltaMarginBucketUtils.java

示例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;
}
 
开发者ID:piskula,项目名称:FuelUp,代码行数:14,代码来源:StatisticsService.java

示例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;
    }
}
 
开发者ID:cloudwall,项目名称:libcwfincore,代码行数:21,代码来源:OrderBook.java

示例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();
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:21,代码来源:BillingServiceBeanSteppedPriceIT.java

示例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();
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:42,代码来源:BillingServiceBeanSteppedPriceIT.java

示例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;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:16,代码来源:DemandItem.java

示例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;
}
 
开发者ID:Aquerr,项目名称:EagleFactions,代码行数:27,代码来源:PowerService.java

示例11: sumServiceRevenue

public void sumServiceRevenue(BigDecimal valueToAdd) {
    if (serviceRevenue == null) {
        serviceRevenue = BigDecimal.ZERO;
    }
    this.serviceRevenue = serviceRevenue.add(valueToAdd);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:6,代码来源:ResellerRevenue.java

示例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));
}
 
开发者ID:AcadiaSoft,项目名称:simm-lib,代码行数:5,代码来源:AcadiaVegaUnitTestV2_0.java

示例13: getRevenueRealizable

@Override
public BigDecimal getRevenueRealizable() {

  return cassandraRow.get("rrv") != null ? BigUtil
      .getZeroIfNull(new BigDecimal(cassandraRow.get("rrv").toString())) : BigDecimal.ZERO;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:6,代码来源:ReportsSlice.java

示例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));
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:43,代码来源:CustomerRevenueShareDetails.java

示例15: sumMarketplaceRevenue

public void sumMarketplaceRevenue(BigDecimal valueToAdd) {
    if (marketplaceRevenue == null) {
        marketplaceRevenue = BigDecimal.ZERO;
    }
    this.marketplaceRevenue = marketplaceRevenue.add(valueToAdd);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:6,代码来源:DirectRevenue.java


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