List of usage examples for java.lang Float toString
public static String toString(float f)
From source file:org.mskcc.cbio.portal.dao.DaoMutation.java
public static int addMutationEvent(ExtendedMutation.MutationEvent event) throws DaoException { // use this code if bulk loading // write to the temp file maintained by the MySQLbulkLoader String keyword = MutationKeywordUtils.guessOncotatorMutationKeyword(event.getProteinChange(), event.getMutationType());/* www . ja v a 2 s . c om*/ MySQLbulkLoader.getMySQLbulkLoader("mutation_event").insertRecord(Long.toString(event.getMutationEventId()), Long.toString(event.getGene().getEntrezGeneId()), event.getChr(), Long.toString(event.getStartPosition()), Long.toString(event.getEndPosition()), event.getReferenceAllele(), event.getTumorSeqAllele(), event.getProteinChange(), event.getMutationType(), event.getFunctionalImpactScore(), Float.toString(event.getFisValue()), event.getLinkXVar(), event.getLinkPdb(), event.getLinkMsa(), event.getNcbiBuild(), event.getStrand(), event.getVariantType(), event.getDbSnpRs(), event.getDbSnpValStatus(), event.getOncotatorDbSnpRs(), event.getOncotatorRefseqMrnaId(), event.getOncotatorCodonChange(), event.getOncotatorUniprotName(), event.getOncotatorUniprotAccession(), Integer.toString(event.getOncotatorProteinPosStart()), Integer.toString(event.getOncotatorProteinPosEnd()), boolToStr(event.isCanonicalTranscript()), keyword == null ? "\\N" : (event.getGene().getHugoGeneSymbolAllCaps() + " " + keyword)); return 1; }
From source file:org.investovator.controller.config.ConfigGenerator.java
/** * Overrides initial price./*from ww w. j a v a2s . c o m*/ * @param price */ public void setInitialPrice(float price) { properties.put("$initialPrice", Float.toString(price)); }
From source file:model.Modele.java
/** * Methode qui sauvegarde les donnes dans des objets (RAM) * * @param file le fichier sauvegarder//from ww w. j ava 2 s . c o m * @return le nom de fichier pour l'afficher sur la rubrique des donnes */ public String Save_data(File file) { String last_last_1 = null; String last_last_2 = null; try (BufferedReader br = new BufferedReader(new FileReader(file))) { final String fileName = file.toURI().toString(); String fileNamelast = null; String[] fileNames = fileName.toString().split("/"); String last_part = fileNames[7]; String[] parts = last_part.split("\\."); String last_last_part = parts[1]; last_last_1 = last_last_part.substring(0, 4); last_last_2 = last_last_part.substring(4, 6); List<String> row = new ArrayList<>(); String line; donnes = new ArrayList<>(); boolean line_one = false; double val_proggress = 0.0; while ((line = br.readLine()) != null) { if (line_one) { row.clear(); donnes.add(line); int i = 0; for (String retval : line.split(";")) { if (i == 0 || i == 1 || i == 7 || i == 9 || i == 14) { row.add(retval); } i++; } if (row.size() == 5) { String c; if (!row.get(2).equals("mq")) { Float kelvin = Float.parseFloat(row.get(2)); Float celsius = kelvin - 273.15F; c = Float.toString(celsius); } else { c = "0"; } //conversion des erreurs : if (row.get(0).equals("mq")) { row.set(0, "0"); } if (row.get(1).equals("mq")) { row.set(1, "0"); } if (row.get(2).equals("mq")) { row.set(2, "0"); } if (row.get(3).equals("mq")) { row.set(3, "0"); } if (row.get(4).equals("mq")) { row.set(4, "0"); } add_or_create(row, c); } } line_one = true; } } catch (IOException ex) { Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex); } list_donnee.add("DATA existe, Date : " + last_last_1 + " - " + last_last_2); return "DATA existe, Date : " + last_last_1 + " - " + last_last_2; }
From source file:org.openhab.binding.max.internal.message.C_Message.java
private void parseHeatingThermostatData(byte[] bytes) { try {//www . ja v a2 s .com int plusDataStart = 18; int programDataStart = 11; tempComfort = Float.toString(bytes[plusDataStart] / 2); tempEco = Float.toString(bytes[plusDataStart + 1] / 2); tempSetpointMax = Float.toString(bytes[plusDataStart + 2] / 2); tempSetpointMin = Float.toString(bytes[plusDataStart + 3] / 2); properties.put("Temp Comfort", tempComfort); properties.put("Temp Eco", tempEco); properties.put("Temp Setpoint Max", tempSetpointMax); properties.put("Temp Setpoint Min", tempSetpointMin); if (bytes.length < 211) { // Device is a WallMountedThermostat programDataStart = 4; logger.trace("WallThermostat byte {}: {}", bytes.length - 3, Float.toString(bytes[bytes.length - 3] & 0xFF)); logger.trace("WallThermostat byte {}: {}", bytes.length - 2, Float.toString(bytes[bytes.length - 2] & 0xFF)); logger.trace("WallThermostat byte {}: {}", bytes.length - 1, Float.toString(bytes[bytes.length - 1] & 0xFF)); } else { // Device is a HeatingThermostat(+) tempOffset = Double.toString((bytes[plusDataStart + 4] / 2) - 3.5); tempOpenWindow = Float.toString(bytes[plusDataStart + 5] / 2); durationOpenWindow = Float.toString(bytes[plusDataStart + 6]); boostDuration = Float.toString(bytes[plusDataStart + 7] & 0xFF >> 5); boostValve = Float.toString((bytes[plusDataStart + 7] & 0x1F) * 5); decalcification = Float.toString(bytes[plusDataStart + 8]); valveMaximum = Float.toString(bytes[plusDataStart + 9] & 0xFF * 100 / 255); valveOffset = Float.toString(bytes[plusDataStart + 10] & 0xFF * 100 / 255); properties.put("Temp Offset", tempOffset); properties.put("Temp Open Window", tempOpenWindow); properties.put("Duration Open Windoww", durationOpenWindow); properties.put("Duration Boost", boostDuration); properties.put("Duration Boost", boostValve); properties.put("Decalcification", decalcification); properties.put("ValveMaximum", valveMaximum); properties.put("ValveOffset", valveOffset); } programData = ""; int ln = 13 * 6; //first day = Sat String startTime = "00:00h"; for (int char_idx = plusDataStart + programDataStart; char_idx < (plusDataStart + programDataStart + 26 * 7); char_idx++) { if (ln % 13 == 0) { programData += "\r\n Day " + Integer.toString((ln / 13) % 7) + ": "; startTime = "00:00h"; } int progTime = (bytes[char_idx + 1] & 0xFF) * 5 + (bytes[char_idx] & 0x01) * 1280; int progMinutes = progTime % 60; int progHours = (progTime - progMinutes) / 60; String endTime = Integer.toString(progHours) + ":" + String.format("%02d", progMinutes) + "h"; programData += startTime + "-" + endTime + " " + Double.toString(bytes[char_idx] / 4) + "C "; startTime = endTime; char_idx++; ln++; } } catch (Exception e) { logger.debug("Exception occurred during heater data: {}", e.getMessage(), e); } return; }
From source file:com.jaeksoft.searchlib.crawler.FieldMapGeneric.java
public void store(XmlWriter xmlWriter) throws SAXException { for (GenericLink<S, T> link : getList()) { T target = link.getTarget();//w w w . j a va 2 s . c o m xmlWriter.startElement("link", "source", link.getSource().toXmlAttribute(), "target", target.toXmlAttribute(), "analyzer", target.getAnalyzer(), "boost", target.getBoost() == null ? null : Float.toString(target.getBoost())); writeTarget(xmlWriter, link.getTarget()); xmlWriter.endElement(); } }
From source file:com.nextgis.firereporter.SendReportActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.report);//from w w w . j a v a2 s . c o m //add fragment FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); frCompass = (CompassFragment) getSupportFragmentManager().findFragmentByTag("COMPASS"); if (frCompass == null) { frCompass = new CompassFragment(); fragmentTransaction.add(R.id.compass_fragment_container, frCompass, "COMPASS").commit(); } getSupportFragmentManager().executePendingTransactions(); getSupportActionBar().setHomeButtonEnabled(true); edLatitude = (EditText) findViewById(R.id.edLatitude); edLongitude = (EditText) findViewById(R.id.edLongitude); edAzimuth = (EditText) findViewById(R.id.edAzimuth); edDistance = (EditText) findViewById(R.id.edDistance); edComment = (EditText) findViewById(R.id.edComment); edDistance.setText("100"); mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); if (mLocationManager != null) { for (String aProvider : mLocationManager.getProviders(false)) { if (aProvider.equals(LocationManager.GPS_PROVIDER)) { gpsAvailable = true; } } if (gpsAvailable) { Location location = mLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (location != null) { float lat = (float) (location.getLatitude()); float lon = (float) (location.getLongitude()); edLatitude.setText(Float.toString(lat)); edLongitude.setText(Float.toString(lon)); } else { edLatitude.setText(getString(R.string.noLocation)); edLongitude.setText(getString(R.string.noLocation)); } mLocationListener = new LocationListener() { public void onStatusChanged(String provider, int status, Bundle extras) { switch (status) { case LocationProvider.OUT_OF_SERVICE: break; case LocationProvider.TEMPORARILY_UNAVAILABLE: break; case LocationProvider.AVAILABLE: break; } } public void onProviderEnabled(String provider) { } public void onProviderDisabled(String provider) { } public void onLocationChanged(Location location) { float lat = (float) (location.getLatitude()); float lon = (float) (location.getLongitude()); edLatitude.setText(Float.toString(lat)); edLongitude.setText(Float.toString(lon)); // FIXME: also need to calculate declination? } }; // location listener } else { edLatitude.setText(getString(R.string.noGPS)); edLongitude.setText(getString(R.string.noGPS)); edLatitude.setEnabled(false); edLongitude.setEnabled(false); } } mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); boolean accelerometerAvailable = false; boolean magnetometerAvailable = false; for (Sensor aSensor : mSensorManager.getSensorList(Sensor.TYPE_ALL)) { if (aSensor.getType() == Sensor.TYPE_ACCELEROMETER) { accelerometerAvailable = true; } else if (aSensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) { magnetometerAvailable = true; } } compassAvailable = accelerometerAvailable && magnetometerAvailable; if (compassAvailable) { //frCompass = (CompassFragment) getSupportFragmentManager().findFragmentByTag("COMPASS"); if (frCompass != null) { frCompass.SetAzimuthCtrl(edAzimuth); } } else { edAzimuth.setText(getString(R.string.noCompass)); edAzimuth.setEnabled(false); } }
From source file:com.clican.pluto.common.resource.MapResource.java
public void setFloat(String key, float val) { put(key, Float.toString(val)); }
From source file:org.yamj.core.configuration.ConfigService.java
public void setProperty(String key, float value) { setProperty(key, Float.toString(value)); }
From source file:org.javelin.sws.ext.bind.internal.BuiltInMappings.java
/** * @param patterns/*from www . ja v a 2 s . co m*/ */ public static <T> void initialize(Map<Class<?>, TypedPattern<?>> patterns, Map<QName, TypedPattern<?>> patternsForTypeQNames) { // see: com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl<T> and inner // com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.StringImpl<T> implementations // we have two places where XSD -> Java mapping is defined: // - JAX-RPC 1.1, section 4.2.1 Simple Types // - JAXB 2, section 6.2.2 Atomic Datatype // XML Schema (1.0) Part 2: Datatypes Second Edition, or/and // W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypes // conversion of primitive types should be base on "Lexical Mapping" of simple types defined in XSD part 2 // 3.2 Special Built-in Datatypes (#special-datatypes) // 3.2.1 anySimpleType (#anySimpleType) // 3.2.2 anyAtomicType (#anyAtomicType) // 3.3 Primitive Datatypes (#built-in-primitive-datatypes) // 3.3.1 string (#string) { SimpleContentPattern<String> pattern = SimpleContentPattern.newValuePattern(SweJaxbConstants.XSD_STRING, String.class); patterns.put(pattern.getJavaType(), pattern); patternsForTypeQNames.put(pattern.getSchemaType(), pattern); } // 3.3.2 boolean (#boolean) { SimpleContentPattern<Boolean> pattern = SimpleContentPattern .newValuePattern(SweJaxbConstants.XSD_BOOLEAN, Boolean.class); patterns.put(Boolean.TYPE, pattern); patterns.put(pattern.getJavaType(), pattern); patternsForTypeQNames.put(pattern.getSchemaType(), pattern); pattern.setFormatter(new Formatter<Boolean>() { @Override public String print(Boolean object, Locale locale) { return Boolean.toString(object); } @Override public Boolean parse(String text, Locale locale) throws ParseException { // TODO: should allow "true", "false", "1", "0" return Boolean.parseBoolean(text); } }); } // 3.3.3 decimal (#decimal) { SimpleContentPattern<BigDecimal> pattern = SimpleContentPattern .newValuePattern(SweJaxbConstants.XSD_DECIMAL, BigDecimal.class); patterns.put(pattern.getJavaType(), pattern); patternsForTypeQNames.put(pattern.getSchemaType(), pattern); pattern.setFormatter(new Formatter<BigDecimal>() { @Override public String print(BigDecimal object, Locale locale) { return object.toPlainString(); } @Override public BigDecimal parse(String text, Locale locale) throws ParseException { // TODO: should allow (\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+) return new BigDecimal(text); } }); } // 3.3.4 float (#float) { SimpleContentPattern<Float> pattern = SimpleContentPattern.newValuePattern(SweJaxbConstants.XSD_FLOAT, Float.class); patterns.put(Float.TYPE, pattern); patterns.put(pattern.getJavaType(), pattern); patternsForTypeQNames.put(pattern.getSchemaType(), pattern); pattern.setFormatter(new Formatter<Float>() { @Override public String print(Float object, Locale locale) { return Float.toString(object); } @Override public Float parse(String text, Locale locale) throws ParseException { // TODO: should allow (\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN return Float.parseFloat(text); } }); } // 3.3.5 double (#double) { SimpleContentPattern<Double> pattern = SimpleContentPattern.newValuePattern(SweJaxbConstants.XSD_DOUBLE, Double.class); patterns.put(Double.TYPE, pattern); patterns.put(pattern.getJavaType(), pattern); patternsForTypeQNames.put(pattern.getSchemaType(), pattern); pattern.setFormatter(new Formatter<Double>() { @Override public String print(Double object, Locale locale) { return Double.toString(object); } @Override public Double parse(String text, Locale locale) throws ParseException { // TODO: should allow (\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN return Double.parseDouble(text); } }); } // 3.3.6 duration (#duration) // 3.3.7 dateTime (#dateTime) { SimpleContentPattern<DateTime> pattern = SimpleContentPattern .newValuePattern(SweJaxbConstants.XSD_DATETIME, DateTime.class); patterns.put(pattern.getJavaType(), pattern); patternsForTypeQNames.put(pattern.getSchemaType(), pattern); pattern.setFormatter(new Formatter<DateTime>() { private final DateTimeFormatter DTMS = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZZ"); private final DateTimeFormatter DT = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZZ"); private final DateTimeFormatter DTZMS = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); private final DateTimeFormatter DTZ = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss'Z'"); @Override public DateTime parse(String text, Locale locale) throws ParseException { return null; } @Override public String print(DateTime object, Locale locale) { if (object.getMillisOfSecond() == 0) { return object.getZone() == DateTimeZone.UTC ? DTZ.print(object) : DT.print(object); } else { return object.getZone() == DateTimeZone.UTC ? DTZMS.print(object) : DTMS.print(object); } } }); } // 3.3.8 time (#time) { SimpleContentPattern<DateTime> pattern = SimpleContentPattern.newValuePattern(SweJaxbConstants.XSD_TIME, DateTime.class); patternsForTypeQNames.put(pattern.getSchemaType(), pattern); pattern.setFormatter(new Formatter<DateTime>() { private final DateTimeFormatter TMS = DateTimeFormat.forPattern("HH:mm:ss.SSS"); private final DateTimeFormatter T = DateTimeFormat.forPattern("HH:mm:ss"); @Override public DateTime parse(String text, Locale locale) throws ParseException { return null; } @Override public String print(DateTime object, Locale locale) { // TODO: should allow (([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))? if (object.getMillisOfSecond() == 0) return T.print(object); else return TMS.print(object); } }); } // 3.3.9 date (#date) { SimpleContentPattern<DateTime> pattern = SimpleContentPattern.newValuePattern(SweJaxbConstants.XSD_DATE, DateTime.class); patternsForTypeQNames.put(pattern.getSchemaType(), pattern); pattern.setFormatter(new Formatter<DateTime>() { private final DateTimeFormatter DT = DateTimeFormat.forPattern("yyyy-MM-ddZZ"); private final DateTimeFormatter DTZ = DateTimeFormat.forPattern("yyyy-MM-dd'Z'"); @Override public DateTime parse(String text, Locale locale) throws ParseException { return null; } @Override public String print(DateTime object, Locale locale) { return object.getZone() == DateTimeZone.UTC ? DTZ.print(object) : DT.print(object); } }); } // 3.3.10 gYearMonth (#gYearMonth) // 3.3.11 gYear (#gYear) // 3.3.12 gMonthDay (#gMonthDay) // 3.3.13 gDay (#gDay) // 3.3.14 gMonth (#gMonth) // 3.3.15 hexBinary (#hexBinary) // 3.3.16 base64Binary (#base64Binary) // 3.3.17 anyURI (#anyURI) // 3.3.18 QName (#QName) // 3.3.19 NOTATION (#NOTATION) // 3.4 Other Built-in Datatypes (#ordinary-built-ins) // 3.4.1 normalizedString (#normalizedString) // 3.4.2 token (#token) // 3.4.3 language (#language) // 3.4.4 NMTOKEN (#NMTOKEN) // 3.4.5 NMTOKENS (#NMTOKENS) // 3.4.6 Name (#Name) // 3.4.7 NCName (#NCName) // 3.4.8 ID (#ID) // 3.4.9 IDREF (#IDREF) // 3.4.10 IDREFS (#IDREFS) // 3.4.11 ENTITY (#ENTITY) // 3.4.12 ENTITIES (#ENTITIES) // 3.4.13 integer (#integer) // 3.4.14 nonPositiveInteger (#nonPositiveInteger) // 3.4.15 negativeInteger (#negativeInteger) // 3.4.16 long (#long) { SimpleContentPattern<Long> pattern = SimpleContentPattern.newValuePattern(SweJaxbConstants.XSD_LONG, Long.class); patterns.put(Long.TYPE, pattern); patterns.put(pattern.getJavaType(), pattern); patternsForTypeQNames.put(pattern.getSchemaType(), pattern); pattern.setFormatter(new Formatter<Long>() { @Override public String print(Long object, Locale locale) { return Long.toString(object); } @Override public Long parse(String text, Locale locale) throws ParseException { return Long.parseLong(text); } }); } // 3.4.17 int (#int) { SimpleContentPattern<Integer> pattern = SimpleContentPattern.newValuePattern(SweJaxbConstants.XSD_INT, Integer.class); patterns.put(Integer.TYPE, pattern); patterns.put(pattern.getJavaType(), pattern); patternsForTypeQNames.put(pattern.getSchemaType(), pattern); pattern.setFormatter(new Formatter<Integer>() { @Override public String print(Integer object, Locale locale) { return Integer.toString(object); } @Override public Integer parse(String text, Locale locale) throws ParseException { return Integer.parseInt(text); } }); } // 3.4.18 short (#short) { SimpleContentPattern<Short> pattern = SimpleContentPattern.newValuePattern(SweJaxbConstants.XSD_SHORT, Short.class); patterns.put(Short.TYPE, pattern); patterns.put(pattern.getJavaType(), pattern); patternsForTypeQNames.put(pattern.getSchemaType(), pattern); pattern.setFormatter(new Formatter<Short>() { @Override public String print(Short object, Locale locale) { return Short.toString(object); } @Override public Short parse(String text, Locale locale) throws ParseException { return Short.parseShort(text); } }); } // 3.4.19 byte (#byte) { SimpleContentPattern<Byte> pattern = SimpleContentPattern.newValuePattern(SweJaxbConstants.XSD_BYTE, Byte.class); patterns.put(Byte.TYPE, pattern); patterns.put(pattern.getJavaType(), pattern); patternsForTypeQNames.put(pattern.getSchemaType(), pattern); pattern.setFormatter(new Formatter<Byte>() { @Override public String print(Byte object, Locale locale) { return Byte.toString(object); } @Override public Byte parse(String text, Locale locale) throws ParseException { return Byte.parseByte(text); } }); } // 3.4.20 nonNegativeInteger (#nonNegativeInteger) // 3.4.21 unsignedLong (#unsignedLong) // 3.4.22 unsignedInt (#unsignedInt) // 3.4.23 unsignedShort (#unsignedShort) // 3.4.24 unsignedByte (#unsignedByte) // 3.4.25 positiveInteger (#positiveInteger) // 3.4.26 yearMonthDuration (#yearMonthDuration) // 3.4.27 dayTimeDuration (#dayTimeDuration) // 3.4.28 dateTimeStamp (#dateTimeStamp) // other simple types // JAXB2 (static): /* class [B class char class java.awt.Image class java.io.File class java.lang.Character class java.lang.Class class java.lang.Void class java.math.BigDecimal class java.math.BigInteger class java.net.URI class java.net.URL class java.util.Calendar class java.util.Date class java.util.GregorianCalendar class java.util.UUID class javax.activation.DataHandler class javax.xml.datatype.Duration class javax.xml.datatype.XMLGregorianCalendar class javax.xml.namespace.QName interface javax.xml.transform.Source class void */ // JAXB2 (additional mappings available at runtime): /* * class com.sun.xml.bind.api.CompositeStructure * class java.lang.Object * class javax.xml.bind.JAXBElement */ }