List of usage examples for java.lang Double doubleValue
@HotSpotIntrinsicCandidate public double doubleValue()
From source file:org.egov.works.services.impl.WorkOrderServiceImpl.java
/** * This method will search and return list of woactivity based on searched criteria. Search criteria: * WORKORDER_NO,ACTIVITY_DESC,LINEITEM_CODE Story #567 Search Line item to record measurement * * @param criteriaMap/*from w w w .j a va 2 s . c om*/ * @return */ @Override public List<WorkOrderActivity> searchWOActivities(final Map<String, Object> criteriaMap) { logger.info("-------------------------Inside searchWOActivities-----------------------"); List<WorkOrderActivity> woActivityList; String dynQuery = "select distinct woa from WorkOrderActivity woa left join woa.activity.schedule schedule" + " left join woa.activity.nonSor nonSor where woa.id != null and woa.workOrderEstimate.estimate.parent is null " + " and woa.workOrderEstimate.workOrder.egwStatus.code != 'CANCELLED' "; Object[] params; final List<Object> paramList = new ArrayList<Object>(); if (criteriaMap.get(WORKORDER_NO) != null) { dynQuery = dynQuery + " and woa.workOrderEstimate.workOrder.workOrderNumber = ? "; paramList.add(criteriaMap.get(WORKORDER_NO)); } if (criteriaMap.get(WORKORDER_ESTIMATE_ID) != null) { dynQuery = dynQuery + " and woa.workOrderEstimate.estimate.id = ? "; paramList.add(criteriaMap.get(WORKORDER_ESTIMATE_ID)); } if (criteriaMap.get(ACTIVITY_DESC) != null) { dynQuery = dynQuery + " and (" + "(UPPER(schedule.description) like ?) or (" + " UPPER(nonSor.description) like ? ))"; paramList.add("%" + ((String) criteriaMap.get(ACTIVITY_DESC)).toUpperCase() + "%"); paramList.add("%" + ((String) criteriaMap.get(ACTIVITY_DESC)).toUpperCase() + "%"); } if (criteriaMap.get(ACTIVITY_CODE) != null) { dynQuery = dynQuery + " and " + "UPPER(schedule.code) like ? "; paramList.add("%" + ((String) criteriaMap.get(ACTIVITY_CODE)).toUpperCase() + "%"); } // @Todo state not in approved and cancelled /* * dynQuery = dynQuery + "and woa.id not in (select distinct mbd.workOrderActivity.id from MBDetails mbd where " + * "mbd.mbHeader.state.previous.value not in (?,?) and mbd.workOrderActivity.id = woa.id)" ; * paramList.add(MBHeader.MeasurementBookStatus.APPROVED.toString()); * paramList.add(MBHeader.MeasurementBookStatus.CANCELLED.toString()); */ final Double extraPercentage = worksService.getConfigval(); double factor = 1; if (extraPercentage.doubleValue() > 0) factor = 1 + extraPercentage / 100; // @Todo ignore quantity of cancelled mb if (!"Required".equals(worksService.getWorksConfigValue("ORDER_NUMBER_REQUIRED"))) { dynQuery = dynQuery + "and ((woa.approvedQuantity*? > (select sum(mbd.quantity) as sumq from MBDetails mbd " + " where mbd.mbHeader.egwStatus.code != ? group by mbd.workOrderActivity " + "having mbd.workOrderActivity.id = woa.id)) or (select sum(mbd.quantity) as sumq from MBDetails mbd " + " where mbd.mbHeader.egwStatus.code != ? group by mbd.workOrderActivity " + "having mbd.workOrderActivity.id = woa.id) is null)"; paramList.add(factor); paramList.add(MBHeader.MeasurementBookStatus.CANCELLED.toString()); paramList.add(MBHeader.MeasurementBookStatus.CANCELLED.toString()); } params = new Object[paramList.size()]; params = paramList.toArray(params); woActivityList = genericService.findAllBy(dynQuery, params); return woActivityList; }
From source file:org.cimmyt.corehunter.textui.CorehunterTextRunner.java
public void run(String[] args) { setupOptions();/*from w ww . j a v a 2 s . c om*/ if (!parseOptions(args)) { showUsage(); } // try to create dataset System.out.println("Reading dataset..."); SSRDataset ds = SSRDataset.createFromFile(collectionFile); if (ds == null) { System.err.println("\nProblem parsing dataset file. Aborting."); System.exit(0); } // create an accession collection AccessionCollection ac = new AccessionCollection(); ac.addDataset(ds); int collectionSize = ac.size(); /*** TMP: compute distance distribution of loaded dataset System.out.println("Computing distance distribution..."); List<Pair<Integer, List<Pair<Accession, Accession>>>> distanceFreq = new ArrayList<Pair<Integer, List<Pair<Accession, Accession>>>>(101); for(int i=0; i<101; i++){ distanceFreq.add(null); } DistanceMeasure mr = new ModifiedRogersDistance(collectionSize); List<Accession> acs = ac.getAccessions(); for(int i=0; i<collectionSize; i++){ System.out.print("."); for(int j=i+1; j<collectionSize; j++){ Accession acc1 = acs.get(i); Accession acc2 = acs.get(j); double dist = mr.calculate(acc1, acc2); int dist_int = (int) (dist/0.01); Pair<Integer, List<Pair<Accession, Accession>>> freqPair = distanceFreq.get(dist_int); if(freqPair == null){ List<Pair<Accession, Accession>> list = new ArrayList<Pair<Accession, Accession>>(); list.add(new Pair<Accession, Accession>(acc1, acc2)); freqPair = new Pair<Integer, List<Pair<Accession, Accession>>>(1, list); distanceFreq.set(dist_int, freqPair); } else { List<Pair<Accession, Accession>> list = freqPair.snd; list.add(new Pair<Accession, Accession>(acc1, acc2)); Integer newFreq = freqPair.fst+1; freqPair = new Pair<Integer, List<Pair<Accession, Accession>>>(newFreq, list); distanceFreq.set(dist_int, freqPair); } } } System.out.println(""); // write distance distribution to file with name 'distancefreq' File distfreqoutput = new File("distancefreq"); try { FileWriter wr = new FileWriter(distfreqoutput); for(int i=0; i<distanceFreq.size(); i++){ Pair<Integer, List<Pair<Accession, Accession>>> freqPair = distanceFreq.get(i); if(freqPair != null){ wr.write(((double)i)/100 + " -- " + freqPair.fst + " times:\n\n"); List<Pair<Accession, Accession>> list = freqPair.snd; for(int j=0; j<list.size(); j++){ Pair<Accession, Accession> accPair = list.get(j); wr.write(accPair.fst.getName() + " <-> " + accPair.snd.getName() + "\n"); } wr.write("\n"); } } wr.flush(); wr.close(); } catch (IOException ex) { System.err.println("Error writing distance distribution file: " + ex); System.exit(1); } System.exit(0); END TMP ***/ if (!stuckTimeSpecified) { stuckTime = runtime; } if (!sampleSizesSpecified) { sampleMin = sampleMax = (int) (sampleIntensity * collectionSize); } if (sampleMax > collectionSize) { sampleMax = collectionSize; System.err.println("\nSpecified core size is larger than collection size. "); System.err.println("Assuming max size is collection size."); } if (tabuListSizeSpecified && tabuListSize >= sampleMax) { tabuListSize = sampleMax - 1; System.err.println("\nSpecified tabu list size is larger than or equal to max core size."); System.err.println("List size was changed to 'max core size - 1' = " + (sampleMax - 1) + ", to ensure at least one non-tabu neighbor."); } if (!tabuListSizeSpecified) { // Default tabu list size = 30% of minimum sample size tabuListSize = Math.max((int) (0.3 * sampleMin), 1); } // create a pseudo-index and add user specified measure to it, with respective weights PseudoMeasure pm = new PseudoMeasure(); for (int i = 0; i < measureNames.length; i++) { String measure = measureNames[i]; if (measureWeights.containsKey(measure)) { Double weight = measureWeights.get(measure); try { pm.addMeasure(MeasureFactory.createMeasure(measure, collectionSize), weight.doubleValue()); } catch (DuplicateMeasureException dme) { System.err.println(""); System.err.println(dme.getMessage()); showUsage(); System.exit(0); } catch (UnknownMeasureException ume) { System.err.println(""); System.err.println(ume.getMessage()); showUsage(); System.exit(0); } } } //System.out.println("Collection score: " + pm.calculate(ac.getAccessions())); // search for the core subset AccessionCollection core = null; if (randSearch) { System.out.println("---\nRandom subset\n---"); core = CoreSubsetSearch.randomSearch(ac, sampleMin, sampleMax); } else if (exhSearch) { System.out.println("---\nExhaustive search\n---"); core = CoreSubsetSearch.exhaustiveSearch(ac, pm, sampleMin, sampleMax); } else if (geneticSearch) { System.out.println("---\nGenetic algorithm search\n---"); core = CoreSubsetSearch.geneticSearch(ac, pm, sampleMin, sampleMax, runtime, minProg, stuckTime, genPopSize, genNrOfChildren, genTournamentSize, genMutationRate); } else if (lrSearch) { // check (l,r) setting if (Math.abs(lr_l - lr_r) > 1) { System.err.println("\n!!! Warning: current (l,r) setting may result" + "in core size slightly different from desired size"); } System.out.println("---\nLR Search (deterministic)\n---"); core = CoreSubsetSearch.lrSearch(ac, pm, sampleMin, sampleMax, lr_l, lr_r); } else if (semiLrSearch) { // check (l,r) setting if (Math.abs(lr_l - lr_r) > 1) { System.err.println("\n!!! Warning: current (l,r) setting may result" + "in core size slightly different from desired size"); } System.out.println("---\nSemi LR Search (semi-deterministic)\n---"); core = CoreSubsetSearch.semiLrSearch(ac, pm, sampleMin, sampleMax, lr_l, lr_r); } else if (forwardSelection) { System.out.println("---\nSequential Forward Selection (deterministic)\n---"); core = CoreSubsetSearch.forwardSelection(ac, pm, sampleMin, sampleMax); } else if (semiForwardSelection) { System.out.println("---\nSemi Sequential Forward Selection (semi-deterministic)\n---"); core = CoreSubsetSearch.semiForwardSelection(ac, pm, sampleMin, sampleMax); } else if (backwardSelection) { System.out.println("---\nSequential Backward Selection (deterministic)\n---"); core = CoreSubsetSearch.backwardSelection(ac, pm, sampleMin, sampleMax); } else { Neighborhood nh; if (remcSearch) { System.out.println("---\nREMC (Replica Exchange Monte Carlo)\n---"); nh = new RandomSingleNeighborhood(sampleMin, sampleMax); core = CoreSubsetSearch.remcSearch(ac, nh, pm, sampleMin, sampleMax, runtime, minProg, stuckTime, replicas, minT, maxT, mcSteps); } else if (parRemcSearch) { System.out.println("---\nParallel REMC (Replica Exchange Monte Carlo)\n---"); nh = new RandomSingleNeighborhood(sampleMin, sampleMax); core = CoreSubsetSearch.parRemcSearch(ac, nh, pm, sampleMin, sampleMax, runtime, minProg, stuckTime, replicas, minT, maxT, mcSteps); } else if (mergeReplicaSearch) { System.out.println("---\nMerge Replica Search\n---"); nh = new RandomSingleNeighborhood(sampleMin, sampleMax); core = CoreSubsetSearch.mergeReplicaSearch(ac, nh, pm, sampleMin, sampleMax, runtime, minProg, stuckTime, mergerepNrOfReplicas, mergerepNrOfSteps, mergerepNrOfChildren, mergerepTournamentSize, false, false); } else if (parMergeReplicaSearch) { System.out.println("---\nParallel Merge Replica Search\n---"); nh = new RandomSingleNeighborhood(sampleMin, sampleMax); core = CoreSubsetSearch.parMergeReplicaSearch(ac, nh, pm, sampleMin, sampleMax, runtime, minProg, stuckTime, mergerepNrOfReplicas, mergerepNrOfSteps, mergerepNrOfChildren, mergerepTournamentSize, false, false); } else if (mixedReplicaSearch) { System.out.println("---\nParallel Mixed Replica Search\n---"); core = CoreSubsetSearch.mixedReplicaSearch(ac, pm, sampleMin, sampleMax, runtime, minProg, stuckTime, mixrepNrOfTabuReplicas, mixrepNrOfNonTabuReplicas, mixrepRoundsWithoutTabu, mixrepNrOfTabuSteps, mixrepTournamentSize, tabuListSize, false, false, mixrepBoostNr, mixrepBoostMinProg, mixrepBoostTimeFactor, mixrepMinBoostTime, mixrepMinSimAnTemp, mixrepMaxSimAnTemp); } else if (localSearch) { System.out.println("---\nLocal Search\n---"); nh = new RandomSingleNeighborhood(sampleMin, sampleMax); core = CoreSubsetSearch.localSearch(ac, nh, pm, sampleMin, sampleMax, runtime, minProg, stuckTime); } else if (steepestDescentSearch) { System.out.println("---\nSteepest Descent Search\n---"); nh = new RandomSingleNeighborhood(sampleMin, sampleMax); core = CoreSubsetSearch.steepestDescentSearch(ac, nh, pm, sampleMin, sampleMax, runtime, minProg); } else if (mstratSearch) { System.out.println("---\nMSTRAT Search (Heuristic Steepest Descent)\n---"); nh = new HeuristicSingleNeighborhood(sampleMin, sampleMax); // MSTRAT = Steepest Descent with heuristic neighborhood core = CoreSubsetSearch.steepestDescentSearch(ac, nh, pm, sampleMin, sampleMax, runtime, minProg); } else if (tabuSearch) { System.out.println("---\nTabu Search\n---"); // Tabu Search uses heuristic neighborhood as in MSTRAT nh = new HeuristicSingleNeighborhood(sampleMin, sampleMax); core = CoreSubsetSearch.tabuSearch(ac, nh, pm, sampleMin, sampleMax, runtime, minProg, stuckTime, tabuListSize); } else { System.err.println("Error: no known search type selected (this should not happen!)"); System.exit(1); } } Map<String, Double> scores = pm.componentScores(core.getAccessions()); System.out.println("--------"); for (String comp : scores.keySet()) { System.out.println(comp + ": " + scores.get(comp)); } List<String> accessions = new ArrayList<String>(core.getAccessionNames()); ds.writeToFile(coresubsetFile, accessions); }
From source file:org.egov.works.services.impl.WorkOrderServiceImpl.java
/** * This method will search and return list of woactivity from only revision estimates based on searched criteria. Search * criteria: WORKORDER_NO,ACTIVITY_DESC,LINEITEM_CODE * * @param criteriaMap/* w ww .jav a 2 s .c om*/ * @return */ @Override public List<WorkOrderActivity> searchWOActivitiesFromRevEstimates(final Map<String, Object> criteriaMap) { logger.info("-------------------------Inside searchWOActivities-----------------------"); List<WorkOrderActivity> woActivityList; String dynQuery = "select distinct woa from WorkOrderActivity woa left join woa.activity.schedule schedule" + " left join woa.activity.nonSor nonSor where woa.id != null "; Object[] params; final List<Object> paramList = new ArrayList<Object>(); if (criteriaMap.get(WORKORDER_NO) != null) { dynQuery = dynQuery + " and woa.workOrderEstimate.workOrder.parent.workOrderNumber = ? "; paramList.add(criteriaMap.get(WORKORDER_NO)); } if (criteriaMap.get(WORKORDER_ESTIMATE_ID) != null) { dynQuery = dynQuery + " and woa.workOrderEstimate.estimate.parent.id = ? "; paramList.add(criteriaMap.get(WORKORDER_ESTIMATE_ID)); } if (criteriaMap.get(ACTIVITY_DESC) != null) { dynQuery = dynQuery + " and (" + "(UPPER(schedule.description) like ?) or (" + " UPPER(nonSor.description) like ? ))"; paramList.add("%" + ((String) criteriaMap.get(ACTIVITY_DESC)).toUpperCase() + "%"); paramList.add("%" + ((String) criteriaMap.get(ACTIVITY_DESC)).toUpperCase() + "%"); } if (criteriaMap.get(ACTIVITY_CODE) != null) { dynQuery = dynQuery + " and " + "UPPER(schedule.code) like ? "; paramList.add("%" + ((String) criteriaMap.get(ACTIVITY_CODE)).toUpperCase() + "%"); } // Check Approved REs dynQuery = dynQuery + " and woa.workOrderEstimate.estimate.egwStatus.code=? "; paramList.add(WorksConstants.APPROVED); if (criteriaMap.get(REVISION_TYPE) != null) { dynQuery = dynQuery + " and woa.activity.revisionType=? "; paramList.add(criteriaMap.get(REVISION_TYPE)); } // @Todo state not in approved and cancelled /* * dynQuery = dynQuery + "and woa.id not in (select distinct mbd.workOrderActivity.id from MBDetails mbd where " + * "mbd.mbHeader.state.previous.value not in (?,?) and mbd.workOrderActivity.id = woa.id)" ; * paramList.add(MBHeader.MeasurementBookStatus.APPROVED.toString()); * paramList.add(MBHeader.MeasurementBookStatus.CANCELLED.toString()); */ final Double extraPercentage = worksService.getConfigval(); double factor = 1; if (extraPercentage.doubleValue() > 0) factor = 1 + extraPercentage / 100; // @Todo ignore quantity of cancelled mb if (!"Required".equals(worksService.getWorksConfigValue("ORDER_NUMBER_REQUIRED"))) { dynQuery = dynQuery + "and ((woa.approvedQuantity*? > (select sum(mbd.quantity) as sumq from MBDetails mbd " + " where mbd.mbHeader.egwStatus.code != ? group by mbd.workOrderActivity " + "having mbd.workOrderActivity.id = woa.id)) or (select sum(mbd.quantity) as sumq from MBDetails mbd " + " where mbd.mbHeader.egwStatus.code != ? group by mbd.workOrderActivity " + "having mbd.workOrderActivity.id = woa.id) is null)"; paramList.add(factor); paramList.add(MBHeader.MeasurementBookStatus.CANCELLED.toString()); paramList.add(MBHeader.MeasurementBookStatus.CANCELLED.toString()); } params = new Object[paramList.size()]; params = paramList.toArray(params); woActivityList = genericService.findAllBy(dynQuery, params); // /woActivityListOriEst = searchWOActivities(criteriaMap); // Remove the SOR items that were present in the original Estimate /* * if(woActivityListOriEst !=null && !woActivityListOriEst.isEmpty() && woActivityList!=null && !woActivityList.isEmpty()) * { for(WorkOrderActivity woaOri :woActivityListOriEst) { for(WorkOrderActivity woaRev : woActivityList) { * if(woaOri.getActivity().getId()==woaRev.getActivity().getId()) { woActivityList.remove(woaRev); } } } } */ return woActivityList; }
From source file:com.nec.harvest.controller.SuisController.java
/** * Calculator total data 12 month and fill 3 month of quarter * // ww w. jav a 2 s . co m * @param listSuisYear * Data profit and loss * @param monthly * month * @param businessDay * a day business * @param mapAT023 * Map at023 * @param mapAT015 * Map at015 * @param quarter * a current quarter * @param model */ private void calculateSuii(Map<String, VJiseki> mapSuisYear, Date monthly, Date businessDay, Map<String, BudgetPerformance> mapAT023, Map<String, Double> mapAT015, int quarter, Model model) { logger.info("Begin calculator suii for 3 month and total of year"); final String TOTAL_QUARTER = "totalQuarter"; Integer no08 = null; //_??__?? Integer no10 = null; //_?__??) Integer no12 = null; //___?? Integer no14 = null; //_??__?? Integer no16 = null; //___?? Integer no18 = null; //_?__?? Integer no21 = null; //___?? Double no22 = null; //___ Integer no25 = null; //__?? Double no26 = null; //__ Integer no29 = null; //__?? Double no30 = null; //__ Integer no33 = null; //__?? Double no34 = null; //__ int index = 0; SuisMonthBean suisMonthly = null; String valueBlank = "1"; // Loop data soneki suis if (mapSuisYear != null && mapSuisYear.size() > 0) { for (Map.Entry<String, VJiseki> entry : mapSuisYear.entrySet()) { String key = entry.getKey(); VJiseki jiseki = entry.getValue(); String strValueBlank = ""; 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 no07 = null; //_??_n1n3_? Integer no11 = null; //__n1n3_???? Integer no09 = null; //_?_n1n3_? Integer no13 = null; //_??_n1n3_?? Integer no15 = null; //__n1n3_?? Integer no17 = null; //_?_n1n3_?? Integer no19 = null; //__n1n3_?? Double no20 = 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_ Double no15Percent = null; if (yearmonth.after(monthly) && jiseki != null) { int daysInMonth = DateUtil.getActualMaximumOfMonth(businessDay); logger.info("Total days of month {} ", daysInMonth); // // NO07 ???????? ? ????? ??1,000?????? // if (jiseki.getUriSkKG() != null) { // double uriSkKG = jiseki.getUriSkKG().doubleValue(); // no07 = (int) ((uriSkKG - Math.floor(uriSkKG / (100 + taxRate) * taxRate)) / 1000); // // // NO08 ??????_??_??? ??1,000?????? // no08 = (no08 == null) ? 0 : no08.intValue(); // no08 += no07; // } // Modified by SONDN 2014/12/22: Update SPEC 20141222 // NO07 ???????? ? ????? ??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 days = DateUtil.getNumberOfDays(yearmonth, businessDay); if (days > 0) { step2 = (step2 / daysInMonth) * days; } double step3 = idoSkKGU == null ? 0 : idoSkKGU; double step4 = idoSkKGH == null ? 0 : idoSkKGH; no07 = (int) Math.floor((step1 + step2 + step3 - step4) / 1000); // NO08 ??????_??_??? ??1,000?????? no08 = (no08 == null) ? 0 : no08.intValue(); no08 += no07; } // (1) ? ???? double temp1 = 0d; if (jiseki.getUriKrKG() != null) { double uriKrKG = jiseki.getUriKrKG().doubleValue(); temp1 = 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 } int days = DateUtil.getNumberOfDays(yearmonth, businessDay); if (days > 0) { temp1 = (temp1 / daysInMonth) * days; temp2 = (temp2 / daysInMonth) * days; } else if (days == 0) { strValueBlank = "11"; } // NO09 ????????(1) + (2) if (!strValueBlank.equals("11")) { no09 = (no09 == null) ? 0 : no09.intValue(); no09 = (int) ((temp1 + temp2) / 1000); // NO10 ??????_?_??? ??1,000?????? no10 = (no10 == null) ? 0 : no10.intValue(); no10 += no09; } // NO11 ???????? _??__??? _?__??? ??1,000??????2 if (no07 != null || no09 != null) { int temp07 = (no07 == null) ? 0 : no07.intValue(); int temp09 = (no09 == null) ? 0 : no09.intValue(); no11 = (no11 == null) ? 0 : no11.intValue(); no11 = temp07 + temp09; } // NO17 ????????? ???????? ??1,000?????? Double amount = (mapAT015 != null) ? mapAT015.get(getsudo) : null; if (amount != null && amount.doubleValue() != -1d) { no17 = (int) (amount.doubleValue() / 1000); } // NO13 ?????????????????? ??1,000?????? if (no17 != null) { Date preMonth = DateUtil.monthsToSubtract(yearmonth, 1); int previousGetSudo = Integer .parseInt(DateFormatUtil.format(preMonth, DateFormat.DATE_WITHOUT_DAY)); Double temp = (mapAT015 != null) ? (Double) mapAT015.get(String.valueOf(previousGetSudo)) : null; if (temp != null && temp.doubleValue() != -1) { // Change SPEC 01/09/2014 if (days != -1 && no17 == 0) { no13 = null; no17 = null; } else { no13 = (int) (temp.doubleValue() / 1000); } // End change SPEC 01/09/2014 } } // ???????? 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 = 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")) { no15 = (int) ((knSrKG + ktsrkg + kgcSrKG + idoSrkGU - idoSrkGH) / 1000); } // NO23 ???????? 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 = 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")) { no23 = (int) ((ktJkKG + jkJkKG + kgcJkKG + idoJkKGU - idoJkKGH + helpJkKGU - helpJkKGH) / 1000); } // NO27 ???????? // (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 = 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 = 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")) { no27 = (int) ((ktKhKG + knKhKG + kgcKhKG + idoKhKGU - idoKhKGH + uriKhKG) / 1000); } // (NO19) _??_n_??__n_??-_?_n_?? if (no13 != null || no15 != null || no17 != null) { int temp13 = (no13 == null) ? 0 : no13.intValue(); int temp15 = (no15 == null) ? 0 : no15.intValue(); int temp17 = (no17 == null) ? 0 : no17.intValue(); no19 = temp13 + temp15 - temp17; } // NO 31 ???????? ___???___???__???__?? if (no11 != null || no19 != null || no23 != null || no27 != null) { int temp11 = (no11 == null) ? 0 : no11.intValue(); int temp19 = (no19 == null) ? 0 : no19.intValue(); int temp23 = (no23 == null) ? 0 : no23.intValue(); int temp27 = (no27 == null) ? 0 : no27.intValue(); no31 = temp11 - temp19 - temp23 - temp27; } //no15Percent } else { if (mapAT023 != null) { // (N011) ??????????? ? =??? BudgetPerformance kingaku = (BudgetPerformance) mapAT023 .get(getsudo + Constants.DEFAULT_KMKCODEJ_K7111); if (kingaku != null && kingaku.getJisekiKingaku() != null) { no11 = (int) (kingaku.getJisekiKingaku().doubleValue() / 1000); } // (NO15) ??????????? ? =??? kingaku = (BudgetPerformance) mapAT023.get(getsudo + Constants.DEFAULT_KMKCODEJ_K7521); if (kingaku != null && kingaku.getJisekiKingaku() != null) { no15 = (int) (kingaku.getJisekiKingaku().doubleValue() / 1000); } // (NO23) ???????????? =??? kingaku = (BudgetPerformance) mapAT023.get(getsudo + Constants.DEFAULT_KMKCODEJ_K8110); if (kingaku != null && kingaku.getJisekiKingaku() != null) { no23 = (int) (kingaku.getJisekiKingaku().doubleValue() / 1000); } // (NO27) ??????????? ? =??? kingaku = (BudgetPerformance) mapAT023.get(getsudo + Constants.DEFAULT_KMKCODEJ_K8210); if (kingaku != null && kingaku.getJisekiKingaku() != null) { no27 = (int) (kingaku.getJisekiKingaku().doubleValue() / 1000); } // NO 31 ???????????? =??? kingaku = (BudgetPerformance) mapAT023.get(getsudo + Constants.DEFAULT_KMKCODEJ_K8310); if (kingaku != null && kingaku.getJisekiKingaku() != null) { no31 = (int) (kingaku.getJisekiKingaku().doubleValue() / 1000); } } // (NO19) _??_n_??__n_??-_?_n_?? if (no13 != null || no15 != null || no17 != null) { int temp13 = (no13 == null) ? 0 : no13.intValue(); int temp15 = (no15 == null) ? 0 : no15.intValue(); int temp17 = (no17 == null) ? 0 : no17.intValue(); no19 = temp13 + temp15 - temp17; } } if (no11 != null && no11.intValue() > 0) { //(NO20) __n_???__n_?? ??? if (no19 != null) { no20 = RoundNumericUtil.roundSonekiSuii(no19, no11); } // (NO24) _n_???__n_?? ??? if (no23 != null) { no24 = RoundNumericUtil.roundSonekiSuii(no23, no11); } // (NO28) _n_???__n_?? ??? if (no27 != null) { no28 = RoundNumericUtil.roundSonekiSuii(no27, no11); } // (NO32) _n_???__n_?? ??? if (no31 != null) { no32 = RoundNumericUtil.roundSonekiSuii(no31, no11); } // NO15/NO07 if (no15 != null && (no07 != null && no07.intValue() > 0)) { no15Percent = RoundNumericUtil.roundSonekiSuii(no15, no07); } } int currentQuarter = Integer.parseInt(DateUtil.getQuarter(yearmonth)) - 1; if (currentQuarter == 0) { currentQuarter = 4; } // ?? if (quarter == currentQuarter) { suisMonthly = new SuisMonthBean(no07, no09, no11, no13, no15, no17, no19, no20, no23, no24, no27, no28, no31, no32, no15Percent); setDataMonthly(index, suisMonthly, model); logger.info("??"); index++; } // ?? (NO12, NO14, NO16, NO18, NO25, NO29, NO33) if (no11 != null) { no12 = (no12 == null) ? 0 : no12.intValue(); no12 += no11; } if (no13 != null) { no14 = (no14 == null) ? 0 : no14.intValue(); no14 += no13; } if (no15 != null) { no16 = (no16 == null) ? 0 : no16.intValue(); no16 += no15; } if (no17 != null) { no18 = (no18 == null) ? 0 : no18.intValue(); no18 += no17; } if (no23 != null) { no25 = (no25 == null) ? 0 : no25.intValue(); no25 += no23; } if (no27 != null) { no29 = (no29 == null) ? 0 : no29.intValue(); no29 += no27; } if (no31 != null) { no33 = (no33 == null) ? 0 : no33.intValue(); no33 += no31; } } catch (NullPointerException | IllegalArgumentException | ParseException ex) { logger.warn(ex.getMessage()); } // (NO21) _??_n_??__n_??-_?_n_?? if (no14 != null || no16 != null || no18 != null) { int temp14 = (no14 == null) ? 0 : no14.intValue(); int temp16 = (no16 == null) ? 0 : no16.intValue(); int temp18 = (no18 == null) ? 0 : no18.intValue(); no21 = temp14 + temp16 - temp18; } if (no12 != null && no12.intValue() > 0) { // (NO22) ___???___?? ??? if (no21 != null) { no22 = RoundNumericUtil.roundSonekiSuii(no21, no12); } // (NO26) __???___?? ??? if (no25 != null) { no26 = RoundNumericUtil.roundSonekiSuii(no25, no12); } // (NO30) __???___?? ??? if (no29 != null) { no30 = RoundNumericUtil.roundSonekiSuii(no29, no12); } // (NO34) __???___?? ??? if (no33 != null) { no34 = RoundNumericUtil.roundSonekiSuii(no33, no12); } } } } // ?? SuisTotalBean suisTotal = new SuisTotalBean(no08, no10, no12, no14, no16, no18, no21, no22, no25, no26, no29, no30, no33, no34); model.addAttribute(TOTAL_QUARTER, suisTotal); // logger.info("End calculator suii for 3 month and total of year"); }
From source file:com.aurel.track.fieldType.runtime.matchers.run.AccountingTimeMatcherRT.java
/** * Whether the value matches or not/* www. ja va 2 s . co m*/ * * @param attributeValue * @return */ @Override public boolean match(Object attributeValue) { Boolean nullMatch = nullMatcher(attributeValue); if (nullMatch != null) { return nullMatch.booleanValue(); } if (attributeValue == null || matchValue == null) { return false; } AccountingTimeTO attributeValueAccountingTime = null; AccountingTimeTO matcherValueAccountingTime = null; try { attributeValueAccountingTime = (AccountingTimeTO) attributeValue; } catch (Exception e) { LOGGER.error("Converting the attribute value " + attributeValue + " of type " + attributeValue.getClass().getName() + " to AccountingTimeTO failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); return false; } try { matcherValueAccountingTime = (AccountingTimeTO) matchValue; } catch (Exception e) { LOGGER.warn("Converting the matcher value " + matchValue + " of type " + matchValue.getClass().getName() + " to AccountingTimeTO failed with " + e.getMessage(), e); return false; } Double attributeValueDouble = attributeValueAccountingTime.getValue(); Double matcherValueDouble = matcherValueAccountingTime.getValue(); if (attributeValueDouble == null || matcherValueDouble == null) { return false; } Integer attributeValueUnit = attributeValueAccountingTime.getUnit(); Integer matcherValueUnit = matcherValueAccountingTime.getUnit(); if (attributeValueUnit == null) { attributeValueUnit = TIMEUNITS.HOURS; } if (matcherValueUnit == null) { matcherValueUnit = TIMEUNITS.HOURS; } if (!attributeValueUnit.equals(matcherValueUnit)) { if (attributeValueUnit.intValue() != TIME_UNIT.HOUR) { attributeValueDouble = AccountingBL.transformToTimeUnits(attributeValueDouble, this.getHourPerWorkday(), attributeValueUnit, TIME_UNIT.HOUR).doubleValue(); } if (matcherValueUnit.intValue() != TIME_UNIT.HOUR) { matcherValueDouble = AccountingBL.transformToTimeUnits(matcherValueDouble, this.getHourPerWorkday(), matcherValueUnit, TIME_UNIT.HOUR).doubleValue(); } } switch (relation) { case MatchRelations.EQUAL: return (Double.doubleToRawLongBits(attributeValueDouble.doubleValue()) - Double.doubleToRawLongBits(matcherValueDouble.doubleValue()) == 0); case MatchRelations.NOT_EQUAL: return (Double.doubleToRawLongBits(attributeValueDouble.doubleValue()) - Double.doubleToRawLongBits(matcherValueDouble.doubleValue()) != 0); case MatchRelations.GREATHER_THAN: return attributeValueDouble.doubleValue() > matcherValueDouble.doubleValue(); case MatchRelations.GREATHER_THAN_EQUAL: return attributeValueDouble.doubleValue() >= matcherValueDouble.doubleValue(); case MatchRelations.LESS_THAN: return attributeValueDouble.doubleValue() < matcherValueDouble.doubleValue(); case MatchRelations.LESS_THAN_EQUAL: return attributeValueDouble.doubleValue() <= matcherValueDouble.doubleValue(); default: return false; } }
From source file:org.apache.flex.forks.velocity.runtime.configuration.Configuration.java
/** * Get a double associated with the given configuration key. * * @param key The configuration key./*from w w w . j a v a2 s. co m*/ * @return The associated double. * @exception NoSuchElementException is thrown if the key doesn't * map to an existing object. * @exception ClassCastException is thrown if the key maps to an * object that is not a Double. * @exception NumberFormatException is thrown if the value mapped * by the key has not a valid number format. */ public double getDouble(String key) { Double d = getDouble(key, null); if (d != null) { return d.doubleValue(); } else { throw new NoSuchElementException('\'' + key + "' doesn't map to an existing object"); } }
From source file:rb.app.TransientRBSystem.java
/** * Evaluate theta_q_m (for the q^th mass matrix term) at the current parameter. *//*from www . j a v a 2 s.co m*/ public double eval_theta_q_m(int q) { Method meth; try { // Get a reference to get_n_M_functions, which does not // take any arguments Class partypes[] = new Class[2]; partypes[0] = Integer.TYPE; partypes[1] = double[].class; meth = mAffineFnsClass.getMethod("evaluateM", partypes); } catch (NoSuchMethodException nsme) { throw new RuntimeException("getMethod for evaluateM failed", nsme); } Double theta_val; try { Object arglist[] = new Object[2]; arglist[0] = new Integer(q); arglist[1] = current_parameters.getArray(); Object theta_obj = meth.invoke(mTheta, arglist); theta_val = (Double) theta_obj; } catch (IllegalAccessException iae) { throw new RuntimeException(iae); } catch (InvocationTargetException ite) { throw new RuntimeException(ite.getCause()); } return theta_val.doubleValue(); }
From source file:org.sakaiproject.tool.gradebook.ui.FeedbackOptionsBean.java
private boolean isMappingValid(GradeMapping gradeMapping) { boolean valid = true; Double previousPercentage = null; for (Iterator iter = gradeMapping.getGrades().iterator(); iter.hasNext();) { String grade = (String) iter.next(); Double percentage = (Double) gradeMapping.getValue(grade); if (log.isDebugEnabled()) log.debug("checking percentage " + percentage + " for validity"); // Grades that are percentage-based need to remain percentage-based, // be in descending order, and end with 0. // Manual-only grades (which aren't associated with a percentage) always // follow the lowest percentage-based grade, and must stay manual-only. boolean manualOnly = (gradeMapping.getDefaultBottomPercents().get(grade) == null); if (manualOnly) { if (percentage != null) { // This shouldn't happen, given the UI. if (log.isErrorEnabled()) log.error("User " + getUserUid() + " attempted to set manual-only grade '" + grade + "' to be worth " + percentage + " percent"); percentage = null;//www .jav a2s . c o m valid = false; } } else { if (percentage == null) { FacesUtil.addUniqueErrorMessage(getLocalizedString("feedback_options_require_all_values")); valid = false; } else if (percentage.doubleValue() < 0) { FacesUtil.addUniqueErrorMessage(getLocalizedString("feedback_options_require_positive")); valid = false; } else if ((previousPercentage != null) && (previousPercentage.doubleValue() < percentage.doubleValue())) { FacesUtil .addUniqueErrorMessage(getLocalizedString("feedback_options_require_descending_order")); valid = false; } } previousPercentage = percentage; } return valid; }
From source file:controllers.core.PortfolioEntryDeliveryController.java
/** * Display the status (charts) of the requirements of a portfolio entry. * /*from w ww . j av a 2s .c om*/ * @param id * the portfolio entry id */ @With(CheckPortfolioEntryExists.class) @Dynamic(IMafConstants.PORTFOLIO_ENTRY_DETAILS_DYNAMIC_PERMISSION) public Result requirementsStatus(Long id) { // get the portfolio entry PortfolioEntry portfolioEntry = PortfolioEntryDao.getPEById(id); // priority pie chart (for the needs) DistributedDonut distributedDonutPriority = new DistributedDonut(getMessagesPlugin()); DistributedDonut.Elem mustElem = new DistributedDonut.Elem( Msg.get("core.portfolio_entry_delivery.requirement.status.priority.must.true.label")); double mustTotal = 0; for (Type type : Type.values()) { Double count = Double.valueOf( RequirementDAO.getRequirementNeedsAsExprByPEAndStatusType(id, type, true).findRowCount()); if (count != null && count.doubleValue() != 0) { mustElem.addSubValue(Msg.get("object.requirement_status.type." + type.name() + ".label"), count); mustTotal += count.doubleValue(); } } if (mustTotal != 0) { mustElem.setValue(mustTotal); distributedDonutPriority.addElem(mustElem); } DistributedDonut.Elem notMustElem = new DistributedDonut.Elem( Msg.get("core.portfolio_entry_delivery.requirement.status.priority.must.false.label")); double notMustTotal = 0; for (Type type : Type.values()) { Double count = Double.valueOf( RequirementDAO.getRequirementNeedsAsExprByPEAndStatusType(id, type, false).findRowCount()); if (count != null && count.doubleValue() != 0) { notMustElem.addSubValue(Msg.get("object.requirement_status.type." + type.name() + ".label"), count); notMustTotal += count.doubleValue(); } } if (notMustTotal != 0) { notMustElem.setValue(notMustTotal); distributedDonutPriority.addElem(notMustElem); } if (distributedDonutPriority.isEmpty()) { distributedDonutPriority = null; } // priority bar chart (for the needs) BasicBar basicBarPriority = null; if (distributedDonutPriority != null) { basicBarPriority = new BasicBar(); for (Type type : Type.values()) { basicBarPriority.addCategory(Msg.get("object.requirement_status.type." + type.name() + ".label")); } for (RequirementPriority priority : RequirementDAO.getRequirementPriorityAsList()) { BasicBar.Elem elem = new BasicBar.Elem(priority.getName()); for (Type type : Type.values()) { elem.addValue(Double.valueOf(RequirementDAO .getRequirementNeedsAsExprByPEAndStatusTypeAndPriority(id, type, priority.id) .findRowCount())); } basicBarPriority.addElem(elem); } } // severity pie chart (for the defects) DistributedDonut distributedDonutSeverity = new DistributedDonut(getMessagesPlugin()); DistributedDonut.Elem blockerElem = new DistributedDonut.Elem( Msg.get("core.portfolio_entry_delivery.requirement.status.severity.blocker.true.label")); double blockerTotal = 0; for (Type type : Type.values()) { Double count = Double.valueOf( RequirementDAO.getRequirementDefectsAsExprByPEAndStatusType(id, type, true).findRowCount()); if (count != null && count.doubleValue() != 0) { blockerElem.addSubValue(Msg.get("object.requirement_status.type." + type.name() + ".label"), count); blockerTotal += count.doubleValue(); } } if (blockerTotal != 0) { blockerElem.setValue(blockerTotal); distributedDonutSeverity.addElem(blockerElem); } DistributedDonut.Elem nonBlockerElem = new DistributedDonut.Elem( Msg.get("core.portfolio_entry_delivery.requirement.status.severity.blocker.false.label")); double nonBlockerTotal = 0; for (Type type : Type.values()) { Double count = Double.valueOf( RequirementDAO.getRequirementDefectsAsExprByPEAndStatusType(id, type, false).findRowCount()); if (count != null && count.doubleValue() != 0) { nonBlockerElem.addSubValue(Msg.get("object.requirement_status.type." + type.name() + ".label"), count); nonBlockerTotal += count.doubleValue(); } } if (nonBlockerTotal != 0) { nonBlockerElem.setValue(nonBlockerTotal); distributedDonutSeverity.addElem(nonBlockerElem); } if (distributedDonutSeverity.isEmpty()) { distributedDonutSeverity = null; } // severity bar chart (for the defects) BasicBar basicBarSeverity = null; if (distributedDonutSeverity != null) { basicBarSeverity = new BasicBar(); for (Type type : Type.values()) { basicBarSeverity.addCategory(Msg.get("object.requirement_status.type." + type.name() + ".label")); } for (RequirementSeverity requirementSeverity : RequirementDAO.getRequirementSeverityAsList()) { BasicBar.Elem elem = new BasicBar.Elem(requirementSeverity.getName()); for (Type type : Type.values()) { elem.addValue(Double .valueOf(RequirementDAO.getRequirementDefectsAsExprByPEAndStatusTypeAndSeverity(id, type, requirementSeverity.id).findRowCount())); } basicBarSeverity.addElem(elem); } } return ok(views.html.core.portfolioentrydelivery.requirements_status.render(portfolioEntry, distributedDonutPriority, basicBarPriority, distributedDonutSeverity, basicBarSeverity)); }
From source file:de.hybris.platform.ycommercewebservices.v2.controller.StoresController.java
/** * Lists all store locations that are near the location specified in a query or by latitude and longitude. * /* w ww .j ava 2s.c o m*/ * @queryparam query Location in natural language i.e. city or country. * @queryparam latitude Coordinate that specifies the north-south position of a point on the Earth's surface. * @queryparam longitude Coordinate that specifies the east-west position of a point on the Earth's surface. * @queryparam currentPage The current result page requested. * @queryparam pageSize The number of results returned per page. * @queryparam sort Sorting method applied to the return results. * @queryparam radius Radius in meters. Max value: 40075000.0 (Earth's perimeter). * @queryparam accuracy Accuracy in meters. * @queryparam fields Response configuration (list of fields, which should be returned in response) * @return Lists of store near given location * @throws RequestParameterException */ @RequestMapping(value = "/{baseSiteId}/stores", method = RequestMethod.GET) @ResponseBody public StoreFinderSearchPageWsDTO locationSearch(@RequestParam(required = false) final String query, @RequestParam(required = false) final Double latitude, @RequestParam(required = false) final Double longitude, @RequestParam(required = false, defaultValue = DEFAULT_CURRENT_PAGE) final int currentPage, @RequestParam(required = false, defaultValue = DEFAULT_PAGE_SIZE) final int pageSize, @RequestParam(required = false, defaultValue = "asc") final String sort, @RequestParam(required = false, defaultValue = DEFAULT_SEARCH_RADIUS_METRES) final double radius, @RequestParam(required = false, defaultValue = DEFAULT_ACCURACY) final double accuracy, @RequestParam(required = false, defaultValue = DEFAULT_FIELD_SET) final String fields) throws RequestParameterException { if (radius > EARTH_PERIMETER) { throw new RequestParameterException("Radius cannot be greater than Earth's perimeter", RequestParameterException.INVALID, "radius"); } final double radiusToSearch = getInKilometres(radius, accuracy); final PageableData pageableData = createPageable(currentPage, pageSize, sort); StoreFinderSearchPageData<PointOfServiceData> result = null; if (StringUtils.isNotBlank(query)) { result = storeFinderFacade.locationSearch(query, pageableData, radiusToSearch); } else if (latitude != null && longitude != null) { final GeoPoint geoPoint = new GeoPoint(); geoPoint.setLatitude(latitude.doubleValue()); geoPoint.setLongitude(longitude.doubleValue()); result = storeFinderFacade.positionSearch(geoPoint, pageableData, radiusToSearch); } else { result = storeFinderFacade.getAllPointOfServices(pageableData); } return convertStoreFinderSearch(result, fields); }