當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。