List of usage examples for java.lang Float Float
@Deprecated(since = "9") public Float(String s) throws NumberFormatException
From source file:edu.hawaii.soest.hioos.isus.ISUSFrame.java
public double getAuxConcentration2() { this.auxConcentration2.flip(); return (new Float(this.auxConcentration2.getFloat())).doubleValue(); }
From source file:org.squale.squalecommon.enterpriselayer.facade.quality.MeasureFacade.java
/** * Permet de rcuprer des valeurs pour une liste de types de rsultat, une liste de types de composant et un audit * donns Format de ResultsDTO : 2 lignes : -- null en cl et liste des cls de TREs en valeur -- ComponentDTO en * cl et liste des rsultats associes en valeur ( n fois ) * //from w w w . j a va2s . c o m * @param pAudit AuditDTO contenant l'ID de l'audit * @param pTreKey l'id du tre correspondant la pratique * @param pTREKeys liste des IDs des types de rsultats souhaits * @param pComponents liste de ComponentDTO souhaits * @return ResultsDTO * @throws JrafEnterpriseException exception JRAF * @roseuid 42CBFFB401C0 */ public static ResultsDTO getMeasuresByTREAndComponent(Long pTreKey, List pTREKeys, List pComponents, AuditDTO pAudit) throws JrafEnterpriseException { ResultsDTO results = null; Collection trClasses = null; MeasureDAOImpl measureDAO = MeasureDAOImpl.getInstance(); // Session Hibernate ISession session = null; try { // rcupration d'une session session = PERSISTENTPROVIDER.getSession(); // Rcupration de la collection de classes de TREs trClasses = getTREClasses(pTREKeys); if (trClasses.size() > 0) { // initialisation du ResultsDTO et ajout des cls results = new ResultsDTO(); results.put(null, pTREKeys); Iterator itComp = pComponents.iterator(); while (itComp.hasNext()) { // Pour chaque composant : ComponentDTO component = (ComponentDTO) itComp.next(); Long idComponent = new Long(component.getID()); Long idAudit = new Long(pAudit.getID()); // Rcupration des mesures souhaites Collection measures = measureDAO.findWhere(session, idComponent, idAudit, trClasses); if (measures.size() > 0) { // ajout au Rsult DTO des mesures souhaites results = MeasureTransform.bo2dtoByTRE(results, measures, pTREKeys, component); // On rcupre aussi la note de la pratique associe chaque composant // que l'on place en dbut de liste MarkBO mark = MarkDAOImpl.getInstance().load(session, new Long(component.getID()), new Long(pAudit.getID()), pTreKey); ((List) results.getResultMap().get(component)).add(0, new Float(mark.getValue())); } } } } catch (JrafDaoException e) { LOG.error(MeasureFacade.class.getName() + ".getMeasuresByTREAndComponent", e); } finally { FacadeHelper.closeSession(session, MeasureFacade.class.getName() + ".getMeasuresByTREAndComponent"); } return results; }
From source file:com.chengfeng.ne.basicInterface.service.impl.BasicInterfaceServiceImpl.java
/** * ??//ww w . j a v a2s . c om */ public List<String> parserSiteInfo(String params) throws ServiceException { //????? JSONArray jsonArray = JSONArray.fromObject(params); Map<String, String> map = new HashMap<String, String>(); List<String> errList = new ArrayList<String>(); String siteCode = ""; for (int i = 0; i < jsonArray.size(); i++) { try { JSONObject info = jsonArray.getJSONObject(i); // BasicSiteVO site = new BasicSiteVO(); BasicSiteDetailVO detailSite = new BasicSiteDetailVO(); //?? siteCode = info.getString("SITE_CODE"); String siteName = info.getString("SITE_NAME"); String parentSiteCode = info.getString("PARENT_SITE_CODE"); String scanCenterSiteCode = info.getString("SCAN_CENTER_SITE_CODE"); String billCenterSiteCode = info.getString("BILL_CENTER_SITE_CODE"); String siteTypeName = info.getString("SITE_TYPE_NAME"); Double codLimitAmount = info.getDouble("COD_LIMIT_AMOUNT"); Double podLimitAmount = info.getDouble("POD_LIMIT_AMOUNT"); Integer siteStatus = info.getInt("SITE_STATUS"); String moneyTypeName = info.getString("MONEY_TYPE_NAME"); String countryName = info.getString("COUNTRY_NAME"); String provinceName = info.getString("PROVINCE_NAME"); String cityName = info.getString("CITY_NAME"); String countyName = info.getString("COUNTY_NAME"); String address = info.getString("ADDRESS"); String areaName = info.getString("AREA_NAME"); Integer siteservicesType = info.getInt("SITE_SERVICES_TYPE"); Integer rdStatus = info.getInt("RD_STATUS"); //??, if (info.toString().contains("FIRST_CENTER_SITE_CODE")) { String firstCenterSiteCode = info.getString("FIRST_CENTER_SITE_CODE"); // map.put("siteCode", firstCenterSiteCode == null ? "" : firstCenterSiteCode); List<BasicSiteVO> firstSiteList = siteDao.querySiteByTotal(map); if (firstSiteList != null && firstSiteList.size() > 0) { site.setFirstCenterSiteId(firstSiteList.get(0).getSiteId()); } } //,?? if ("88888".equals(siteCode)) { continue; } if (("".equals(siteCode)) || ("".equals(siteName))) { continue; } //??? site.setSiteCode(siteCode); site.setSiteName(siteName); if (!ValidateUtil.isEmpty(siteName)) { if (!ValidateUtil.isNumeric(siteName)) { String siteNamePinyin = getFirstPinYin(siteName.trim()); String[] names = siteNamePinyin.split(","); if ("".equals(names)) { site.setSitePinyin("/"); } else { site.setSitePinyin(names[0]); } } else { site.setSitePinyin("/"); } } else { site.setSitePinyin("/"); } //? Long siteOrder = siteService.getMaxSiteOrder() + 1; site.setSiteOrder(siteOrder == null ? 1 : siteOrder); //? map.put("siteCode", parentSiteCode); List<BasicSiteVO> parentSiteList = siteService.querySiteByTotal(map); if (parentSiteList != null && parentSiteList.size() > 0) { site.setParentSiteId(parentSiteList.get(0).getSiteId()); } else { site.setParentSiteId(new Long(0)); } //??? site.setScanCenterSiteId(new Long(2002)); //??? site.setBillCenterSiteId(new Long(2002)); //? List<BasicDictVO> dictList = dictDao.queryDictByName(siteTypeName); if (dictList != null && dictList.size() > 0) { site.setSiteTypeId(dictList.get(0).getDictId()); } else { site.setSiteTypeId(new Long(0)); } // site.setBlFinance(0); //?? site.setPodLimitAmount(podLimitAmount); site.setCodLimitAmount(codLimitAmount); site.setAirplaneLimitAmount(99999999.99); //? site.setSiteState(siteStatus.intValue() == 0 ? 1 : 0); //?ID List<BasicDictVO> moneyTypeList = dictDao.queryDictByName(moneyTypeName); if (moneyTypeList != null && moneyTypeList.size() > 0) { site.setMoneyTypeId(moneyTypeList.get(0).getDictId()); } else { site.setMoneyTypeId(new Long(0)); } // site.setStarLevel(1); //?? site.setRdStatus(rdStatus); // site.setDispSiteId(new Long(0)); //??? detailSite.setPhoneSms("/"); detailSite.setFax("/"); detailSite.setPostCode("/"); detailSite.setAddress(address); //? BasicCountryVO countryVO = countryService.queryCountryByName(countryName); detailSite.setCountryId(countryVO == null ? 0 : countryVO.getCountryId()); //?? BasicProvinceVO provinceVO = provinceService .queryProvinceByName(countryVO == null ? 0 : countryVO.getCountryId(), provinceName); if (provinceVO != null) { detailSite.setProvinceId(provinceVO.getProvinceId()); } else { detailSite.setProvinceId(new Long(0)); } //? List<BasicCityVO> cityList = cityDao.queryCityByName(cityName); Long cityId = null; if (cityList.size() > 0 && cityList != null) { cityId = cityList.get(0).getCityId(); detailSite.setCityId(cityId == null ? 0 : cityId); //? BasicCountyVO countyVO = countyService.queryCountyByNameAndCityId(cityId, countyName); detailSite.setCountyId(countyVO == null ? 0 : countyVO.getCountyId()); } else { cityId = new Long(0); detailSite.setCityId(cityId); //? BasicCountyVO countyVO = countyService.queryCountyByNameAndCityId(cityId, countyName); if (countyVO != null) { detailSite.setCountyId(countyVO.getCountyId()); } else { detailSite.setCountyId(new Long(0)); } } //? List<BasicAreaVO> areaList = areaDao.queryAreaByName(areaName); if (areaList != null && areaList.size() > 0) { detailSite.setAreaId(areaList.get(0).getAreaId() == null ? 0 : areaList.get(0).getAreaId()); } else { detailSite.setAreaId(new Long(0)); } // detailSite.setBlWeb(0); //????() detailSite.setNormalTeuIn(new Long(0)); detailSite.setNormalTeuOut(new Long(0)); //????() detailSite.setMaxTeuIn(new Long(0)); detailSite.setMaxTeuOut(new Long(0)); // detailSite.setMaxStayRatio(new Float(0.000)); // detailSite.setMaxProblemRatio(new Float(0.000)); //? detailSite.setSiteServicesType(siteservicesType); //? detailSite.setCargoCenterSiteId(new Long(0)); map.put("siteCode", siteCode); List<BasicSiteVO> siteList = siteService.querySiteByTotal(map); if (siteList != null && siteList.size() > 0) { //? site.setSiteId(siteList.get(0).getSiteId()); detailSite.setSiteId(siteList.get(0).getSiteId()); site.setModifiedBy(new Long(0)); site.setModifiedTime(basicInterfaceDao.getCurrentTime()); // basicInterfaceDao.doUpdateSiteVO(site, detailSite); siteDao.doModifySite(site); siteDetailDao.doModifySiteDetail(detailSite); } else { //??? site.setCreatedBy(new Long(0)); site.setCreatedTime(basicInterfaceDao.getCurrentTime()); site.setModifiedBy(null); site.setModifiedTime(null); // basicInterfaceDao.doCreatedSiteVO(site, detailSite); Long siteId = siteDao.doCreateSite(site); detailSite.setSiteId(siteId); siteDetailDao.doCreateSiteDetail(detailSite); } } catch (Exception e) { errList.add(siteCode + "" + e.getMessage()); log.error("[error:??;]", e); continue; } } return errList; }
From source file:com.cognitect.transit.TransitTest.java
public void testWriteFloatDouble() throws Exception { assertEquals(scalarVerbose("42.5"), writeJsonVerbose(42.5)); assertEquals(scalarVerbose("42.5"), writeJsonVerbose(new Float("42.5"))); assertEquals(scalarVerbose("42.5"), writeJsonVerbose(new Double("42.5"))); }
From source file:edu.hawaii.soest.hioos.isus.ISUSFrame.java
public double getAuxConcentration3() { this.auxConcentration3.flip(); return (new Float(this.auxConcentration3.getFloat())).doubleValue(); }
From source file:org.squale.squaleweb.applicationlayer.action.export.ppt.AuditReportPPTData.java
/** * Add array of results for the application in a slide * /*from ww w. ja v a 2 s.co m*/ * @param slideToSet slide to set * @param where place to add results * @throws IOException if error * @throws PPTGeneratorException */ public void setApplicationQualityResults(Slide slideToSet, Rectangle where) throws IOException, PPTGeneratorException { log.info("AuditReturn - setApplicationQualityResults"); // Create map for fill table TreeMap factorsMap = new TreeMap(); for (int i = 0; i < projectReports.size(); i++) { log.info("AuditReturn - setApplicationQualityResults Project n" + i); ProjectReportDTO curProject = (ProjectReportDTO) projectReports.get(i); for (int j = 0; j < curProject.getQualityResults().size(); j++) { QualityReportDTO factor = (QualityReportDTO) curProject.getQualityResults().get(j); String factorName = WebMessages.getString(request, factor.getRule().getName()); TreeMap results = (TreeMap) factorsMap.get(factorName); if (results == null) { results = new TreeMap(); } results.put(curProject.getName(), new Float[] { new Float(factor.getMeanMark()), new Float(factor.getPreviousScore()) }); factorsMap.put(factorName, results); } } // create table and add it to the slide in function of the map previously created createApplicationResultsTable(slideToSet, where, factorsMap); log.info("AuditReturn - setApplicationQualityResults done"); }
From source file:com.salesmanager.core.util.ProductUtil.java
public static String formatHTMLProductPrice(Locale locale, String currency, Product view, boolean showDiscountDate, boolean shortDiscountFormat) { if (currency == null) { log.error("Currency is null ..."); return "-N/A-"; }/*w ww . j ava 2 s.c o m*/ int decimalPlace = 2; String prefix = ""; String suffix = ""; Map currenciesmap = RefCache.getCurrenciesListWithCodes(); Currency c = (Currency) currenciesmap.get(currency); // regular price BigDecimal bdprodprice = view.getProductPrice(); Date dt = new Date(); // discount price java.util.Date spdate = null; java.util.Date spenddate = null; BigDecimal bddiscountprice = null; Special special = view.getSpecial(); if (special != null) { spdate = special.getSpecialDateAvailable(); spenddate = special.getExpiresDate(); if (spdate.before(new Date(dt.getTime())) && spenddate.after(new Date(dt.getTime()))) { bddiscountprice = special.getSpecialNewProductPrice(); } } // all other prices Set prices = view.getPrices(); if (prices != null) { Iterator pit = prices.iterator(); while (pit.hasNext()) { ProductPrice pprice = (ProductPrice) pit.next(); if (pprice.isDefaultPrice()) { pprice.setLocale(locale); suffix = pprice.getPriceSuffix(); bddiscountprice = null; spdate = null; spenddate = null; bdprodprice = pprice.getProductPriceAmount(); ProductPriceSpecial ppspecial = pprice.getSpecial(); if (ppspecial != null) { if (ppspecial.getProductPriceSpecialStartDate() != null && ppspecial.getProductPriceSpecialEndDate() != null) { spdate = ppspecial.getProductPriceSpecialStartDate(); spenddate = ppspecial.getProductPriceSpecialEndDate(); } bddiscountprice = ppspecial.getProductPriceSpecialAmount(); } break; } } } double fprodprice = 0; ; if (bdprodprice != null) { fprodprice = bdprodprice.setScale(decimalPlace, BigDecimal.ROUND_HALF_UP).doubleValue(); } // regular price String String regularprice = CurrencyUtil.displayFormatedCssAmountWithCurrency(bdprodprice, currency); // discount price String String discountprice = null; String savediscount = null; if (bddiscountprice != null && (spdate != null && spdate.before(new Date(dt.getTime())) && spenddate.after(new Date(dt.getTime())))) { double fdiscountprice = bddiscountprice.setScale(decimalPlace, BigDecimal.ROUND_HALF_UP).doubleValue(); discountprice = CurrencyUtil.displayFormatedAmountWithCurrency(bddiscountprice, currency); double arith = fdiscountprice / fprodprice; double fsdiscount = 100 - arith * 100; Float percentagediscount = new Float(fsdiscount); savediscount = String.valueOf(percentagediscount.intValue()); } StringBuffer p = new StringBuffer(); p.append("<div class='product-price'>"); if (discountprice == null) { p.append("<div class='product-price-price' style='width:50%;float:left;'>"); p.append(regularprice); if (!StringUtils.isBlank(suffix)) { p.append(suffix).append(" "); } p.append("</div>"); p.append("<div class='product-line'> </div>"); } else { p.append("<div style='width:50%;float:left;'>"); p.append("<strike>").append(regularprice); if (!StringUtils.isBlank(suffix)) { p.append(suffix).append(" "); } p.append("</strike>"); p.append("</div>"); p.append("<div style='width:50%;float:right;'>"); p.append("<font color='red'>").append(discountprice); if (!StringUtils.isBlank(suffix)) { p.append(suffix).append(" "); } p.append("</font>"); if (!shortDiscountFormat) { p.append("<br>").append("<font color='red' style='font-size:75%;'>") .append(LabelUtil.getInstance().getText(locale, "label.generic.save")).append(": ") .append(savediscount) .append(LabelUtil.getInstance().getText(locale, "label.generic.percentsign")).append(" ") .append(LabelUtil.getInstance().getText(locale, "label.generic.off")).append("</font>"); } if (showDiscountDate && spenddate != null) { p.append("<br>").append(" <font style='font-size:65%;'>") .append(LabelUtil.getInstance().getText(locale, "label.generic.until")).append(" ") .append(DateUtil.formatDate(spenddate)).append("</font>"); } p.append("</div>").toString(); } p.append("</div>"); return p.toString(); }
From source file:cx.fbn.nevernote.sql.NoteTable.java
public Note mapNoteFromQuery(NSqlQuery query, boolean loadContent, boolean loadResources, boolean loadRecognition, boolean loadBinary, boolean loadTags) { DateFormat indfm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S"); // indfm = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy"); Note n = new Note(); NoteAttributes na = new NoteAttributes(); n.setAttributes(na);/*from w w w . ja v a2 s . com*/ n.setGuid(query.valueString(0)); n.setUpdateSequenceNum(new Integer(query.valueString(1))); n.setTitle(query.valueString(2)); try { n.setCreated(indfm.parse(query.valueString(3)).getTime()); n.setUpdated(indfm.parse(query.valueString(4)).getTime()); n.setDeleted(indfm.parse(query.valueString(5)).getTime()); } catch (ParseException e) { e.printStackTrace(); } n.setActive(query.valueBoolean(6, true)); n.setNotebookGuid(query.valueString(7)); try { String attributeSubjectDate = query.valueString(8); if (!attributeSubjectDate.equals("")) na.setSubjectDate(indfm.parse(attributeSubjectDate).getTime()); } catch (ParseException e) { e.printStackTrace(); } na.setLatitude(new Float(query.valueString(9))); na.setLongitude(new Float(query.valueString(10))); na.setAltitude(new Float(query.valueString(11))); na.setAuthor(query.valueString(12)); na.setSource(query.valueString(13)); na.setSourceURL(query.valueString(14)); na.setSourceApplication(query.valueString(15)); na.setContentClass(query.valueString(16)); if (loadTags) { List<String> tagGuids = noteTagsTable.getNoteTags(n.getGuid()); List<String> tagNames = new ArrayList<String>(); TagTable tagTable = db.getTagTable(); for (int i = 0; i < tagGuids.size(); i++) { String currentGuid = tagGuids.get(i); Tag tag = tagTable.getTag(currentGuid); if (tag.getName() != null) tagNames.add(tag.getName()); else tagNames.add(""); } n.setTagNames(tagNames); n.setTagGuids(tagGuids); } if (loadContent) { QTextCodec codec = QTextCodec.codecForLocale(); codec = QTextCodec.codecForName("UTF-8"); String unicode = codec.fromUnicode(query.valueString(17)).toString(); // This is a hack. Basically I need to convert HTML Entities to "normal" text, but if I // convert the < character to < it will mess up the XML parsing. So, to get around this // I am "bit stuffing" the < to &< so StringEscapeUtils doesn't unescape it. After // I'm done I convert it back. StringBuffer buffer = new StringBuffer(unicode); if (Global.enableHTMLEntitiesFix && unicode.indexOf("&#") > 0) { unicode = query.valueString(17); //System.out.println(unicode); //unicode = unicode.replace("<", "&_lt;"); //unicode = codec.fromUnicode(StringEscapeUtils.unescapeHtml(unicode)).toString(); //unicode = unicode.replace("&_lt;", "<"); //System.out.println("************************"); int j = 1; for (int i = buffer.indexOf("&#"); i != -1 && buffer.indexOf("&#", i) > 0; i = buffer.indexOf("&#", i + 1)) { j = buffer.indexOf(";", i) + 1; if (i < j) { String entity = buffer.substring(i, j).toString(); int len = entity.length() - 1; String tempEntity = entity.substring(2, len); try { Integer.parseInt(tempEntity); entity = codec.fromUnicode(StringEscapeUtils.unescapeHtml4(entity)).toString(); buffer.delete(i, j); buffer.insert(i, entity); } catch (Exception e) { } } } } n.setContent(unicode); // n.setContent(query.valueString(16).toString()); String contentHash = query.valueString(18); if (contentHash != null) n.setContentHash(contentHash.getBytes()); n.setContentLength(new Integer(query.valueString(19))); } if (loadResources) n.setResources(noteResourceTable.getNoteResources(n.getGuid(), loadBinary)); if (loadRecognition) { if (n.getResources() == null) { List<Resource> resources = noteResourceTable.getNoteResourcesRecognition(n.getGuid()); n.setResources(resources); } else { // We need to merge the recognition resources with the note resources retrieved earlier for (int i = 0; i < n.getResources().size(); i++) { Resource r = noteResourceTable.getNoteResourceRecognition(n.getResources().get(i).getGuid()); n.getResources().get(i).setRecognition(r.getRecognition()); } } } n.setContent(fixCarriageReturn(n.getContent())); return n; }
From source file:edu.cornell.mannlib.vitro.webapp.dao.jena.JenaBaseDao.java
protected Float getPropertyFloatValue(OntResource res, Property prop) { if (prop != null) { try {//from ww w . j a va 2s .co m return new Float(((Literal) res.getPropertyValue(prop)).getFloat()); } catch (Exception e) { return null; } } else return null; }
From source file:edu.hawaii.soest.hioos.isus.ISUSFrame.java
public double getRmsError() { this.rmsError.flip(); return (new Float(this.rmsError.getFloat())).doubleValue(); }