List of usage examples for java.lang Double doubleValue
@HotSpotIntrinsicCandidate public double doubleValue()
From source file:org.eclipse.jubula.client.ui.views.TestresultSummaryView.java
/** * @param tableViewer the tableViewer/*from w ww . jav a2 s .co m*/ */ private void addMonitoringValueColumn(TableViewer tableViewer) { TableViewerColumn column = new TableViewerColumn(tableViewer, SWT.NONE); column.getColumn().setWidth(80); column.getColumn().setImage(IconConstants.INFO_IMAGE); column.getColumn().setText(MONITORING_VALUE); column.getColumn().setMoveable(true); column.setLabelProvider(new TestresultSummaryViewColumnLabelProvider() { public String getText(Object element) { String monitoringValue = ((ITestResultSummaryPO) element).getMonitoringValue(); String monitoringId = ((ITestResultSummaryPO) element).getInternalMonitoringId(); String monitoringValueTyp = ((ITestResultSummaryPO) element).getMonitoringValueType(); if (monitoringId != null && monitoringValue != null) { if (monitoringValueTyp.equals(MonitoringConstants.PERCENT_VALUE)) { DecimalFormat n = new DecimalFormat("0.0#%"); //$NON-NLS-1$ Double doubleValue = Double.valueOf(monitoringValue); return StringUtils.defaultString(n.format(doubleValue.doubleValue())); } if (monitoringValueTyp.equals(MonitoringConstants.DOUBLE_VALUE)) { return String.format(Locale.getDefault(), "%f", monitoringValue); //$NON-NLS-1$ } return StringUtils.defaultString(monitoringValue); } return Messages.TestresultSummaryMonitoringValueNotAvailable; } }); createMenuItem(m_headerMenu, column.getColumn()); new ColumnViewerSorter(tableViewer, column) { @Override protected int doCompare(Viewer viewer, Object e1, Object e2) { return getCommonsComparator().compare(((ITestResultSummaryPO) e1).getMonitoringValue(), ((ITestResultSummaryPO) e2).getMonitoringValue()); } }; }
From source file:com.encens.khipus.service.production.RawMaterialPayRollServiceBean.java
private Map<Date, Double> createMapOfDifferencesWeights(RawMaterialPayRoll rawMaterialPayRoll) { List<Object[]> datas = findDifferencesWeights("RawMaterialPayRoll.differenceRawMaterialBetweenDates", rawMaterialPayRoll);//from w w w .ja v a 2 s . co m Map<Date, Double> differences = new HashMap<Date, Double>(); for (Object[] obj : datas) { Date date = (Date) obj[0]; Double receivedAmount = (Double) obj[1]; Double weightedAmount = (Double) obj[2]; /*Double diffs = RoundUtil.getRoundValue((receivedAmount.doubleValue() * rawMaterialPayRoll.getUnitPrice()),2, RoundUtil.RoundMode.SYMMETRIC) - RoundUtil.getRoundValue((weightedAmount.doubleValue() * rawMaterialPayRoll.getUnitPrice()),2, RoundUtil.RoundMode.SYMMETRIC);*/ Double diffs = weightedAmount.doubleValue() * rawMaterialPayRoll.getUnitPrice() - receivedAmount.doubleValue() * rawMaterialPayRoll.getUnitPrice(); //Double diffs = (receivedAmount.doubleValue() * rawMaterialPayRoll.getUnitPrice()) - (weightedAmount.doubleValue() * rawMaterialPayRoll.getUnitPrice()); differences.put(date, diffs); } return differences; }
From source file:org.hyperic.hq.measurement.server.session.AvailabilityManagerImpl.java
@Transactional(readOnly = true) public Map<Integer, double[]> getAggregateDataAndAvailUpByMetric(final List<Integer> mids, long begin, long end) throws SQLException { Map<Integer, Double> avails = availabilityDataDAO.findAggregateAvailabilityUp(mids, begin, end); Map<Integer, double[]> msmtToAvg = new HashMap<Integer, double[]>(); Set<Integer> unavailMsmtsIds = new HashSet<Integer>(mids); if (null != avails) { for (Map.Entry<Integer, Double> availIdToAvg : avails.entrySet()) { Integer availId = availIdToAvg.getKey(); if (!unavailMsmtsIds.remove(availId)) { throw new RuntimeException( "unknown availability measurement returned while querying for availability data"); }/*from w w w . j a va 2s .c o m*/ Double availAvg = availIdToAvg.getValue(); double[] data = new double[IND_TOTAL_TIME + 1]; data[IND_AVG] = availAvg.doubleValue(); msmtToAvg.put(availId, data); } } // resources which were not up in the time frame, wouldn't be returned, and have to be initialized final double[] availDownData = new double[IND_TOTAL_TIME + 1]; for (Integer unavailMsmtId : unavailMsmtsIds) { msmtToAvg.put(unavailMsmtId, availDownData); } return msmtToAvg; }
From source file:org.opentaps.amazon.product.AmazonProductServices.java
/** * Posts inventory data relating to any new or changed AmazonProductInventory records to Amazon. * @param dctx a <code>DispatchContext</code> value * @param context the service context <code>Map</code> * @return the service response <code>Map</code> */// www .jav a2 s . c o m public static Map<String, Object> publishProductInventoryToAmazon(DispatchContext dctx, Map<String, Object> context) { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); String prodId = (String) context.get("productId"); boolean postActualInventory = AmazonConstants.postActualInventory; try { List<EntityCondition> conditions = UtilMisc.<EntityCondition>toList(EntityCondition.makeCondition( "statusId", EntityOperator.IN, Arrays.asList(AmazonConstants.statusProductCreated, AmazonConstants.statusProductError, AmazonConstants.statusProductChanged))); if (UtilValidate.isNotEmpty(prodId)) { conditions.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, prodId)); } TransactionUtil.begin(); EntityListIterator amazonInventoryIt = delegator.findListIteratorByCondition("AmazonProductInventory", EntityCondition.makeCondition(conditions, EntityOperator.AND), null, Arrays.asList("productId")); TransactionUtil.commit(); GenericValue productStore = delegator.findByPrimaryKey("ProductStore", UtilMisc.toMap("productStoreId", AmazonConstants.productStoreId)); long messageId = 1; Map<GenericValue, String> invalidAmazonInventory = new HashMap<GenericValue, String>(); List<GenericValue> validAmazonInventory = new ArrayList<GenericValue>(); Document inventoryDoc = AmazonConstants.soapClient .createDocumentHeader(AmazonConstants.messageTypeInventory); GenericValue amazonProductInventory = null; while ((amazonProductInventory = amazonInventoryIt.next()) != null) { String errMessage = null; // Check that the failure threshold has not been reached previously if (AmazonConstants.productPostRetryThreshold <= amazonProductInventory.getLong("postFailures") .intValue()) { String errorLog = UtilProperties.getMessage(AmazonConstants.errorResource, "AmazonError_PostImageAttemptsOverThreshold", UtilMisc.<String, Object>toMap("productId", amazonProductInventory.getString("productId"), "threshold", AmazonConstants.productPostRetryThreshold), locale); Debug.logInfo(errorLog, MODULE); continue; } // Check if this product was exported and acknowledged earlier if (delegator.findCountByAnd("AmazonProduct", UtilMisc.toMap("productId", amazonProductInventory.getString("productId"), "statusId", AmazonConstants.statusProductPosted, "ackStatusId", AmazonConstants.statusProductAckRecv)) != 1) { String errorLog = UtilProperties.getMessage(AmazonConstants.errorResource, "AmazonError_PostInventoryNonExistentProduct", UtilMisc.toMap("productId", amazonProductInventory.getString("productId")), locale); Debug.logError(errorLog, MODULE); continue; } // Ignore products marked deleted if (AmazonUtil.isAmazonProductDeleted(delegator, amazonProductInventory.getString("productId"))) { String errorLog = UtilProperties.getMessage(AmazonConstants.errorResource, "AmazonError_IgnoringProductInventory_ProductDeleted", UtilMisc.toMap("productId", amazonProductInventory.getString("productId")), locale); Debug.logError(errorLog, MODULE); continue; } String upc = null; if (AmazonConstants.requireUpcCodes || AmazonConstants.useUPCAsSKU) { // Establish and validate the UPC upc = getProductUPC(delegator, amazonProductInventory.getString("productId"), locale); if (UtilValidate.isEmpty(upc) && AmazonConstants.requireUpcCodes) { errMessage = AmazonUtil.compoundError(errMessage, UtilProperties.getMessage(AmazonConstants.errorResource, "AmazonError_MissingCodeUPC", UtilMisc.toMap("productId", amazonProductInventory.getString("productId")), locale)); } else if (UtilValidate.isNotEmpty(upc) && !UtilProduct.isValidUPC(upc)) { errMessage = AmazonUtil.compoundError(errMessage, UtilProperties.getMessage(AmazonConstants.errorResource, "AmazonError_InvalidCodeUPC", UtilMisc.toMap("productId", amazonProductInventory.getString("productId")), locale)); } } // Establish and validate the SKU String sku = getProductSKU(delegator, amazonProductInventory, upc); if (UtilValidate.isEmpty(sku) && !AmazonConstants.useUPCAsSKU) { errMessage = AmazonUtil.compoundError(errMessage, UtilProperties.getMessage(AmazonConstants.errorResource, "AmazonError_NoRequiredParameter", UtilMisc.toMap("parameterName", "SKU", "productName", amazonProductInventory.getString("productId")), locale)); } if (UtilValidate.isNotEmpty(errMessage)) { invalidAmazonInventory.put(amazonProductInventory, errMessage); continue; } Element message = UtilXml.addChildElement(inventoryDoc.getDocumentElement(), "Message", inventoryDoc); UtilXml.addChildElementValue(message, "MessageID", "" + messageId, inventoryDoc); UtilXml.addChildElementValue(message, "OperationType", "Update", inventoryDoc); Element invElement = UtilXml.addChildElement(message, "Inventory", inventoryDoc); UtilXml.addChildElementValue(invElement, "SKU", sku, inventoryDoc); Double atp = new Double(0); TransactionUtil.begin(); Map<String, Object> serviceResult = dispatcher.runSync("getInventoryAvailableByFacility", UtilMisc.toMap("productId", amazonProductInventory.getString("productId"), "facilityId", productStore.getString("inventoryFacilityId"), "userLogin", userLogin)); TransactionUtil.commit(); if (serviceResult.containsKey("availableToPromiseTotal")) { atp = (Double) serviceResult.get("availableToPromiseTotal"); } // Amazon doesn't like inventory values < 0 if (atp.doubleValue() < 0) { atp = new Double(0); } // Amazon doesn't like inventory values > 99,999,999 if (atp.doubleValue() > 99999999) { postActualInventory = false; } GenericValue productFacility = delegator.findByPrimaryKey("ProductFacility", UtilMisc.toMap("productId", amazonProductInventory.getString("productId"), "facilityId", productStore.getString("inventoryFacilityId"))); // Post inventory as Available if ProductFacility.minimumStock > 0 and AmazonConstants.inventoryIsAvailableIfMinimumStock, even if there is no actual inventory boolean available = atp.intValue() > 0; if ((!available) && AmazonConstants.inventoryIsAvailableIfMinimumStock && UtilValidate.isNotEmpty(productFacility) && UtilValidate.isNotEmpty(productFacility.getDouble("minimumStock")) && productFacility.getDouble("minimumStock").doubleValue() > 0) { postActualInventory = false; available = true; } if (postActualInventory) { UtilXml.addChildElementValue(invElement, "Quantity", "" + atp.intValue(), inventoryDoc); } else { UtilXml.addChildElementValue(invElement, "Available", available ? "true" : "false", inventoryDoc); } if (AmazonConstants.postInventoryDaysToShip && UtilValidate.isNotEmpty(productFacility) && UtilValidate.isNotEmpty(productFacility.get("daysToShip"))) { long daysToShip = productFacility.getLong("daysToShip").longValue(); // Amazon doesn't like FulfillmentLatency > 30 if (daysToShip > 30) { daysToShip = 30; } // Amazon doesn't like FulfillmentLatency <= 0 if (daysToShip > 0) { UtilXml.addChildElementValue(invElement, "FulfillmentLatency", "" + daysToShip, inventoryDoc); } } amazonProductInventory.set("acknowledgeMessageId", "" + messageId); validAmazonInventory.add(amazonProductInventory); messageId++; if (messageId % 500 == 0) Debug.logInfo(UtilProperties.getMessage(AmazonConstants.errorResource, "AmazonError_Processed_Records_Inventory", UtilMisc.toMap("count", messageId), locale), MODULE); } amazonInventoryIt.close(); LinkedHashMap<GenericValue, String> emailErrorMessages = new LinkedHashMap<GenericValue, String>(); if (UtilValidate.isEmpty(validAmazonInventory)) { String infoMessage = UtilProperties.getMessage(AmazonConstants.errorResource, "AmazonError_PostNoNewProductInventory", locale); Debug.logInfo(infoMessage, MODULE); } else { boolean success = true; String postErrorMessage = null; long processingDocumentId = -1; try { String xml = UtilXml.writeXmlDocument(inventoryDoc); Debug.logVerbose(xml, MODULE); Writer writer = new OutputStreamWriter( new FileOutputStream(AmazonConstants.xmlOutputLocation + "AmazonProductInventoryFeed_" + AmazonConstants.xmlOutputDateFormat.format(new Date()) + ".xml"), "UTF-8"); writer.write(xml); writer.close(); processingDocumentId = AmazonConstants.soapClient.postProductInventory(xml); Debug.logInfo(UtilProperties.getMessage(AmazonConstants.errorResource, "AmazonError_ProcessingDocumentId_Inventory", UtilMisc.toMap("processingDocumentId", processingDocumentId), locale), MODULE); } catch (RemoteException e) { success = false; postErrorMessage = e.getMessage(); List<String> productIds = EntityUtil.getFieldListFromEntityList(validAmazonInventory, "productId", true); String errorLog = UtilProperties.getMessage(AmazonConstants.errorResource, "AmazonError_PostInventoryError", UtilMisc.toMap("productIds", productIds, "errorMessage", postErrorMessage), locale); Debug.logError(errorLog, MODULE); } // Store operational data of the post attempt for (GenericValue validAmazonInv : validAmazonInventory) { validAmazonInv.set("statusId", success ? AmazonConstants.statusProductPosted : AmazonConstants.statusProductError); validAmazonInv.set("postTimestamp", UtilDateTime.nowTimestamp()); validAmazonInv.set("postErrorMessage", success ? null : postErrorMessage); if (!success) { validAmazonInv.set("postFailures", validAmazonInv.getLong("postFailures") + 1); } validAmazonInv.set("processingDocumentId", success ? processingDocumentId : null); validAmazonInv.set("ackStatusId", AmazonConstants.statusProductNotAcked); validAmazonInv.set("acknowledgeTimestamp", null); validAmazonInv.set("acknowledgeErrorMessage", null); validAmazonInv.store(); if (AmazonConstants.sendErrorEmails && !success) { emailErrorMessages.put(validAmazonInv, postErrorMessage); } } } for (GenericValue invalidAmazonInv : invalidAmazonInventory.keySet()) { String errorMessage = invalidAmazonInventory.get(invalidAmazonInv); invalidAmazonInv.set("statusId", AmazonConstants.statusProductError); invalidAmazonInv.set("postTimestamp", UtilDateTime.nowTimestamp()); invalidAmazonInv.set("postErrorMessage", errorMessage); invalidAmazonInv.set("postFailures", invalidAmazonInv.getLong("postFailures") + 1); invalidAmazonInv.set("processingDocumentId", null); invalidAmazonInv.set("ackStatusId", AmazonConstants.statusProductNotAcked); invalidAmazonInv.set("acknowledgeTimestamp", null); invalidAmazonInv.set("acknowledgeErrorMessage", null); invalidAmazonInv.store(); if (AmazonConstants.sendErrorEmails) { emailErrorMessages.put(invalidAmazonInv, errorMessage); } } if (AmazonConstants.sendErrorEmails && UtilValidate.isNotEmpty(emailErrorMessages)) { AmazonUtil.sendBulkErrorEmail(dispatcher, userLogin, emailErrorMessages, UtilProperties.getMessage(AmazonConstants.errorResource, "AmazonError_ErrorEmailSubject_PostInventory", AmazonConstants.errorEmailLocale), AmazonConstants.errorEmailScreenUriProducts); } } catch (GenericEntityException gee) { UtilMessage.createAndLogServiceError(gee, locale, MODULE); } catch (IOException ioe) { UtilMessage.createAndLogServiceError(ioe, locale, MODULE); } catch (GenericServiceException gse) { UtilMessage.createAndLogServiceError(gse, locale, MODULE); } return ServiceUtil.returnSuccess(); }
From source file:er.extensions.foundation.ERXProperties.java
/** * <div class="en">/*from w ww .j a va2s .c o m*/ * Cover method for returning a double for a * given system property with a default value. * </div> * * <div class="ja"> * ?? double ???? * </div> * * @param s <div class="en">system property</div> * <div class="ja"></div> * @param defaultValue <div class="en">default value</div> * <div class="ja"></div> * * @return <div class="en">double value of the system property or the default value</div> * <div class="ja">double </div> */ public static double doubleForKeyWithDefault(final String s, final double defaultValue) { final String propertyName = getApplicationSpecificPropertyName(s); double value; Object cachedValue = _cache.get(propertyName); if (UndefinedMarker.equals(cachedValue)) { value = defaultValue; } else if (cachedValue instanceof Double) { value = ((Double) cachedValue).doubleValue(); } else { Double objValue = ERXValueUtilities.DoubleValueWithDefault(ERXSystem.getProperty(propertyName), null); _cache.put(s, objValue == null ? (Object) UndefinedMarker : objValue); if (objValue == null) { value = defaultValue; } else { value = objValue.doubleValue(); } if (retainDefaultsEnabled() && objValue == null) { System.setProperty(propertyName, Double.toString(defaultValue)); } } return value; }
From source file:com.aurel.track.exchange.msProject.exporter.MsProjectExporterBL.java
/** * Gets the sum of the works from the list * // ww w . ja v a2 s . co m * @param costBeanList * @return */ private static double getSumOfActualWorks(List<TCostBean> costBeanList) { double actualHours = 0.0; if (costBeanList != null) { Iterator<TCostBean> iterator = costBeanList.iterator(); while (iterator.hasNext()) { TCostBean costBean = iterator.next(); Double hours = costBean.getHours(); if (hours != null) { actualHours += hours.doubleValue(); } } } return actualHours; }
From source file:com.nec.harvest.controller.SuihController.java
/** * Calculator total data 12 month and fill 3 month of quarter * /*from www . j av a 2 s .c om*/ * @param listSuisYear * Data profit and loss * @param monthly * month * @param businessDay * a day business * @param mapBudgetPerformance * Map at023 * @param mapInventory * Map at015 * @param quarter * a current quarter * @param model */ private void calculateSuih(Map<String, List<VJiseki>> mapSuisYear, Date monthly, Date businessDay, Map<String, BudgetPerformanceBean> mapBudgetPerformance, Map<String, Double> mapInventory, int quarter, Model model) { logger.info("Begin calculator suih for 3 month and total of year"); final String TOTAL_QUARTER = "totalQuarter"; Integer no12 = null; // _??__?? Integer no14 = null; // _?__??) Integer no16 = null; // ___?? Integer no18 = null; // _??__?? Integer no20 = null; // ___?? Integer no22 = null; // _?__?? Integer no25 = null; // ___?? Double no26 = null; // ___ Integer no29 = null; // __?? Double no30 = null; // __ Integer no33 = null; // __?? Double no34 = null; // __ Integer no37 = null; // __?? Double no38 = null; // __ int index = 0; SuisMonthBean suisMonthly = null; String valueBlank = "1"; if (mapSuisYear != null && mapSuisYear.size() > 0) { for (Map.Entry<String, List<VJiseki>> entry : mapSuisYear.entrySet()) { String key = entry.getKey(); List<VJiseki> listJiseki = entry.getValue(); try { String getsudo = key; Date yearmonth = DateFormatUtil.parse(getsudo, DateFormat.DATE_WITHOUT_DAY); double taxRate = 0d; try { taxRate = consumptionTaxRateService.findActualTaxRateByDate(yearmonth); } catch (IllegalArgumentException | ObjectNotFoundException ex) { logger.warn(ex.getMessage()); } catch (ServiceException ex) { logger.error(ex.getMessage(), ex); // ??????????? model.addAttribute(ERROR_MESSAGE, getSystemError()); model.addAttribute(ERROR, true); } Integer no11 = null; // _??_n1n3_? Integer no15 = null; // __n1n3_???? Integer no13 = null; // _?_n1n3_? Integer no17 = null; // _??_n1n3_?? Integer no19 = null; // __n1n3_?? Integer no21 = null; // _?_n1n3_?? Integer no23 = null; // __n1n3_?? Double no24 = null; // __n1n3_ Integer no27 = null; // _n1n3_?? Double no28 = null; // _n1n3_ Integer no31 = null; // _n1n3_?? Double no32 = null; // _n1n3_ Integer no35 = null; // _n1n3_?? Double no36 = null; // _n1n3_ Double no19Percent = null; if (yearmonth.after(monthly)) { int days = DateUtil.getNumberOfDays(yearmonth, businessDay); if (CollectionUtils.isNotEmpty(listJiseki)) { for (VJiseki jiseki : listJiseki) { // for list together month int tmp = 0; String strValueBlank = ""; int daysInMonth = DateUtil.getActualMaximumOfMonth(businessDay); logger.info("Total days of month {} ", daysInMonth); // // NO11 ???????? ? ????? ??1,000?????? // if (jiseki.getUriSkKG() != null) { // double uriSkKG = jiseki.getUriSkKG().doubleValue(); // tmp = (int) Math.floor((uriSkKG - Math.floor(uriSkKG / (100 + taxRate) * taxRate)) / 1000); // no11 = (no11 == null) ? 0 : no11.intValue(); // no11 = no11 + tmp; // } // Modified by SONDN 2014/12/22: Update SPEC 20141222 // NO11 ???????? ? ????? ??1,000?????? if (jiseki.getUriSkKG() != null || jiseki.getKtSkKG() != null || jiseki.getIdoSkKGU() != null || jiseki.getIdoSkKGH() != null) { Double uriSkKG = jiseki.getUriSkKG(); Double ktSkKG = jiseki.getKtSkKG(); Double idoSkKGU = jiseki.getIdoSkKGU(); Double idoSkKGH = jiseki.getIdoSkKGH(); double step1 = uriSkKG == null ? 0 : uriSkKG - Math.floor((uriSkKG / (100 + taxRate)) * taxRate); double step2 = ktSkKG == null ? 0 : ktSkKG; int tmpDays = DateUtil.getNumberOfDays(yearmonth, businessDay); if (tmpDays > 0) { step2 = (step2 / daysInMonth) * tmpDays; } double step3 = idoSkKGU == null ? 0 : idoSkKGU; double step4 = idoSkKGH == null ? 0 : idoSkKGH; tmp = (int) Math.floor((step1 + step2 + step3 - step4) / 1000); no11 = (no11 == null) ? 0 : no11.intValue(); no11 = no11 + tmp; } // (1) ? ???? double temp1 = 0d; if (jiseki.getUriKrKG() != null) { double uriKrKG = jiseki.getUriKrKG().doubleValue(); temp1 = Math.floor(uriKrKG - Math.floor(uriKrKG / (100 + taxRate) * taxRate)); } else { strValueBlank = strValueBlank.concat(valueBlank);// 1 } // (2) ? ??? double temp2 = 0d; if (jiseki.getKtKrKG() != null) { temp2 = jiseki.getKtKrKG().doubleValue(); } else { strValueBlank = strValueBlank.concat(valueBlank);// 11 } if (days > 0) { temp1 = (temp1 / daysInMonth) * days; temp2 = (temp2 / daysInMonth) * days; } else if (days == 0) { strValueBlank = "11"; } // NO13 ????????(1) + (2) if (!strValueBlank.equals("11")) { no13 = (no13 == null) ? 0 : no13.intValue(); tmp = (int) Math.floor((temp1 + temp2) / 1000); no13 = no13 + tmp; } // ???????? strValueBlank = ""; double ktsrkg = 0d; // (1) ? ? if (jiseki.getKtSrKG() != null) { ktsrkg = jiseki.getKtSrKG().doubleValue(); if (days >= 0) { ktsrkg = (ktsrkg / daysInMonth) * days; } } else { strValueBlank = strValueBlank.concat(valueBlank);// 1 } // (2) ? ?? double kgcSrKG = 0d; if (jiseki.getKgcSrKG() != null) { kgcSrKG = jiseki.getKgcSrKG().doubleValue(); kgcSrKG = Math.floor(kgcSrKG - Math.floor(kgcSrKG / (100 + taxRate) * taxRate)); } else { strValueBlank = strValueBlank.concat(valueBlank);// 11 } // (3) ? ?????? double idoSrkGU = 0d; if (jiseki.getIdoSrKGU() != null) { idoSrkGU = jiseki.getIdoSrKGU().doubleValue(); } else { strValueBlank = strValueBlank.concat(valueBlank);// 111 } // (4) ? ?? double idoSrkGH = 0d; if (jiseki.getIdoSrKGH() != null) { idoSrkGH = jiseki.getIdoSrKGH().doubleValue(); } else { strValueBlank = strValueBlank.concat(valueBlank);// 1111 } // (5) ? ? double knSrKG = 0d; if (jiseki.getKnSrKG() != null) { knSrKG = jiseki.getKnSrKG().doubleValue(); } else { strValueBlank = strValueBlank.concat(valueBlank);// 11111 } // (1) + (2) + (3) + (4) - (5) if (!strValueBlank.equals("11111")) { tmp = (int) Math .floor((knSrKG + ktsrkg + kgcSrKG + idoSrkGU - idoSrkGH) / 1000); no19 = (no19 == null) ? 0 : no19.intValue(); no19 = no19 + tmp; } // NO27 ???????? strValueBlank = ""; // (1) ? ?? double ktJkKG = 0d; if (jiseki.getKtJkKG() != null) { ktJkKG = jiseki.getKtJkKG().doubleValue(); if (days >= 0) { ktJkKG = (ktJkKG / daysInMonth) * days; } } else { strValueBlank = strValueBlank.concat(valueBlank);// 1 } // (2) ? ? double jkJkKG = 0d; if (jiseki.getJkJkKG() != null) { jkJkKG = jiseki.getJkJkKG().doubleValue(); } else { strValueBlank = strValueBlank.concat(valueBlank);// 11 } // (3) ? ?????? double kgcJkKG = 0d; if (jiseki.getKgcJkKG() != null) { kgcJkKG = jiseki.getKgcJkKG().doubleValue(); kgcJkKG = Math.floor(kgcJkKG - Math.floor(kgcJkKG / (100 + taxRate) * taxRate)); } else { strValueBlank = strValueBlank.concat(valueBlank);// 111 } // (4) ? ?? double idoJkKGU = 0d; if (jiseki.getIdoJkKGU() != null) { idoJkKGU = jiseki.getIdoJkKGU().doubleValue(); } else { strValueBlank = strValueBlank.concat(valueBlank);// 1111 } // (5) ? ? double idoJkKGH = 0d; if (jiseki.getIdoJkKGH() != null) { idoJkKGH = jiseki.getIdoJkKGH().doubleValue(); } else { strValueBlank = strValueBlank.concat(valueBlank);// 11111 } // (6) ? ?? double helpJkKGU = 0d; if (jiseki.getHelpJkKGU() != null) { helpJkKGU = jiseki.getHelpJkKGU().doubleValue(); } else { strValueBlank = strValueBlank.concat(valueBlank);// 111111 } // (7) ? ? double helpJkKGH = 0d; if (jiseki.getHelpJkKGH() != null) { helpJkKGH = jiseki.getHelpJkKGH().doubleValue(); } else { strValueBlank = strValueBlank.concat(valueBlank);// 1111111 } // (1) + (2) + (3) + (4) - (5) + (6) - (7) if (!strValueBlank.equals("1111111")) { tmp = (int) Math.floor((ktJkKG + jkJkKG + kgcJkKG + idoJkKGU - idoJkKGH + helpJkKGU - helpJkKGH) / 1000); no27 = (no27 == null) ? 0 : no27.intValue(); no27 = no27 + tmp; } // NO31 ???????? // (1) ? ?? strValueBlank = ""; double ktKhKG = 0d; if (jiseki.getKtKhKG() != null) { ktKhKG = jiseki.getKtKhKG().doubleValue(); if (days >= 0) { ktKhKG = ktKhKG / daysInMonth * days; } } else { strValueBlank = strValueBlank.concat(valueBlank);// 1 } // (2) ? ? double knKhKG = 0d; if (jiseki.getKnKhKG() != null) { knKhKG = jiseki.getKnKhKG().doubleValue(); } else { strValueBlank = strValueBlank.concat(valueBlank);// 11 } // (3) ? ?????? double kgcKhKG = 0d; if (jiseki.getKgcKhKG() != null) { kgcKhKG = jiseki.getKgcKhKG().doubleValue(); kgcKhKG = Math.floor(kgcKhKG - Math.floor(kgcKhKG / (100 + taxRate) * taxRate)); } else { strValueBlank = strValueBlank.concat(valueBlank);// 111 } // (4) ? ?? double idoKhKGU = 0d; if (jiseki.getIdoKhKGU() != null) { idoKhKGU = jiseki.getIdoKhKGU().doubleValue(); } else { strValueBlank = strValueBlank.concat(valueBlank);// 1111 } // (5) ? ? double idoKhKGH = 0d; if (jiseki.getIdoKhKGH() != null) { idoKhKGH = jiseki.getIdoKhKGH().doubleValue(); } else { strValueBlank = strValueBlank.concat(valueBlank);// 11111 } // (6) ? ?? double uriKhKG = 0d; if (jiseki.getUriKhKG() != null) { uriKhKG = jiseki.getUriKhKG().doubleValue(); uriKhKG = Math.floor(uriKhKG - Math.floor(uriKhKG / (100 + taxRate) * taxRate)); if (days >= 0) { uriKhKG = uriKhKG / daysInMonth * days; } } else { strValueBlank = strValueBlank.concat(valueBlank);// 111111 } // (1) + (2) + (3) + (4) - (5) + (6) if (!strValueBlank.equals("111111")) { tmp = (int) Math.floor( (ktKhKG + knKhKG + kgcKhKG + idoKhKGU - idoKhKGH + uriKhKG) / 1000); no31 = (no31 == null) ? 0 : no31.intValue(); no31 = no31 + tmp; } } // end for together monthly // NO12 ??????_??_??? ??1,000?????? if (no11 != null) { no12 = (no12 == null) ? 0 : no12.intValue(); no12 += no11; } // NO14 ??????_?_??? ??1,000?????? if (no13 != null) { no14 = (no14 == null) ? 0 : no14.intValue(); no14 += no13; } // NO15 ???????? _??__??? _?__??? ??1,000??????2 if (no11 != null || no13 != null) { int temp11 = (no11 == null) ? 0 : no11.intValue(); int temp13 = (no13 == null) ? 0 : no13.intValue(); no15 = (no15 == null) ? 0 : no15.intValue(); no15 = temp11 + temp13; } // NO19/NO11 if (no19 != null && (no11 != null && no11.intValue() > 0)) { no19Percent = RoundNumericUtil.roundSonekiSuii(no19, no11); } } // NO21 ????????? ???????? ??1,000?????? Double amount = (mapInventory != null) ? mapInventory.get(getsudo) : null; if (amount != null && amount.doubleValue() != -1) { no21 = (int) amount.doubleValue() / 1000; } // NO17 ?????????????????? ??1,000?????? if (no21 != null) { int previousGetSudo = Integer.parseInt(DateFormatUtil .format(DateUtil.monthsToSubtract(yearmonth, 1), DateFormat.DATE_WITHOUT_DAY)); Double temp = (mapInventory != null) ? (Double) mapInventory.get(String.valueOf(previousGetSudo)) : null; if (temp != null && temp.doubleValue() != -1) { // Change SPEC 01/09/2014 if (days != -1 && no21 == 0) { no17 = null; no21 = null; } else { no17 = (int) (temp.doubleValue() / 1000); } // End change SPEC 01/09/2014 } } // Modified by SONDN 2014/12/23: Update SPEC 20141222 // NO17 ?????0????????????? if (yearmonth.getYear() == businessDay.getYear() && yearmonth.getMonth() == businessDay.getMonth() && (no21 == null || no21 == 0)) { no17 = null; } // (NO23) _??_n_??__n_??-_?_n_?? if (no17 != null || no19 != null || no21 != null) { int temp17 = (no17 == null) ? 0 : no17.intValue(); int temp19 = (no19 == null) ? 0 : no19.intValue(); int temp21 = (no21 == null) ? 0 : no21.intValue(); no23 = temp17 + temp19 - temp21; } // NO35 ???????? ___???___???__???__?? if (no15 != null || no23 != null || no27 != null || no31 != null) { int temp15 = (no15 == null) ? 0 : no15.intValue(); int temp23 = (no23 == null) ? 0 : no23.intValue(); int temp27 = (no27 == null) ? 0 : no27.intValue(); int temp31 = (no31 == null) ? 0 : no31.intValue(); no35 = temp15 - temp23 - temp27 - temp31; } } else { if (mapBudgetPerformance != null) { // (N015) ??????????? ? =??? BudgetPerformanceBean kingaku = (BudgetPerformanceBean) mapBudgetPerformance .get(getsudo + Constants.DEFAULT_KMKCODEJ_K7111); if (kingaku != null && kingaku.getJisekiKingaku() != null) { no15 = (int) Math.floor(kingaku.getJisekiKingaku().doubleValue() / 1000); } // (NO19) ??????????? ? =??? kingaku = (BudgetPerformanceBean) mapBudgetPerformance .get(getsudo + Constants.DEFAULT_KMKCODEJ_K7521); if (kingaku != null && kingaku.getJisekiKingaku() != null) { no19 = (int) Math.floor(kingaku.getJisekiKingaku().doubleValue() / 1000); } // (NO27) ???????????? =??? kingaku = (BudgetPerformanceBean) mapBudgetPerformance .get(getsudo + Constants.DEFAULT_KMKCODEJ_K8110); if (kingaku != null && kingaku.getJisekiKingaku() != null) { no27 = (int) Math.floor(kingaku.getJisekiKingaku().doubleValue() / 1000); } // (NO31) ??????????? ? =??? kingaku = (BudgetPerformanceBean) mapBudgetPerformance .get(getsudo + Constants.DEFAULT_KMKCODEJ_K8210); if (kingaku != null && kingaku.getJisekiKingaku() != null) { no31 = (int) Math.floor(kingaku.getJisekiKingaku().doubleValue() / 1000); } // NO 35 ???????????? =??? kingaku = (BudgetPerformanceBean) mapBudgetPerformance .get(getsudo + Constants.DEFAULT_KMKCODEJ_K8310); if (kingaku != null && kingaku.getJisekiKingaku() != null) { no35 = (int) Math.floor(kingaku.getJisekiKingaku().doubleValue() / 1000); } } // (NO23) _??_n_??__n_??-_?_n_?? if (no17 != null || no19 != null || no21 != null) { int temp17 = (no17 == null) ? 0 : no17.intValue(); int temp19 = (no19 == null) ? 0 : no19.intValue(); int temp21 = (no21 == null) ? 0 : no21.intValue(); no23 = temp17 + temp19 - temp21; } } if (no15 != null && no15.intValue() > 0) { //(NO24) __n_???__n_?? ??? if (no23 != null) { no24 = RoundNumericUtil.roundSonekiSuii(no23, no15); } // (NO28) _n_???__n_?? ??? if (no27 != null) { no28 = RoundNumericUtil.roundSonekiSuii(no27, no15); } // (NO32) _n_???__n_?? ??? if (no31 != null) { no32 = RoundNumericUtil.roundSonekiSuii(no31, no15); } // (NO36) _n_???__n_?? ??? if (no35 != null) { no36 = RoundNumericUtil.roundSonekiSuii(no35, no15); } } int currentQuarter = Integer.parseInt(DateUtil.getQuarter(yearmonth)) - 1; if (currentQuarter == 0) { currentQuarter = 4; } // ?? if (quarter == currentQuarter) { suisMonthly = new SuisMonthBean(no11, no13, no15, no17, no19, no21, no23, no24, no27, no28, no31, no32, no35, no36, no19Percent); setDataMonthly(index, suisMonthly, model); logger.info("??"); index++; } // ?? (NO16, NO18, NO20, NO22, NO24, NO29, NO33) if (no15 != null) { no16 = (no16 == null) ? 0 : no16.intValue(); no16 += no15; } if (no17 != null) { no18 = (no18 == null) ? 0 : no18.intValue(); no18 += no17; } if (no19 != null) { no20 = (no20 == null) ? 0 : no20.intValue(); no20 += no19; } if (no21 != null) { no22 = (no22 == null) ? 0 : no22.intValue(); no22 += no21; } if (no27 != null) { no29 = (no29 == null) ? 0 : no29.intValue(); no29 += no27; } if (no31 != null) { no33 = (no33 == null) ? 0 : no33.intValue(); no33 += no31; } if (no35 != null) { no37 = (no37 == null) ? 0 : no37.intValue(); no37 += no35; } } catch (NullPointerException | IllegalArgumentException | ParseException ex) { logger.warn(ex.getMessage()); } // (NO21) _??_n_??__n_??-_?_n_?? if (no18 != null || no20 != null || no22 != null) { int temp18 = (no18 == null) ? 0 : no18.intValue(); int temp20 = (no20 == null) ? 0 : no20.intValue(); int temp22 = (no22 == null) ? 0 : no22.intValue(); no25 = temp18 + temp20 - temp22; } if (no16 != null && no16.intValue() > 0) { // (NO22) ___???___?? ??? if (no25 != null) { no26 = RoundNumericUtil.roundSonekiSuii(no25, no16); } // (NO26) __???___?? ??? if (no29 != null) { no30 = RoundNumericUtil.roundSonekiSuii(no29, no16); } // (NO30) __???___?? ??? if (no33 != null) { no34 = RoundNumericUtil.roundSonekiSuii(no33, no16); } // (NO34) __???___?? ??? if (no37 != null) { no38 = RoundNumericUtil.roundSonekiSuii(no37, no16); } } } } // ?? SuisTotalBean suisTotal = new SuisTotalBean(no12, no14, no16, no18, no20, no22, no25, no26, no29, no30, no33, no34, no37, no38); model.addAttribute(TOTAL_QUARTER, suisTotal); // Log calculator finished logger.info("End calculator suih for 3 month and total of year"); }
From source file:com.pureinfo.studio.db.xls2srm.impl.XlsImportRunner.java
private void calcProbWeight(DolphinObject _oldObj, DolphinObject _newObj, int _nChooseIfRepeat) throws PureException { Element calc = m_xmlConfig.element("data"); if (calc.element("calc") == null) return;/* ww w .ja va 2s .co m*/ List properties = calc.element("calc").elements(); for (Iterator iter = properties.iterator(); iter.hasNext();) { Element element = (Element) iter.next(); String sRef = element.attributeValue("ref"); if (sRef != null && sRef.startsWith("#")) { IImportorRef ref = (IImportorRef) PureFactory.getBean(sRef.substring(1)); String propName = element.attributeValue("name"); logger.debug(">>>>>>>:::::::name = " + propName); Double d = (Double) ref.convert(_oldObj, _newObj, propName, String.valueOf(_nChooseIfRepeat), null, LocalContextHelper.currentSession("Local"), m_entityMetadata, null, null); _newObj.setProperty(propName, d.doubleValue()); _newObj.update(); } } }
From source file:org.sakaiproject.tool.assessment.qti.helper.item.ItemHelper12Impl.java
private double getDouble(Double d) { return d == null ? 0.0 : d.doubleValue(); }
From source file:com.att.aro.diagnostics.GraphPanel.java
private static void populateThroughputPlot(XYPlot plot, TraceData.Analysis analysis) { XYSeries series = new XYSeries(0); if (analysis != null) { // Get packet iterators List<PacketInfo> packets = analysis.getPackets(); final double maxTS = analysis.getTraceData().getTraceDuration(); final List<String> tooltipList = new ArrayList<String>(1000); Double zeroTime = null; double lastTime = 0.0; for (Throughput t : Throughput.calculateThroughput(0.0, maxTS, analysis.getProfile().getThroughputWindow(), packets)) { double time = t.getTime(); double kbps = t.getKbps(); if (kbps != 0.0) { if (zeroTime != null && zeroTime.doubleValue() != lastTime) { series.add(lastTime, 0.0); tooltipList.add(MessageFormat.format(THROUGHPUT_TOOLTIP, 0.0)); }// w w w. jav a2 s . co m // Add slot to data set series.add(time, kbps); tooltipList.add(MessageFormat.format(THROUGHPUT_TOOLTIP, kbps)); zeroTime = null; } else { if (zeroTime == null) { // Add slot to data set series.add(time, kbps); tooltipList.add(MessageFormat.format(THROUGHPUT_TOOLTIP, kbps)); zeroTime = Double.valueOf(time); } } lastTime = time; } plot.getRenderer().setBaseToolTipGenerator(new XYToolTipGenerator() { @Override public String generateToolTip(XYDataset dataset, int series, int item) { // Tooltip displays throughput value return tooltipList.get(item); } }); } plot.setDataset(new XYSeriesCollection(series)); }