Package java.math

Examples of java.math.BigDecimal.doubleValue()


   */
  public Object getValue()
  {
    final BigDecimal dividend = (BigDecimal) dividendFunction.getValue();
    final BigDecimal divisor = (BigDecimal) divisorFunction.getValue();
    if (divisor == null || dividend == null || divisor.doubleValue() == 0)
    {
      return null;
    }
    return dividend.divide(divisor, scale, roundingMode);
  }
View Full Code Here


   */
  public Object getValue()
  {
    final BigDecimal total = (BigDecimal) totalSumFunction.getValue();

    if (total == null || total.doubleValue() == 0)
    {
      return null;
    }
    if (scaleToHundred)
    {
View Full Code Here

                    unwrapped = bigDecimal.intValue();
                } else {
                    unwrapped = bigDecimal.longValue();
                }
            } else {
                unwrapped = bigDecimal.doubleValue();
            }
        } else {
            unwrapped = n;
        }
        return unwrapped;
View Full Code Here

        }
       
        // second check, does upload exceed max size for file?
        BigDecimal maxFileMB = new BigDecimal(
                WebloggerRuntimeConfig.getProperty("uploads.file.maxsize"));
        int maxFileBytes = (int)(1024000 * maxFileMB.doubleValue());
        log.debug("max allowed file size = "+maxFileBytes);
        log.debug("attempted save file size = "+size);
        if (size > maxFileBytes) {
            messages.addError("error.upload.filemax", maxFileMB.toString());
            return false;
View Full Code Here

        }
       
        // third check, does file cause weblog to exceed quota?
        BigDecimal maxDirMB = new BigDecimal(
                WebloggerRuntimeConfig.getProperty("uploads.dir.maxsize"));
        long maxDirBytes = (long)(1024000 * maxDirMB.doubleValue());
        try {
            File uploadsDir = this.getRealFile(weblog, null);
            long userDirSize = getDirSize(uploadsDir, true);
            if (userDirSize + size > maxDirBytes) {
                messages.addError("error.upload.dirmax", maxDirMB.toString());
View Full Code Here

      }
    }
    double speedUp = durationForSequential / passResult.getDuration();
    BigDecimal bigDecimalSpeedUp = new BigDecimal(speedUp);
    bigDecimalSpeedUp.setScale(1, BigDecimal.ROUND_HALF_UP);
    row.add(bigDecimalSpeedUp.doubleValue());
  }

  protected void postProcessResultSet(TabularResultSet tabularResultSet) {
    if(tabularResultSet.getResults().size() > 0) {
      int columnSize = tabularResultSet.getResults().get(0).size();
View Full Code Here

    //stocks are equally likely to go up or down
    double percentGain = rndFloat(1) + 0.5;
    // change factor is between +/- 50%
    BigDecimal percentGainBD =
      (new BigDecimal(percentGain)).setScale(2, BigDecimal.ROUND_HALF_UP);
    if (percentGainBD.doubleValue() <= 0.0)
      percentGainBD = ONE;

    return percentGainBD;
  }
View Full Code Here

  @Override
  public void validate(FacesContext facesContext, UIComponent uiComponent, Object object) throws ValidatorException {
   
    BigDecimal valor = (BigDecimal) object;
   
    if(valor == null || valor.doubleValue() <= 0){
      throw new ValidatorException(
        new FacesMessage(
          FacesMessage.SEVERITY_ERROR,
          "Existem campos obrigatórios sem preenchimento..: ",
          "O Valor é obrigatório e deve ser maior que zero"
View Full Code Here

        } else {
            amount = BigDecimal.ZERO;
        }

        // check for required amount
        if ((ProductWorker.isAmountRequired(delegator, productId)) && (amount == null || amount.doubleValue() == 0.0)) {
            request.setAttribute("product_id", productId);
            request.setAttribute("_EVENT_MESSAGE_", UtilProperties.getMessage(resource_error, "cart.addToCart.enterAmountBeforeAddingToCart", locale));
            return "product";
        }
View Full Code Here

        //Determine where to send the browser
        if (controlDirective.equals(ERROR)) {
            return "error";
        } else {
            totalQuantity = (BigDecimal)result.get("totalQuantity");
            Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("totalQuantity", UtilFormatOut.formatQuantity(totalQuantity.doubleValue()));

            request.setAttribute("_EVENT_MESSAGE_",
                                  UtilProperties.getMessage(resource_error, "cart.add_category_defaults",
                                          messageMap, locale));
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.