List of usage examples for java.lang Double Double
@Deprecated(since = "9") public Double(String s) throws NumberFormatException
From source file:br.com.ifpb.models.Grafico.java
/** * //from w w w .jav a 2 s . c o m * @param nome * @param valor * @param tituloGrafico * @param transparencia * @param tipo * @return */ private static javax.swing.JPanel pizza3D(ArrayList nome, ArrayList valor, String tituloGrafico, float transparencia, String tipo) { DefaultPieDataset data = new DefaultPieDataset(); for (int i = 0; i < nome.toArray().length; i++) { data.setValue("" + nome.get(i).toString(), new Double(valor.get(i).toString())); } JFreeChart chart = ChartFactory.createPieChart3D(tituloGrafico, data, true, true, true); java.awt.Color cor = new java.awt.Color(200, 200, 200); chart.setBackgroundPaint(cor); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setLabelLinksVisible(true); plot.setNoDataMessage("No existem dados para serem exibidos "); plot.setStartAngle(90); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(transparencia); plot.setInteriorGap(0.20); ChartPanel chartPanel = new ChartPanel(chart); return chartPanel; }
From source file:Main.java
public static ContentValues listToContentValues(List<String> values, String type) { ContentValues contentvalues = new ContentValues(); //Place values into contentvalue structure for (int i = 0; i < values.size(); i++) { String current = values.get(i); try {/*from w ww .j a v a 2s. com*/ //Separate the value by = in order to get key:value Integer indexOfEquals = current.indexOf("="); String key = current.substring(0, indexOfEquals); String value = current.substring(indexOfEquals + 1); if (type.toUpperCase().equals("STRING")) contentvalues.put(key, value); if (type.toUpperCase().equals("BOOLEAN")) contentvalues.put(key, Boolean.valueOf(value)); if (type.toUpperCase().equals("INTEGER")) contentvalues.put(key, new Integer(value)); if (type.toUpperCase().equals("DOUBLE")) contentvalues.put(key, new Double(value)); if (type.toUpperCase().equals("FLOAT")) contentvalues.put(key, new Float(value)); if (type.toUpperCase().equals("LONG")) contentvalues.put(key, new Long(value)); if (type.toUpperCase().equals("SHORT")) contentvalues.put(key, new Short(value)); } catch (Exception e) { Log.e("mercury", "Error with argument " + current); } } return contentvalues; }
From source file:org.jfree.chart.demo.XYAreaChartDemo1.java
private static XYDataset createDataset() { XYSeries xyseries = new XYSeries("Random 1"); xyseries.add(new Integer(1), new Double(500.19999999999999D)); xyseries.add(new Integer(2), new Double(694.10000000000002D)); xyseries.add(new Integer(3), new Double(-734.39999999999998D)); xyseries.add(new Integer(4), new Double(453.19999999999999D)); xyseries.add(new Integer(5), new Double(500.19999999999999D)); xyseries.add(new Integer(6), new Double(300.69999999999999D)); xyseries.add(new Integer(7), new Double(734.39999999999998D)); xyseries.add(new Integer(8), new Double(453.19999999999999D)); XYSeries xyseries1 = new XYSeries("Random 2"); xyseries1.add(new Integer(1), new Double(700.20000000000005D)); xyseries1.add(new Integer(2), new Double(534.10000000000002D)); xyseries1.add(new Integer(3), new Double(323.39999999999998D)); xyseries1.add(new Integer(4), new Double(125.2D)); xyseries1.add(new Integer(5), new Double(653.20000000000005D)); xyseries1.add(new Integer(6), new Double(432.69999999999999D)); xyseries1.add(new Integer(7), new Double(564.39999999999998D)); xyseries1.add(new Integer(8), new Double(322.19999999999999D)); XYSeriesCollection xyseriescollection = new XYSeriesCollection(); xyseriescollection.addSeries(xyseries); xyseriescollection.addSeries(xyseries1); xyseriescollection.setIntervalWidth(0.0D); return xyseriescollection; }
From source file:Main.java
/** * Given an array of objects, traverses the array and determines the most * suitable data type to perform the calculation in. An empty object of * the correct class is returned;/*from w w w . j a v a2 s . co m*/ * * @param objects * */ static Object getObject(Object[] objects) { Class bestClass = bestClass(objects); if (bestClass == String.class) { return new String(""); //$NON-NLS-1$ } else if (bestClass == Double.class) { return new Double(0); } else if (bestClass == Float.class) { return new Float(0); } else if (bestClass == Long.class) { return new Long(0); } else if (bestClass == Integer.class) { return new Integer(0); } else { //it's a type we don't have here yet return null; } }
From source file:PieChartCreate.PieChart_AWT.java
private static PieDataset createDataset(ResultSet resultSet) { try {/*from w w w .j a va 2 s . c o m*/ DefaultPieDataset dataset = new DefaultPieDataset(); while (resultSet.next()) { dataset.setValue(resultSet.getString(1), new Double(resultSet.getString(2))); } return dataset; } catch (SQLException ex) { Logger.getLogger(PieChart_AWT.class.getName()).log(Level.SEVERE, null, ex); } return null; }
From source file:edu.uci.ics.jung.algorithms.scoring.util.ScoringUtils.java
/** * Assigns a probability of 1/<code>roots.size()</code> to each of the elements of <code>roots</code>. * @param <V> the vertex type/*from w w w. j a v a2s. c o m*/ * @param roots the vertices to be assigned nonzero prior probabilities * @return */ public static <V> Transformer<V, Double> getUniformRootPrior(Collection<V> roots) { final Collection<V> inner_roots = roots; Transformer<V, Double> distribution = new Transformer<V, Double>() { public Double transform(V input) { if (inner_roots.contains(input)) return new Double(1.0 / inner_roots.size()); else return 0.0; } }; return distribution; }
From source file:Main.java
/** * convert charters [beginCol, endCol] of the input string to a double. Return 0.0 number if empty. * //from w w w . j a v a2 s . co m * @param str input string * @param beginCol begin column, starts from 1 ... * @param endCol end column * @return the number */ public static double getDouble(String str, int beginCol, int endCol) { if (str.length() < endCol) return 0.0; String s = str.substring(beginCol - 1, endCol); if (s.trim().equals("")) return 0.0; else return new Double(s.trim()).doubleValue(); }
From source file:view.PieChartDemo1.java
private static PieDataset createDataset() { DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("Online", new Double(online)); dataset.setValue("offline", new Double(offline)); return dataset; }
From source file:Main.java
public Main() { JComboBox comboBox = new JComboBox(); comboBox.addItem(new Double(1)); comboBox.addItem(new Double(2.25)); comboBox.addItem(new Double(3.5)); comboBox.setRenderer(new TwoDecimalRenderer(comboBox.getRenderer())); comboBox.setEditable(true);//www . ja va 2 s .co m JFrame frame = new JFrame(); frame.add(comboBox, BorderLayout.NORTH); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
From source file:org.jfree.chart.demo.ScatterRendererDemo1.java
private static List<Double> listOfValues(double ad[]) { ArrayList<Double> arraylist = new ArrayList<Double>(); for (int i = 0; i < ad.length; i++) arraylist.add(new Double(ad[i])); return arraylist; }