List of usage examples for java.lang Double Double
@Deprecated(since = "9") public Double(String s) throws NumberFormatException
From source file:org.jfree.data.xy.XYDataItem.java
/** * Constructs a new data item./*from ww w . j ava 2 s.co m*/ * * @param x the x-value. * @param y the y-value. */ public XYDataItem(double x, double y) { this(new Double(x), new Double(y)); }
From source file:com.aurel.track.fieldType.runtime.matchers.converter.DoubleMatcherConverter.java
/** * Convert the xml string to object value after load * @param value//from w ww .j a va 2 s. c om * @param matcherRelation * @return */ @Override public Object fromXMLString(String value, Integer matcherRelation) { if (value == null || "".equals(value) || matcherRelation == null) { return null; } switch (matcherRelation.intValue()) { case MatchRelations.EQUAL: case MatchRelations.NOT_EQUAL: case MatchRelations.GREATHER_THAN: case MatchRelations.GREATHER_THAN_EQUAL: case MatchRelations.LESS_THAN: case MatchRelations.LESS_THAN_EQUAL: try { return new Double(value); } catch (Exception e) { LOGGER.warn("Converting the " + value + " to Double from xml string failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } return null; }
From source file:org.squale.squaleweb.util.graph.PieChartMaker.java
/** * Ajoute une valeur au camembert// w w w .j a va 2 s.com * * @param pTitle le titre correspondant la part. * @param pValue la valeur */ public void addValue(String pTitle, double pValue) { Number number = new Double(pValue); addValue(pTitle, number); }
From source file:net.sourceforge.jabm.evolution.FitnessProportionateBreeder.java
public double[] cummulativeFitnesses(AgentList agents) { agents.sortAgents(new Comparator<Agent>() { public int compare(Agent o1, Agent o2) { return new Double(getFitness(o1)).compareTo(new Double(getFitness(o2))); }//from ww w.j av a 2s . c o m }); double[] result = new double[agents.size()]; this.totalFitness = 0.0; for (int i = 0; i < result.length; i++) { totalFitness += getFitness(agents.get(i)); } double cummulativeTotal = 0.0; for (int i = 0; i < result.length; i++) { double fitness = getFitness(agents.get(i)); cummulativeTotal += fitness; result[i] = cummulativeTotal / totalFitness; } return result; }
From source file:edu.uiowa.icts.bluebutton.dao.LabTestRangeHome.java
@Override public void importCSV(InputStream fileInputStream) throws IOException { Reader in = new BufferedReader(new InputStreamReader(fileInputStream)); Iterable<CSVRecord> records = CSVFormat.EXCEL.withHeader("LAB_TEST_RANGES_UID", "LAB_TEST_ID", "SEX", "MIN_AGE_YEARS", "MAX_AGE_YEARS", "MIN_NORMAL", "MAX_NORMAL").withSkipHeaderRecord(true).parse(in); for (CSVRecord record : records) { LabTestRange labTestRange = new LabTestRange(); labTestRange.setLabTestRangeId(new Integer(record.get("LAB_TEST_RANGES_UID"))); LabTest labTest = (LabTest) this.sessionFactory.getCurrentSession().get(LabTest.class, new Integer(record.get("LAB_TEST_ID"))); labTestRange.setLabTest(labTest); // labTest.getLabTestRanges().add(labTestRange); // this.sessionFactory.getCurrentSession().save(labTest); labTestRange.setSex(record.get("SEX")); labTestRange.setMinAgeYears(new Double(record.get("MIN_AGE_YEARS"))); labTestRange.setMaxAgeYears(new Double(record.get("MAX_AGE_YEARS"))); labTestRange.setMinNormal(new Double(record.get("MIN_NORMAL"))); labTestRange.setMaxNormal(new Double(record.get("MAX_NORMAL"))); this.sessionFactory.getCurrentSession().save(labTestRange); this.sessionFactory.getCurrentSession().flush(); this.sessionFactory.getCurrentSession().clear(); }//w ww . ja v a2s . c om }
From source file:grafici.PazientiPieChart.java
/** * Creates a sample dataset.// ww w. ja v a 2 s . co m * * @return A sample dataset. */ private static PieDataset createDataset(int tipo) { DefaultPieDataset dataset = new DefaultPieDataset(); // Tipologia visita ArrayList<Tipologiavisita> tipiVisite = VisitaDAO.getTipologVisita(); for (Tipologiavisita tipologia : tipiVisite) { Double percentuale = new Double( VisitaDAO.getPrenotazioniNumberPerTipologia(tipologia.getIdTipologiaVisita())); dataset.setValue(tipologia.getTipologia(), percentuale); } return dataset; }
From source file:br.com.desafiowallmart.service.RotaService.java
/** * Exemplo de JSON a ser passado para o methodo {@link RotaService.consultaRota}} * @return//from ww w . java2 s. com */ @RequestMapping(value = "/consultaRotaExample", method = RequestMethod.GET) public ConsultaRotaVO consultaRotaExample() { ConsultaRotaVO inputVO = new ConsultaRotaVO(); inputVO.setAutonomia(new Double(10)); inputVO.setDestino("Destino"); inputVO.setOrigem("Origem"); inputVO.setValorCombustivel(new Double(3.10)); return inputVO; }
From source file:com.github.rinde.rinsim.scenario.generator.PoissonIntensityTest.java
/** * Tests whether the predicate approximates the intensity function when a * large number of runs is done.//from w w w . j a v a 2s . c o m */ @Test public void intensityApproximationPredicateTest() { final RandomGenerator rng = new MersenneTwister(123); final Predicate<Double> pred = new NHPredicate(rng, intensityFunction); final ImmutableList.Builder<Double> b = ImmutableList.builder(); for (int i = 0; i < 100; i++) { b.add(new Double(i)); } final ImmutableList<Double> doubles = b.build(); final Multiset<Double> ms = TreeMultiset.create(); final int repetitions = 10000; for (int i = 0; i < repetitions; i++) { ms.addAll(Collections2.filter(doubles, pred)); } for (final Multiset.Entry<Double> entry : ms.entrySet()) { final double prob = intensityFunction.apply(entry.getElement()) / intensityFunction.getMax(); final double observation = entry.getCount() / (double) repetitions; assertEquals(prob, observation, 0.015); } }
From source file:com.judoscript.jamaica.MyUtils.java
public static Object number2object(long val, String typeHint) { if (typeHint != null) { if (typeHint.equals("int")) return new Integer((int) val); if (typeHint.equals("long")) return new Long(val); if (typeHint.equals("short")) return new Short((short) val); if (typeHint.equals("char")) return new Character((char) val); if (typeHint.equals("byte")) return new Byte((byte) val); if (typeHint.equals("double")) return new Double(val); if (typeHint.equals("float")) return new Float(val); }/*from w w w . j a v a2 s. co m*/ return new Long(val); }
From source file:com.itemanalysis.psychometrics.polycor.PearsonCorrelation.java
@Override public int hashCode() { Double v = new Double(this.value()); return v.hashCode(); }