List of usage examples for java.lang Double valueOf
@HotSpotIntrinsicCandidate public static Double valueOf(double d)
From source file:com.ottogroup.bi.streaming.operator.json.aggregate.functions.DoubleContentAggregateFunctionTest.java
/** * Test case for {@link DoubleContentAggregateFunction#sum(Double, Double)} being * provided null as input to new sum parameter *//*from w w w .j a va 2 s . c om*/ @Test public void testSum_withNullNewSum() throws Exception { Assert.assertEquals(Double.valueOf(1.23), new DoubleContentAggregateFunction().sum(Double.valueOf(1.23), null)); }
From source file:com.epam.ta.reportportal.util.SystemInformatorService.java
/** * Get formatted string of server CPU usage in percent *//* ww w. j a v a 2 s. c o m*/ private float getFormattedCPU() { return Double.valueOf(oper.getSystemCpuLoad() * 100).floatValue(); }
From source file:Main.java
/** * //from w w w.ja va2s .c om * @param stringArray * @return double[] */ public static double[] toDoubleArray(final String[] stringArray) { final Collection<Double> doubleCollection = new ArrayList<>(); for (String value : stringArray) { doubleCollection.add(Double.valueOf(value)); } return toDoubleArray(doubleCollection); }
From source file:com.preferya.facadesmsgatewayrouter.providers.TwilioProvider.java
public TwilioProvider() { this.client = new TwilioRestClient(this.accountSID, this.authToken); FileReadUtils fu = new FileReadUtils("TwilioProvider.txt"); Map<String, String> mapSetting = fu.getMapProviderPropSettings(); //TODO: cargar atributos necesarios para este proveedor this.accountSID = mapSetting.get("accountSID"); this.authToken = mapSetting.get("authToken"); this.defaultPhone = mapSetting.get("defaultPhone"); this.currency = mapSetting.get("currency"); this.costBySms = mapSetting.get("costbysms"); this.saldo = mapSetting.get("saldo"); this.iva = mapSetting.get("iva"); Double _saldo = Double.valueOf(this.saldo); Double _iva = Double.valueOf(this.iva); Double _costBySms = Double.valueOf(this.costBySms); double aux = 1.0; //Para multiplicar por 1'21. this.numIntentRemaining = (int) (_saldo / (_costBySms * (aux + _iva))); fu.closeFile();//from w w w .ja v a2s . c om }
From source file:com.cloudera.oryx.kmeans.common.ClusterValidityStatistics.java
public static ClusterValidityStatistics parse(String str) { String[] pieces = DelimitedDataUtils.decode(str); Preconditions.checkArgument(pieces.length == 6, "Invalid delimited string: " + str); return new ClusterValidityStatistics(Integer.valueOf(pieces[0]), Integer.valueOf(pieces[1]), Double.valueOf(pieces[2]), Double.valueOf(pieces[3]), Double.valueOf(pieces[4]), Double.valueOf(pieces[5])); }
From source file:fr.free.movierenamer.utils.JSONUtils.java
public static Double selectDouble(String attribute, final JSONObject node) { return Double.valueOf(selectString(attribute, node)); }
From source file:net.anthonypoon.ngram.rollingregression.RollingRegressionReducer.java
@Override protected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException { TreeMap<String, Double> currElement = new TreeMap(); boolean pastThreshold = false; for (Text val : values) { String[] strArray = val.toString().split("\t"); if (Double.valueOf(strArray[1]) > threshold) { pastThreshold = true;//from w w w .j a v a 2 s . c om } currElement.put(strArray[0], Math.log(Double.valueOf(strArray[1]))); } if (pastThreshold) { for (Integer i = 0; i <= upbound - lowbound; i++) { if (!currElement.containsKey(String.valueOf(lowbound + i))) { if (i != 0) { currElement.put(String.valueOf(lowbound + i), currElement.get(String.valueOf(lowbound + i - 1))); } else { currElement.put(String.valueOf(lowbound + i), 0.0); } } } TreeMap<String, Double> result = new TreeMap(); for (Integer i = 0 + range; i <= upbound - lowbound - range; i++) { SimpleRegression regression = new SimpleRegression(); for (Integer l = -range; l <= range; l++) { regression.addData(l.doubleValue(), currElement.get(String.valueOf(i + lowbound + l))); } if (!Double.isNaN(regression.getSlope())) { if (!positiveOnly || regression.getSlope() > 0) { result.put(String.valueOf(lowbound + i), regression.getSlope()); } } } for (Map.Entry<String, Double> pair : result.entrySet()) { context.write(key, new Text(pair.getKey() + "\t" + String.format("%.5f", pair.getValue()))); } } }
From source file:blue.soundObject.jmask.ItemList.java
public static Generator loadFromXML(Element data) { ItemList retVal = new ItemList(); Elements nodes = data.getElements(); while (nodes.hasMoreElements()) { Element node = nodes.next(); String nodeName = node.getName(); if (nodeName.equals("listType")) { retVal.setListType(Integer.parseInt(node.getTextString())); } else if (nodeName.equals("listItems")) { Elements items = node.getElements(); while (items.hasMoreElements()) { Element itemNode = items.next(); String itemNodeName = itemNode.getName(); if (itemNodeName.equals("item")) { retVal.listItems.add(Double.valueOf(itemNode.getTextString())); }/* w ww. jav a 2 s. co m*/ } } else if (nodeName.equals("index")) { retVal.index = Integer.parseInt(node.getTextString()); } else if (nodeName.equals("direction")) { retVal.direction = Integer.parseInt(node.getTextString()); } } return retVal; }
From source file:at.uni_salzburg.cs.ckgroup.cscpp.mapper.course.WayPoint.java
@SuppressWarnings("unchecked") @Override/*ww w. j av a 2 s .c om*/ public String toJSONString() { JSONObject obj = new JSONObject(); obj.put("latitude", Double.valueOf(point.getLatitude())); obj.put("longitude", Double.valueOf(point.getLongitude())); obj.put("altitude", Double.valueOf(point.getAltitude())); obj.put("precision", Double.valueOf(precision)); obj.put("velocity", Double.valueOf(velocity)); return obj.toString(); }
From source file:net.ceos.project.poi.annotated.bean.PerformanceObjectBuilder.java
/** * Create a PerformanceObject for tests. * /*w ww .j av a 2 s . c om*/ * @return the {@link PerformanceObject} */ public static PerformanceObject buildPerformanceObject(int multiplier) { PerformanceObject toValidate = new PerformanceObject(); toValidate.setDateAttribute1(new Date()); toValidate.setDateAttribute2(new Date()); toValidate.setDateAttribute3(new Date()); toValidate.setStringAttribute1("some string"); toValidate.setStringAttribute2("some string"); toValidate.setStringAttribute3("some string"); toValidate.setStringAttribute4("some string"); toValidate.setStringAttribute5("some string"); toValidate.setStringAttribute6("some string"); toValidate.setStringAttribute7("some string"); toValidate.setStringAttribute8("some string"); toValidate.setStringAttribute9("some string"); toValidate.setStringAttribute10("some string"); toValidate.setStringAttribute11("some string"); toValidate.setStringAttribute12("some string"); toValidate.setIntegerAttribute1(6 * multiplier); toValidate.setIntegerAttribute2(11 * multiplier); toValidate.setIntegerAttribute3(33 * multiplier); toValidate.setIntegerAttribute4(46 * multiplier); toValidate.setIntegerAttribute5(2 * multiplier); toValidate.setIntegerAttribute6(7 * multiplier); toValidate.setIntegerAttribute7(9 * multiplier); toValidate.setDoubleAttribute1(Double.valueOf("11.3") * multiplier); toValidate.setDoubleAttribute2(Double.valueOf("237.131") * multiplier); toValidate.setDoubleAttribute3(Double.valueOf("25.777") * multiplier); toValidate.setLongAttribute(Long.valueOf("1234567890") * multiplier); toValidate.setBooleanAttribute1(Boolean.TRUE); toValidate.setBooleanAttribute2(Boolean.TRUE); toValidate.setBooleanAttribute3(Boolean.FALSE); toValidate.setBooleanAttribute4(Boolean.TRUE); /* create sub object Job */ Job job = new Job(); job.setJobCode(0005); job.setJobFamily("Family Job Name"); job.setJobName("Job Name"); toValidate.setJob(job); toValidate.setIntegerPrimitiveAttribute1(2 * multiplier); toValidate.setIntegerPrimitiveAttribute2(3 * multiplier); toValidate.setIntegerPrimitiveAttribute3(11 * multiplier); toValidate.setIntegerPrimitiveAttribute4(5 * multiplier); toValidate.setIntegerPrimitiveAttribute5(12 * multiplier); toValidate.setDoublePrimitiveAttribute(44.6 * multiplier); toValidate.setLongPrimitiveAttribute(987654321L * multiplier); toValidate.setBooleanPrimitiveAttribute(true); /* create sub object AddressInfo */ AddressInfo ai = new AddressInfo(); ai.setAddress("this is the street"); ai.setNumber(99); ai.setCity("this is the city"); ai.setCityCode(70065); ai.setCountry("This is a Country"); toValidate.setAddressInfo(ai); toValidate.setFloatAttribute(14.765f * multiplier); toValidate.setFloatPrimitiveAttribute(11.1125f * multiplier); toValidate.setUnitFamily(UnitFamily.COMPONENTS); toValidate.setBigDecimalAttribute(BigDecimal.valueOf(24.777).multiply(BigDecimal.valueOf(multiplier))); // TODO add new fields below return toValidate; }