List of usage examples for java.lang Double valueOf
@HotSpotIntrinsicCandidate public static Double valueOf(double d)
From source file:com.sarm.aussiepayslipgenerator.service.PaySlipServiceImplTest.java
/** * Test of calculatePayslip method, of class PaySlipServiceImpl. with values * for an employee in Bracket1// ww w . jav a2 s . c om */ @Test public void testCalculatePayslipForBracket1() { System.out.println("calculatePayslip"); EmployeeInfo employee = new EmployeeInfo(); employee.setAnnualSalary(17856); employee.setFirstName("Bracket1"); employee.setLastName("Emp1"); employee.setSuperRate(Double.valueOf("11")); employee.setStartDate(new DateTime()); Bracket bracket = new BracketServiceImpl().populate("Bracket1"); PaySlipServiceImpl instance = new PaySlipServiceImpl(); EmployeePaySlip expResult = new EmployeePaySlip(); expResult.setGrossIncome(Integer.toString(1488)); expResult.setIncomeTax(Integer.toString(0)); expResult.setMonthlySuper(Integer.toString(164)); expResult.setNetIncome(Integer.toString(1488)); EmployeePaySlip result = instance.calculatePayslip(employee, bracket); assertEquals(expResult, result); }
From source file:com.willwinder.universalgcodesender.gcode.processors.Translator.java
private String shift(String part, double amount) { return "" + part.charAt(0) + (Double.valueOf(part.substring(1)) + amount); }
From source file:master.utilities.pfe.PFEJSONVisitor.java
@Override public Double[] visitNumber(PFExpressionParser.NumberContext ctx) { Double[] vec = new Double[n]; double num = Double.valueOf(ctx.NUM().getText()); for (int i = 0; i < n; i++) vec[i] = num;//from ww w.j a va 2s . co m return vec; }
From source file:main.java.edu.isistan.genCom.evolutive.ag.functions.FitnessIndependence.java
@Override public double getFitness(List<Investigador> comission) { double result = 0; double diametro = red.getDiameter(); double minDistancia = Double.valueOf(diametro); double sumDistancias = 0; List<Double> distancias = red.getDistancesIn(comission); DataSet distanciasStat = new DataSet(ArrayUtils.toPrimitive(distancias.toArray(new Double[0]))); minDistancia = distanciasStat.getMinimum(); sumDistancias = distanciasStat.getAggregate(); if (!distancias.isEmpty()) result = sumDistancias / distancias.size(); // Normaliza el resultado result = (result + minDistancia) / (2 * diametro); return result; }
From source file:anslab2.Test.java
public static ArrayList sortData(ArrayList toSort, int dataType) { n = toSort.size();//from ww w . jav a2 s . c om if (dataType == 1) { ArrayList<String> alphabetic = new ArrayList<String>(); for (Object data : toSort) { ; alphabetic.add(String.valueOf(data)); } Collections.sort(alphabetic); labels = alphabetic; return alphabetic; } else if (dataType == 2) { ArrayList<Double> numeric = new ArrayList<Double>(); for (Object data : toSort) { numeric.add(Double.valueOf(String.valueOf(data))); } Collections.sort(numeric); labelsD = numeric; return numeric; } else if (dataType == 3) { ArrayList<String> string = new ArrayList<String>(); for (Object data : toSort) { string.add(String.valueOf(data)); } Collections.sort(string); labels = string; return string; } return null; }
From source file:TimeFormatUtil.java
public static String getTimeLabel(double seconds, boolean longFormat) { int secs = new Double(Math.floor(seconds)).intValue(); int hours = secs / 3600; secs = secs % 3600;/* w ww. ja v a 2 s . c o m*/ int minutes = secs / 60; secs = secs % 60; StringBuilder b = new StringBuilder(); if (hours > 0) { if (hours < 10) b.append(0); b.append(hours); b.append(longFormat ? "h " : ":"); } if (minutes < 10) b.append(0); b.append(minutes); b.append(longFormat ? "m " : ":"); if (secs < 10) b.append(0); b.append(secs); if (longFormat) { int hundreths = Double.valueOf((seconds - secs) * 100).intValue(); b.append("."); b.append(hundreths); b.append("s"); } return b.toString(); }
From source file:com.github.brandtg.stl.PlotTest.java
@Test public void testMinimalCase() throws Exception { List<Number> times = new ArrayList<Number>(); List<Number> measures = new ArrayList<Number>(); // Read from STDIN String line;/*from ww w . j a v a 2s . c o m*/ BufferedReader reader = new BufferedReader( new InputStreamReader(ClassLoader.getSystemResourceAsStream("minimal.csv"))); while ((line = reader.readLine()) != null) { String[] tokens = line.split(","); times.add(Long.valueOf(tokens[0])); measures.add(Double.valueOf(tokens[1])); } StlDecomposition stl = new StlDecomposition(288); stl.getConfig().setTrendComponentBandwidth(0.751); stl.getConfig().setSeasonalComponentBandwidth(0.85); // TODO: With default 10 we get decent results, but with 1 the head end seems a little off // stl.getConfig().setNumberOfInnerLoopPasses(1); stl.getConfig().setPeriodic(false); StlResult res = stl.decompose(times, measures); // TODO: Validate more somehow (from https://github.com/brandtg/stl-java/issues/9) // for (int i = 0; i < times.size(); i++) { // System.out.println(String.format("%d,%02f,%02f,%02f,%02f", // (long) res.getTimes()[i], // res.getSeries()[i], // res.getTrend()[i], // res.getSeasonal()[i], // res.getRemainder()[i])); // } }
From source file:com.canalplus.reco.interactclient.InteractRestClient.java
private static NameValuePairImpl[] convertAudienceID(List<Parametre> profil) { final List<NameValuePairImpl> audienceIDList = new ArrayList<NameValuePairImpl>(); for (final Parametre parametre : profil) { if (parametre.getName() != null && parametre.getName().startsWith(Consts.PREFIX_AUDIENCE_ID)) { final NameValuePairImpl audienceID = new NameValuePairImpl( StringUtils.substringAfter(parametre.getName(), Consts.PREFIX_AUDIENCE_ID), NameValuePair.DATA_TYPE_NUMERIC, Double.valueOf(parametre.getValue())); audienceIDList.add(audienceID); }//from w ww . j a v a2s . c o m } final NameValuePairImpl[] audienceIDArray = audienceIDList .toArray(new NameValuePairImpl[audienceIDList.size()]); return audienceIDArray; }
From source file:com.nts.alphamale.data.EventLog.java
public EventLog(Matcher m) { cpuTimestamp = Double.valueOf(m.group(1)); curTimeStamp = System.currentTimeMillis(); deviceName = m.group(2);/*from ww w. j ava2 s . c o m*/ evSynOrAbs = m.group(3); absLabel = m.group(4); try { absValue = !m.group(5).equals("ffffffff") ? Integer.valueOf(m.group(5), 16) : Integer.MAX_VALUE; } catch (NumberFormatException e) { if (m.group(5).equalsIgnoreCase("down")) { absValue = Integer.MIN_VALUE; } if (m.group(5).equalsIgnoreCase("up")) { absValue = Integer.MAX_VALUE; } } }
From source file:nodeconfig.FinalFuzzyChart.java
private CategoryDataset createDataset() { final DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (int i = 0; i < fuzzyploss.size(); i++) { // System.out.println("Check: "+Double.valueOf(fuzzydelay.get(i))+""); dataset.addValue(Double.valueOf(fuzzydelay.get(i)), "Fuzzy(Delay)", "Node " + (i + 1)); dataset.addValue(Double.valueOf(fuzzyploss.get(i)), "Fuzzy(Loss)", "Node " + (i + 1)); dataset.addValue(Double.valueOf(fuzzytrate.get(i)), "Fuzzy(Rate)", "Node " + (i + 1)); }/*from w w w. java2s.co m*/ return dataset; }