List of usage examples for java.lang Double Double
@Deprecated(since = "9") public Double(String s) throws NumberFormatException
From source file:StocksTable.java
public StockData(String symbol, String name, double last, double open, double change, double changePr, long volume) { m_symbol = symbol;//from ww w . j a va2 s. co m m_name = name; m_last = new Double(last); m_open = new Double(open); m_change = new Double(change); m_changePr = new Double(changePr); m_volume = new Long(volume); }
From source file:org.jfree.chart.demo.SimpleIntervalXYDataset2.java
/** * Creates a new dataset.//from w ww . j a v a 2 s. c om * * @param itemCount the number of items to generate. */ public SimpleIntervalXYDataset2(final int itemCount) { this.xValues = new Double[itemCount]; this.yStart = new Double[itemCount]; this.yEnd = new Double[itemCount]; double base = 100; for (int i = 1; i <= itemCount; i++) { this.xValues[i - 1] = new Double(i); base = base * (1 + (Math.random() / 10 - 0.05)); this.yStart[i - 1] = new Double(base); this.yEnd[i - 1] = new Double(this.yStart[i - 1].doubleValue() + Math.random() * 30); } }
From source file:org.jfree.data.general.DefaultValueDataset.java
/** * Creates a new dataset with the specified value. * * @param value the value./* w ww . j a v a2s . c o m*/ */ public DefaultValueDataset(double value) { this(new Double(value)); }
From source file:com.thingsfx.swing.jfreechart.JFreeChartPanel.java
PieDataset createDataset() { DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("Fraction of the image that is Red", new Double(80.0)); dataset.setValue("Fraction of the image that is Blue", new Double(20.0)); return dataset; }
From source file:org.jfree.chart.demo.XYAreaChartTest.java
/** * Creates a new demo./*from w w w. ja v a 2s. c o m*/ * * @param title the frame title. */ public XYAreaChartTest(final String title) { super(title); final XYSeries series1 = new XYSeries("Random 1"); series1.add(new Integer(1), new Double(500.2)); series1.add(new Integer(2), new Double(694.1)); series1.add(new Integer(3), new Double(-734.4)); series1.add(new Integer(4), new Double(453.2)); series1.add(new Integer(5), new Double(500.2)); series1.add(new Integer(6), new Double(300.7)); series1.add(new Integer(7), new Double(734.4)); series1.add(new Integer(8), new Double(453.2)); final XYSeries series2 = new XYSeries("Random 2"); series2.add(new Integer(1), new Double(700.2)); series2.add(new Integer(2), new Double(534.1)); series2.add(new Integer(3), new Double(323.4)); series2.add(new Integer(4), new Double(125.2)); series2.add(new Integer(5), new Double(653.2)); series2.add(new Integer(6), new Double(432.7)); series2.add(new Integer(7), new Double(564.4)); series2.add(new Integer(8), new Double(322.2)); final XYSeriesCollection dataset = new XYSeriesCollection(series1); dataset.addSeries(series2); final JFreeChart chart = createChart(dataset); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); }
From source file:nz.co.senanque.notknown.NotKnownRulesTest.java
/** * Runs a scenario which does directed questioning. The rules include one that uses * the isNotKnown function and verifies it works. * @throws Exception//from www .j a va 2 s. c om */ @Test public void testNotKnownRulesTest() throws Exception { ValidationSession validationSession = m_validationEngine.createSession(); Customer customer = new Customer(); validationSession.bind(customer); m_rulesPlugin.clearUnknowns(customer); FieldMetadata fieldMetadata = null; log.debug("starting loop"); while ((fieldMetadata = m_rulesPlugin .getEmptyField(customer.getMetadata().getFieldMetadata("bmi"))) != null) { log.debug("found field {}", fieldMetadata.getName()); if (fieldMetadata.getName().equals("weightKilos")) { m_rulesPlugin.setNotKnown(fieldMetadata); continue; } if (fieldMetadata.getName().equals("heightMetric")) { fieldMetadata.setValue(new Double(1.92D)); continue; } if (fieldMetadata.getName().equals("weightPounds")) { fieldMetadata.setValue(new Double(198D)); continue; } if (fieldMetadata.getName().equals("heightFeet")) { m_rulesPlugin.setNotKnown(fieldMetadata); continue; } if (fieldMetadata.getName().equals("heightInches")) { m_rulesPlugin.setNotKnown(fieldMetadata); continue; } } long bmi = new Double(customer.getBmi()).longValue(); assertEquals(24L, bmi); assertEquals("not known rule fired", customer.getAddress()); validationSession.close(); }
From source file:fr.amap.viewer3d.object.scene.ScalarField.java
public void buildHistogram() { for (int i = 0; i < values.size(); i++) { float value = values.get(i); f.addValue(new Double(value).longValue()); }/* w w w . ja va 2 s.c o m*/ double minValue = statistic.getMinValue(); double maxValue = statistic.getMaxValue(); double width = maxValue - minValue; double step = width / 18.0d; histogramValue = new double[19]; histogramFrequencyCount = new long[19]; int i = 0; try { for (double d = minValue; d <= maxValue; d += step) { if (i < histogramValue.length) { histogramFrequencyCount[i] = f.getCumFreq(new Double(d + step).longValue()) - f.getCumFreq(new Double(d).longValue()); histogramValue[i] = d; } i++; } } catch (Exception e) { } }
From source file:com.couchbase.sqoop.mapreduce.db.CouchbaseRecordReadSerializeTest.java
@Before @Override/*from ww w . jav a 2 s.c om*/ public void setUp() throws Exception { super.setUp(); tappedStuff = new HashMap<String, ResponseMessage>(); URI uri = new URI(CouchbaseUtils.CONNECT_STRING); String user = CouchbaseUtils.COUCHBASE_USER_NAME; String pass = CouchbaseUtils.COUCHBASE_USER_PASS; try { cb = new CouchbaseClient(Arrays.asList(uri), user, pass); } catch (IOException e) { LOG.error("Couldn't connect to server" + e.getMessage()); fail(e.toString()); } this.client = new TapClient(Arrays.asList(uri), user, pass); cb.flush(); Thread.sleep(500); // set up the items we're going to deserialize Integer anint = new Integer(Integer.MIN_VALUE); cb.set(anint.toString(), 0x300, anint).get(); Long along = new Long(Long.MAX_VALUE); cb.set(along.toString(), 0, along).get(); Float afloat = new Float(Float.MAX_VALUE); cb.set(afloat.toString(), 0, afloat).get(); Double doubleBase = new Double(Double.NEGATIVE_INFINITY); cb.set(doubleBase.toString(), 0, doubleBase).get(); Boolean booleanBase = true; cb.set(booleanBase.toString(), 0, booleanBase).get(); rightnow = new Date(); // instance, needed later dateText = rightnow.toString().replaceAll(" ", "_"); cb.set(dateText, 0, rightnow).get(); Byte byteMeSix = new Byte("6"); cb.set(byteMeSix.toString(), 0, byteMeSix).get(); String ourString = "hi,there"; cb.set(ourString.toString(), 0, ourString).get(); client.tapDump("tester"); while (client.hasMoreMessages()) { ResponseMessage m = client.getNextMessage(); if (m == null) { continue; } tappedStuff.put(m.getKey(), m); } }
From source file:gov.nih.nci.ncicb.cadsr.bulkloader.util.excel.ExcelUtility.java
public static Double getDouble(HSSFSheet sheet, int row, short col) { HSSFRow hssfRow = getRow(sheet, row); if (hssfRow == null) { return null; }//from w ww . java 2 s. c o m HSSFCell cell = getRow(sheet, row).getCell(col); if (isNull(cell)) { return null; } return new Double(cell.getNumericCellValue()); }
From source file:org.hxzon.demo.jfreechart.PieDatasetDemo.java
private static PieDataset createPreviousDataset() { DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("One", new Double(45.2)); dataset.setValue("Two", new Double(10.0)); dataset.setValue("Three", new Double(20.5)); dataset.setValue("Four", new Double(12.5)); dataset.setValue("Five", new Double(31.0)); dataset.setValue("Six", new Double(19.4)); return dataset; }