List of usage examples for java.lang Double Double
@Deprecated(since = "9") public Double(String s) throws NumberFormatException
From source file:it.eng.spagobi.engines.chart.bo.charttypes.dialcharts.BulletGraph.java
public void configureChart(SourceBean content) { logger.debug("IN"); super.configureChart(content); String target = (String) confParameters.get("target"); if (target != null) this.target = new Double(target); SourceBean confSB = (SourceBean) content.getAttribute("INTERVALS"); if (confSB == null) { confSB = (SourceBean) content.getAttribute("CONF.INTERVALS"); }//from w w w .j a va 2 s . c o m List confAttrsList = confSB.getAttributeAsList(INTERVAL); if (!confAttrsList.isEmpty()) { Iterator it = confAttrsList.iterator(); while (it.hasNext()) { SourceBean param = (SourceBean) it.next(); KpiInterval interval = new KpiInterval(); String min = (String) param.getAttribute(MIN_INTERVAL); String max = (String) param.getAttribute(MAX_INTERVAL); String col = (String) param.getAttribute(COLOR_INTERVAL); interval.setMin(Double.valueOf(min).doubleValue()); interval.setMax(Double.valueOf(max).doubleValue()); Color color = new Color(Integer.decode(col).intValue()); interval.setColor(color); this.intervals.add(interval); } } logger.debug("OUT"); }
From source file:at.ac.tuwien.infosys.ClientController.java
@RequestMapping(value = "/{id}", method = RequestMethod.POST) public String set(@PathVariable String id, @RequestBody Reading reading) { String result = "Received: " + id + " and " + reading; System.out.println(result);//from w ww . j av a 2 s . c om this.messagingTemplate.convertAndSend("/data", new Double(reading.getTemperature()).intValue()); return result; }
From source file:com.redhat.lightblue.metadata.types.BigDecimalTypeTest.java
@Test public void testToJson() { JsonNodeFactory jsonNodeFactory = new JsonNodeFactory(true); JsonNode jsonNode = bigDecimalType.toJson(jsonNodeFactory, Double.MAX_VALUE); assertTrue(new Double(jsonNode.asDouble()).equals(Double.MAX_VALUE)); }
From source file:nz.co.senanque.sandbox.DigitsValidatorTest.java
@Test public void testValidate() { final DigitDTO digitDTO = new DigitDTO(); final PropertyMetadataMock propertyMetadata = new PropertyMetadataMock(m_messageSource); propertyMetadata.setClass(Integer.class); final DigitsValidator digitsValidator = new DigitsValidator(); digitDTO.setIntegerDigits("9"); digitDTO.setFractionalDigits("2"); digitsValidator.init(digitDTO, propertyMetadata); digitsValidator.validate(new Double("12.34")); boolean exception = false; try {//from w w w . ja va2s .com digitsValidator.validate(new Double("12.345")); } catch (ValidationException e) { exception = true; } assertTrue(exception); digitsValidator.validate(new Double("1234.34")); }
From source file:it.eng.spagobi.engines.kpi.bo.charttypes.dialcharts.BulletGraph.java
public JFreeChart createChart() { logger.debug("IN"); Number value = null;/*from w w w .j a v a2 s . c o m*/ if (dataset == null) { logger.debug("The dataset to be represented is null"); value = new Double(0); } else { value = dataset.getValue(); } DefaultCategoryDataset datasetC = new DefaultCategoryDataset(); datasetC.addValue(value, "", ""); // customize a bar chart JFreeChart chart = ChartFactory.createBarChart(null, null, null, datasetC, PlotOrientation.HORIZONTAL, false, false, false); chart.setBorderVisible(false); CategoryPlot plot = chart.getCategoryPlot(); plot.setOutlineVisible(true); plot.setOutlinePaint(Color.BLACK); plot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0)); plot.setBackgroundPaint(null); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); plot.setRangeCrosshairVisible(false); plot.setAnchorValue(value.doubleValue()); // add the target marker if (target != null) { ValueMarker marker = new ValueMarker(target.doubleValue(), Color.BLACK, new BasicStroke(2.0f)); plot.addRangeMarker(marker, Layer.FOREGROUND); } //sets different marks for (Iterator iterator = intervals.iterator(); iterator.hasNext();) { KpiInterval interval = (KpiInterval) iterator.next(); // add the marks IntervalMarker marker = new IntervalMarker(interval.getMin(), interval.getMax(), interval.getColor()); plot.addRangeMarker(marker, Layer.BACKGROUND); logger.debug("Added new interval to the plot"); } // customize axes CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setVisible(false); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setVisible(show_axis); rangeAxis.setLabelFont(new Font("Arial", Font.PLAIN, 4)); // calculate the upper limit //double upperBound = target * upperFactor; rangeAxis.setRange(new Range(lower, upper)); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); // customize renderer BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setMaximumBarWidth(0.18); renderer.setSeriesPaint(0, Color.BLACK); /*BasicStroke d = new BasicStroke(3f,BasicStroke.CAP_ROUND ,BasicStroke.JOIN_ROUND); renderer.setSeriesOutlineStroke(0, d); renderer.setSeriesStroke(0, d); renderer.setStroke(d);*/ return chart; }
From source file:org.jfree.data.general.DefaultKeyedValueDatasetTest.java
/** * Confirm that the equals method can distinguish all the required fields. *//*from w w w. ja v a2 s . c om*/ @Test public void testEquals() { DefaultKeyedValueDataset d1 = new DefaultKeyedValueDataset("Test", new Double(45.5)); DefaultKeyedValueDataset d2 = new DefaultKeyedValueDataset("Test", new Double(45.5)); assertTrue(d1.equals(d2)); assertTrue(d2.equals(d1)); d1 = new DefaultKeyedValueDataset("Test 1", new Double(45.5)); d2 = new DefaultKeyedValueDataset("Test 2", new Double(45.5)); assertFalse(d1.equals(d2)); d1 = new DefaultKeyedValueDataset("Test", new Double(45.5)); d2 = new DefaultKeyedValueDataset("Test", new Double(45.6)); assertFalse(d1.equals(d2)); }
From source file:org.jfree.data.xy.YIntervalDataItemTest.java
/** * Some checks for the constructor./* w w w . j a v a2 s.c o m*/ */ @Test public void testConstructor1() { YIntervalDataItem item1 = new YIntervalDataItem(1.0, 2.0, 3.0, 4.0); assertEquals(new Double(1.0), item1.getX()); assertEquals(2.0, item1.getYValue(), EPSILON); assertEquals(3.0, item1.getYLowValue(), EPSILON); assertEquals(4.0, item1.getYHighValue(), EPSILON); }
From source file:org.jfree.data.xy.XIntervalDataItemTest.java
/** * Some checks for the constructor.// w w w .j ava2 s . c o m */ @Test public void testConstructor1() { XIntervalDataItem item1 = new XIntervalDataItem(1.0, 2.0, 3.0, 4.0); assertEquals(new Double(1.0), item1.getX()); assertEquals(2.0, item1.getXLowValue(), EPSILON); assertEquals(3.0, item1.getXHighValue(), EPSILON); assertEquals(4.0, item1.getYValue(), EPSILON); }
From source file:org.jfree.data.xy.XYDataItemTest.java
/** * Confirm that the equals method can distinguish all the required fields. *//*ww w . j a v a 2s. co m*/ @Test public void testEquals() { XYDataItem i1 = new XYDataItem(1.0, 1.1); XYDataItem i2 = new XYDataItem(1.0, 1.1); assertTrue(i1.equals(i2)); assertTrue(i2.equals(i1)); i1.setY(new Double(9.9)); assertFalse(i1.equals(i2)); i2.setY(new Double(9.9)); assertTrue(i1.equals(i2)); }
From source file:org.esupportail.papercut.domain.PayboxPapercutTransactionLog.java
public String getMontantDevise() { Double mnt = new Double(montant) / 100.0; return mnt.toString(); }