List of usage examples for java.lang Double Double
@Deprecated(since = "9") public Double(String s) throws NumberFormatException
From source file:org.jfree.chart.demo.ChartTiming1.java
/** * Runs the timing.//from w ww . jav a2 s . c o m */ public void run() { this.finished = false; // create a dataset... final DefaultPieDataset data = new DefaultPieDataset(); data.setValue("One", new Double(10.3)); data.setValue("Two", new Double(8.5)); data.setValue("Three", new Double(3.9)); data.setValue("Four", new Double(3.9)); data.setValue("Five", new Double(3.9)); data.setValue("Six", new Double(3.9)); // create a pie chart... final boolean withLegend = true; final JFreeChart chart = ChartFactory.createPieChart("Testing", data, withLegend, true, false); final BufferedImage image = new BufferedImage(400, 300, BufferedImage.TYPE_INT_RGB); final Graphics2D g2 = image.createGraphics(); final Rectangle2D chartArea = new Rectangle2D.Double(0, 0, 400, 300); // set up the timer... final Timer timer = new Timer(10000, this); timer.setRepeats(false); int count = 0; timer.start(); while (!this.finished) { chart.draw(g2, chartArea, null, null); System.out.println("Charts drawn..." + count); if (!this.finished) { count++; } } System.out.println("DONE"); }
From source file:View.RIM.Components.PieChart.java
private PieDataset createDataset() { DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("Not Attendng", new Double(notAttending / total * 100)); dataset.setValue("Not Sure", new Double(notSure / total * 100)); dataset.setValue("Attending", new Double(attending / total * 100)); return dataset; }
From source file:org.jfree.data.statistics.BoxAndWhiskerItemTest.java
/** * Serialize an instance, restore it, and check for equality. *///from ww w. j a va 2s. c o m @Test public void testSerialization() { BoxAndWhiskerItem i1 = new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(5.0), new Double(6.0), new Double(7.0), new Double(8.0), new ArrayList()); BoxAndWhiskerItem i2 = (BoxAndWhiskerItem) TestUtilities.serialised(i1); assertEquals(i1, i2); }
From source file:com.soomla.store.domain.GoogleMarketItem.java
public JSONObject toJSONObject() { JSONObject jsonObject = new JSONObject(); try {/* w w w . j a v a 2s.c o m*/ jsonObject.put(JSONConsts.MARKETITEM_MANAGED, mManaged.ordinal()); jsonObject.put(JSONConsts.MARKETITEM_ANDROID_ID, mProductId); jsonObject.put(JSONConsts.MARKETITEM_PRICE, new Double(mPrice)); } catch (JSONException e) { StoreUtils.LogError(TAG, "An error occured while generating JSON object."); } return jsonObject; }
From source file:org.jfree.chart.demo.XYAreaChartDemo.java
/** * Creates a new demo./*from w w w . j av a 2 s .c o m*/ * * @param title the frame title. */ public XYAreaChartDemo(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:com.pureinfo.srm.view.function.GetShenTeam.java
public Object perform(Object[] _s_args, IDVContext _s_context) throws PureException { PingGuParameterVO vo = (PingGuParameterVO) LocalContextHelper .getAttribute(PingGuConstants.ATTRIBUTE_NAME_OF_PARAMETER); if (vo == null) { return ""; }//from w w w. j a v a 2 s.c om IObjects objs = null; IStatement query = null; Organization org = (Organization) _s_context.getObject(); double totalScale = 0; try { objs = TeamPingGuHelper.getObjs(org.getCode(), vo.getStartDate(), vo.getEndDate()); Team team = null; while ((team = (Team) objs.next()) != null) { String teamHonor = team.getTeamHonor(); if (StringUtils.isNotEmpty(teamHonor) && teamHonor.indexOf("02") != -1) {// List deptList = team.getDeptList(); for (Iterator iterator = deptList.iterator(); iterator.hasNext();) { ObjDeptMapping deptMapping = (ObjDeptMapping) iterator.next(); if (deptMapping.getDeptId() == org.getId()) { totalScale += deptMapping.getWeightScale(); break; } } } else { continue; } } return new Double(SCORE * totalScale); } finally { if (objs != null) objs.clear(); if (query != null) query.clear(); } }
From source file:org.jfree.data.statistics.MeanAndStandardDeviation.java
/** * Creates a new mean and standard deviation record. * * @param mean the mean./*from w w w .java 2 s. com*/ * @param standardDeviation the standard deviation. */ public MeanAndStandardDeviation(double mean, double standardDeviation) { this(new Double(mean), new Double(standardDeviation)); }
From source file:edu.ucla.stat.SOCR.chart.demo.PieChart3DDemo1.java
/** * Creates a sample dataset for the demo. * @param isDemo true use demo data, false use data from JTable * @return A sample dataset./* www . j a v a 2 s . co m*/ */ protected DefaultPieDataset createDataset(boolean isDemo) { if (isDemo) { DefaultPieDataset result = new DefaultPieDataset(); result.setValue("Java", new Double(43.2)); result.setValue("Visual Basic", new Double(10.0)); result.setValue("C/C++", new Double(17.5)); result.setValue("PHP", new Double(32.5)); result.setValue("Perl", null); //new Double(1.0)); pulloutFlag = new String[5]; for (int i = 0; i < 5; i++) pulloutFlag[i] = "0"; pulloutFlag[2] = "1"; return result; } else return super.createDataset(false); }
From source file:org.jfree.data.DefaultKeyedValueTest.java
/** * Confirm that the equals method can distinguish all the required fields. *//* ww w . ja v a2 s . co m*/ @Test public void testEquals() { DefaultKeyedValue v1 = new DefaultKeyedValue("Test", new Double(45.5)); DefaultKeyedValue v2 = new DefaultKeyedValue("Test", new Double(45.5)); assertTrue(v1.equals(v2)); assertTrue(v2.equals(v1)); v1 = new DefaultKeyedValue("Test 1", new Double(45.5)); v2 = new DefaultKeyedValue("Test 2", new Double(45.5)); assertFalse(v1.equals(v2)); v1 = new DefaultKeyedValue("Test", new Double(45.5)); v2 = new DefaultKeyedValue("Test", new Double(45.6)); assertFalse(v1.equals(v2)); }
From source file:mondrian.udf.InverseNormalUdf.java
public Object execute(Evaluator evaluator, Argument[] args) { final Object argValue = args[0].evaluateScalar(evaluator); LOGGER.debug("Inverse Normal argument was : " + argValue); if (!(argValue instanceof Number)) { // Argument might be a RuntimeException indicating that // the cache does not yet have the required cell value. The // function will be called again when the cache is loaded. return null; }/*from w ww . j ava 2s . co m*/ final Double d = new Double(((Number) argValue).doubleValue()); LOGGER.debug("Inverse Normal argument as Double was : " + d); if (d.isNaN()) { return null; } // If probability is nonnumeric or // probability < 0 or // probability > 1, // returns an error. double dbl = d.doubleValue(); if (dbl < 0.0 || dbl > 1.0) { LOGGER.debug("Invalid value for inverse normal distribution: " + dbl); throw new MondrianEvaluationException("Invalid value for inverse normal distribution: " + dbl); } try { Double result = new Double(nd.inverseCumulativeProbability(dbl)); LOGGER.debug("Inverse Normal result : " + result.doubleValue()); return result; } catch (MathException e) { LOGGER.debug("Exception calculating inverse normal distribution: " + dbl, e); throw new MondrianEvaluationException("Exception calculating inverse normal distribution: " + dbl); } }