Package java.math

Examples of java.math.BigDecimal.intValue()


     * an integer value, otherwise precision will be lost in this conversion.
     */
    @Override
    public Integer getInteger(Object number) {
        BigDecimal intField = (BigDecimal) number;
        return intField.intValue();
    }

    /* (non-Javadoc)
     * @see org.rhq.core.db.DatabaseType#getLong(java.lang.Object)
     *
 
View Full Code Here


     * @param value
     * @return
     */
    public int intValue(final Object value){
        final BigDecimal number = this.toNumber(value);
        return number.intValue();
    }
    // ------------------------------------------------------------------------
    //                      p r i v a t e
    // ------------------------------------------------------------------------

View Full Code Here

            } else if ("Float".equals(type) || "java.lang.Float".equals(type)) {
                return Float.valueOf(bigDec.floatValue());
            } else if ("Long".equals(type) || "java.lang.Long".equals(type)) {
                return Long.valueOf(bigDec.longValue());
            } else if ("Integer".equals(type) || "java.lang.Integer".equals(type)) {
                return Integer.valueOf(bigDec.intValue());
            } else if ("List".equals(type) || "java.util.List".equals(type)) {
                List<BigDecimal> tempList = FastList.newInstance();
                tempList.add(bigDec);
                return tempList;
            } else if ("Set".equals(type) || "java.util.Set".equals(type)) {
View Full Code Here

        BigDecimal baseQuantity = this.getQuantity();
        int thisIndex = cart.items().indexOf(this);
        List newItems = new ArrayList();

        if (baseQuantity.compareTo(BigDecimal.ONE) > 1) {
            for (int i = 1; i < baseQuantity.intValue(); i++) {
                // clone the item
                ShoppingCartItem item = new ShoppingCartItem(this);

                // set the new item's quantity
                item.setQuantity(BigDecimal.ONE, dispatcher, cart, false);
View Full Code Here

            Debug.logError(e, "updateProductStocktake failed getting inventory counts", module);
            return ServiceUtil.returnError("updateProductStocktake failed getting inventory counts");
        }
        int atp = ((BigDecimal)invAvailability.get("availableToPromiseTotal")).intValue();
        int qoh = ((BigDecimal)invAvailability.get("quantityOnHandTotal")).intValue();
        if ( quantity.intValue() == qoh ) {
            // No change required.
            Debug.logInfo("updateProductStocktake No change required quantity("+quantity+") = qoh("+qoh+")", module);
            return ServiceUtil.returnSuccess();
        }
View Full Code Here

            } else if ("Float".equals(type) || "java.lang.Float".equals(type)) {
                return Float.valueOf(bigDec.floatValue());
            } else if ("Long".equals(type) || "java.lang.Long".equals(type)) {
                return Long.valueOf(bigDec.longValue());
            } else if ("Integer".equals(type) || "java.lang.Integer".equals(type)) {
                return Integer.valueOf(bigDec.intValue());
            } else if ("List".equals(type) || "java.util.List".equals(type)) {
                List<BigDecimal> tempList = FastList.newInstance();
                tempList.add(bigDec);
                return tempList;
            } else if ("Set".equals(type) || "java.util.Set".equals(type)) {
View Full Code Here

        BigDecimal baseQuantity = this.getQuantity();
        int thisIndex = cart.items().indexOf(this);
        List newItems = new ArrayList();

        if (baseQuantity.compareTo(BigDecimal.ONE) > 1) {
            for (int i = 1; i < baseQuantity.intValue(); i++) {
                // clone the item
                ShoppingCartItem item = new ShoppingCartItem(this);

                // set the new item's quantity
                item.setQuantity(BigDecimal.ONE, dispatcher, cart, false);
View Full Code Here

            resultValue = resultValue.setScale(0, roundingMode);
            resultObj = Long.valueOf(resultValue.longValue());
            break;
        case TYPE_INTEGER:
            resultValue = resultValue.setScale(0, roundingMode);
            resultObj = Integer.valueOf(resultValue.intValue());
            break;
        case TYPE_STRING:
            // run the decimal-formatting
            if (df != null && resultValue.compareTo(ZERO) > 0) {
                resultObj = df.format(resultValue);
View Full Code Here

        ///////////////////
        BigDecimal entryPrice = portfolio.position("msft").openPrice();
        assertTrue(null == entryPrice || entryPrice.compareTo(successLimit)<=0);

        BigDecimal shares = new BigDecimal("10");
        assertEquals(shares.intValue(), portfolio.position("msft").quantity().intValue());

        BigDecimal openEquity = entryPrice.multiply(shares);
        BigDecimal expectedBuyPower = new BigDecimal("9980").subtract(commission.add(openEquity));

        buyPower = sentryService.buyPower();
View Full Code Here

        ///////////////////
        BigDecimal entryPrice = portfolio.position("msft").openPrice();
        assertTrue(entryPrice == null || entryPrice.compareTo(successLimit)<=0);

        BigDecimal shares = new BigDecimal("10");
        assertEquals(shares.intValue(), portfolio.position("msft").quantity().intValue());

        BigDecimal openEquity = entryPrice.multiply(shares);
        BigDecimal expectedBuyPower = new BigDecimal("9980").subtract(commission.add(openEquity));

        buyPower = sentryService.buyPower();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.