Examples of abs()


Examples of java.math.BigDecimal.abs()

        }

        if ((returnAmountByOrder != null) && (returnAmountByOrder.keySet() != null)) {
            for(String orderId : returnAmountByOrder.keySet()) {
                BigDecimal returnAmount = returnAmountByOrder.get(orderId);
                if (returnAmount.abs().compareTo(new BigDecimal("0.000001")) < 0) {
                    Debug.logError("Order [" + orderId + "] refund amount[ " + returnAmount + "] less than zero", module);
                    return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,
                            "OrderReturnTotalCannotLessThanZero", locale));
                }
                OrderReadHelper helper = new OrderReadHelper(delegator, orderId);
View Full Code Here

Examples of java.math.BigDecimal.abs()

    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }

    final BigDecimal num = NumberUtil.getAsBigDecimal(result);
    return new TypeValuePair(NumberType.GENERIC_NUMBER, num.abs());
  }

  public String getCanonicalName()
  {
    return "ABS";
View Full Code Here

Examples of java.math.BigDecimal.abs()

    if (useAbsoluteValue)
    {
      if (n instanceof BigDecimal)
      {
        final BigDecimal td = (BigDecimal) n;
        value = td.abs();
      }
      else
      {
        final BigDecimal td = new BigDecimal(n.toString());
        value = td.abs();
View Full Code Here

Examples of java.math.BigDecimal.abs()

        value = td.abs();
      }
      else
      {
        final BigDecimal td = new BigDecimal(n.toString());
        value = td.abs();
      }
    }
    else
    {
      value = n;
View Full Code Here

Examples of java.math.BigDecimal.abs()

            BigDecimal quantity = (BigDecimal)context.get("quantity");
            quantity = quantity == null ? BigDecimal.ONE : quantity;
            boolean negative = amount.signum() < 0;
            // Ensure that price and quantity are positive since the terms may not be linear.
            amount = amount.abs();
            quantity = quantity.abs();
            String productId = (String) context.get("productId");
            String invoiceItemTypeId = (String) context.get("invoiceItemTypeId");

            // Collect agreementItems applicable to this orderItem/returnItem
            // TODO: partyIds should be part of this query!
View Full Code Here

Examples of java.math.BigDecimal.abs()

                        // If the absolute invoiced amount >= the abs of the adjustment amount, the full amount has already been invoiced,
                        //  so skip this adjustment
                        if (adj.get("amount") == null) { // JLR 17/4/7 : fix a bug coming from POS in case of use of a discount (on item(s) or sale, item(s) here) and a cash amount higher than total (hence issuing change)
                            continue;
                        }
                        if (adjAlreadyInvoicedAmount.abs().compareTo(adj.getBigDecimal("amount").setScale(invoiceTypeDecimals, rounding).abs()) > 0) {
                            continue;
                        }

                        BigDecimal amount = ZERO;
                        if (adj.get("amount") != null) {
View Full Code Here

Examples of java.math.BigDecimal.abs()

                // If the absolute invoiced amount >= the abs of the adjustment amount, the full amount has already been invoiced,
                //  so skip this adjustment
                if (null == adj.get("amount")) { // JLR 17/4/7 : fix a bug coming from POS in case of use of a discount (on item(s) or sale, sale here) and a cash amount higher than total (hence issuing change)
                    continue;
                }
                if (adjAlreadyInvoicedAmount.abs().compareTo(adj.getBigDecimal("amount").setScale(invoiceTypeDecimals, rounding).abs()) > 0) {
                    continue;
                }

                if ("SHIPPING_CHARGES".equals(adj.getString("orderAdjustmentTypeId"))) {
                    shipAdjustments.put(adj, adjAlreadyInvoicedAmount);
View Full Code Here

Examples of java.math.BigDecimal.abs()

        if ((returnAmountByOrder != null) && (returnAmountByOrder.keySet() != null)) {
            Iterator orderIterator = returnAmountByOrder.keySet().iterator();
            while (orderIterator.hasNext()) {
                String orderId = (String) orderIterator.next();
                BigDecimal returnAmount = (BigDecimal) returnAmountByOrder.get(orderId);
                if (returnAmount.abs().compareTo(new BigDecimal("0.000001")) < 0) {
                    Debug.logError("Order [" + orderId + "] refund amount[ " + returnAmount + "] less than zero", module);
                    return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderReturnTotalCannotLessThanZero", locale));
                }
                OrderReadHelper helper = new OrderReadHelper(delegator, orderId);
                BigDecimal grandTotal = helper.getOrderGrandTotal();
View Full Code Here

Examples of java.math.BigInteger.abs()

            bytes = fis.read(buffer);
         }
         fis.close();
         byte[] digest = md5.digest();
         BigInteger bi = new BigInteger(-1, digest);
         bi = bi.abs();
         md5Digest = bi.toString(16);
         System.out.println(file+", md5: "+md5Digest);
      }

      public int compareTo(Object o)
View Full Code Here

Examples of java.math.BigInteger.abs()

        for (int k = -2; k < 2; ++k) {
            // find another pair q, r such that a = q b + r
            BigInteger bigK = BigInteger.valueOf(k);
            BigInteger q = q0.subtract(bigK);
            BigInteger r = r0.add(bigK.multiply(bigB));
            if (r.abs().compareTo(bigB.abs()) < 0 &&
                (r.longValue() == 0l || ((r.longValue() ^ b) & 0x8000000000000000l) == 0)) {
                if (fd.compareTo(q) < 0) {
                    fd = q;
                }
            }
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.