List of usage examples for java.lang Double valueOf
@HotSpotIntrinsicCandidate public static Double valueOf(double d)
From source file:tr.gov.ptt.gr1tahsilatuyg.bean.TahsilatChartBean.java
public StreamedContent getJfreeChart() { StreamedContent content = null;/*from w w w . ja v a 2 s .c o m*/ try { chartListe = tahsilatBorcService.chartVerisiGetir(); for (Object[] chartElement : chartListe) { dataset.setValue(String.valueOf(chartElement[0]), Double.valueOf(chartElement[1].toString())); } boolean legend = true, tooltip = true, urls = false; JFreeChart chart = ChartFactory.createPieChart("JFreeChart", dataset, legend, tooltip, urls); File chartFile = new File("jfreechart"); int width = 375, height = 300; ChartUtilities.saveChartAsPNG(chartFile, chart, width, height); content = new DefaultStreamedContent(new FileInputStream(chartFile), "image/png"); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } return content; }
From source file:com.ebay.jetstream.epl.EPLUtilities.java
/** * Sometimes ELP's version of cast is misbehaving * // w ww . jav a 2 s. c o m * @param object * @return */ public static Double castToDouble(Object object) { if (object != null) { if (object instanceof Double) return (Double) object; else return Double.valueOf(object.toString()); } return null; }
From source file:org.springframework.cloud.dataflow.rest.client.support.JobParameterJacksonDeserializer.java
@Override public JobParameter deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { ObjectCodec oc = jsonParser.getCodec(); JsonNode node = oc.readTree(jsonParser); final String value = node.get("value").asText(); final boolean identifying = node.get("identifying").asBoolean(); final String type = node.get("type").asText(); final JobParameter jobParameter; if (!type.isEmpty() && !type.equalsIgnoreCase("STRING")) { if ("DATE".equalsIgnoreCase(type)) { // TODO: when upgraded to Java8 use java DateTime jobParameter = new JobParameter(DateTime.parse(value).toDate(), identifying); } else if ("DOUBLE".equalsIgnoreCase(type)) { jobParameter = new JobParameter(Double.valueOf(value), identifying); } else if ("LONG".equalsIgnoreCase(type)) { jobParameter = new JobParameter(Long.valueOf(value), identifying); } else {//from ww w. j a v a 2 s . co m throw new IllegalStateException("Unsupported JobParameter type: " + type); } } else { jobParameter = new JobParameter(value, identifying); } if (logger.isDebugEnabled()) { logger.debug(String.format("jobParameter - value: %s (type: %s, isIdentifying: %s)", jobParameter.getValue(), jobParameter.getType().name(), jobParameter.isIdentifying())); } return jobParameter; }
From source file:net.sourceforge.fenixedu.presentationTier.backBeans.manager.personManagement.ManagerFunctionsManagementBackingBean.java
@Override public String associateNewFunction() throws FenixServiceException, ParseException { DateFormat format = new SimpleDateFormat("dd/MM/yyyy"); Double credits = Double.valueOf(this.getCredits()); Date beginDate_ = null, endDate_ = null; try {// www.ja v a 2 s . c o m if (this.getBeginDate() != null) { beginDate_ = format.parse(this.getBeginDate()); } else { setErrorMessage("error.notBeginDate"); return ""; } if (this.getEndDate() != null) { endDate_ = format.parse(this.getEndDate()); } else { setErrorMessage("error.notEndDate"); return ""; } AssociateNewFunctionToPerson.runAssociateNewFunctionToPerson(this.getFunctionID(), this.getPersonID(), credits, YearMonthDay.fromDateFields(beginDate_), YearMonthDay.fromDateFields(endDate_)); setErrorMessage("message.success"); return "success"; } catch (ParseException e) { setErrorMessage("error.date1.format"); } catch (FenixServiceException e) { setErrorMessage(e.getMessage()); } catch (DomainException e) { setErrorMessage(e.getMessage()); } return ""; }
From source file:com.mothsoft.alexis.engine.numeric.CorrelationCalculatorImpl.java
private static List<Double> newDoubleList(int size) { final Double zeroDotZero = Double.valueOf(0.0d); final List<Double> list = new ArrayList<Double>(size); for (int i = 0; i < size; i++) { list.add(zeroDotZero);/*w w w . j av a 2 s . c o m*/ } return list; }
From source file:kmi.taa.core.SmallSetAnalyser.java
protected void readSourceTriples(String sourceTriplesFile) { BufferedReader br = null;//w ww . jav a 2 s .c o m String line = ""; try { br = new BufferedReader(new FileReader(sourceTriplesFile)); while ((line = br.readLine()) != null) { String[] str = line.split("\t"); if (!hmf.containsKey(Integer.valueOf(str[0]))) { hmf.put(Integer.valueOf(str[0]), Double.valueOf(str[3])); } } } catch (FileNotFoundException e) { } catch (IOException e) { } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } }
From source file:net.solarnetwork.central.dras.dao.ibatis.test.IbatisEventRuleDaoTest.java
/** * Test get EventRule./* w w w.j a va 2s . co m*/ */ @Test public void getEventRuleById() { setupTestEventRule(); EventRule eventRule = eventRuleDao.get(TEST_EVENT_RULE_ID); assertNotNull(eventRule); assertNotNull(eventRule.getId()); assertEquals(TEST_EVENT_RULE_ID, eventRule.getId()); assertEquals(TEST_EVENT_RULE_NAME, eventRule.getName()); assertEquals(Double.valueOf(3), eventRule.getMin()); assertEquals(Double.valueOf(4), eventRule.getMax()); }
From source file:com.jennifer.ui.util.scale.OrdinalScale.java
public Scale rangePoints(JSONArray interval, int padding) { JSONArray domain = domain();//from ww w . j ava 2s .c om JSONArray range = new JSONArray(); double start = interval.getDouble(0); double end = interval.getDouble(1); int step = domain.length(); double unit = (end - start - padding) / step; for (int i = 0, len = domain.length(); i < len; i++) { if (i == 0) { range.put(Double.valueOf(start + padding / 2 + unit / 2)); } else { range.put(range.getDouble(i - 1) + unit); } } this.range(range); _rangeBand = unit; return this; }
From source file:tr.gov.ptt.gr1tahsilatuyg.managedbean.ChartBean.java
public StreamedContent getJfreeChart() { StreamedContent content = null;/*from w w w . j a va 2 s . co m*/ try { chartListe = tahsilatBorcService.chartVerisiGetir(); for (Object[] chartElement : chartListe) { dataset.setValue(String.valueOf(chartElement[0]), Double.valueOf(chartElement[1].toString())); } boolean legend = true, tooltip = true, urls = false; JFreeChart chart = ChartFactory.createPieChart("JFreeChart", dataset, legend, tooltip, urls); File chartFile = new File("jfreechart"); int width = 375, height = 300; ChartUtilities.saveChartAsPNG(chartFile, chart, width, height); content = new DefaultStreamedContent(new FileInputStream(chartFile), "image/png"); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } return content; }
From source file:controle.JfreeChartController.java
private DefaultCategoryDataset createDataset() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (double i = 0; i <= 10; i += 0.1) { dataset.addValue(Math.cos(Math.PI * i), "cosseno", Double.valueOf(i)); }/* w w w .java 2 s .c o m*/ return dataset; }