List of usage examples for java.lang Double Double
@Deprecated(since = "9") public Double(String s) throws NumberFormatException
From source file:com.redhat.rhn.common.validator.NumericConstraint.java
/** {@inheritDoc} */ public ValidatorError checkConstraint(Object value) { ValidatorError requiredCheck = super.checkConstraint(value); if (requiredCheck != null) { return requiredCheck; }/*from w w w. j a v a2 s .c om*/ String localizedIdentifier = LocalizationService.getInstance().getMessage(getIdentifier()); // Validate against range specifications try { if (!StringUtils.isBlank(value.toString())) { double doubleValue = new Double(value.toString()).doubleValue(); // Now we know its a valid number, lets check for a decimal value if (value.toString().indexOf(".") > -1) { Object[] args = new Object[2]; args[0] = localizedIdentifier; args[1] = getMinInclusive(); return new ValidatorError("errors.decimalvalue", args); } if (hasMinInclusive()) { if (doubleValue < getMinInclusive().doubleValue()) { log.debug("Under min size ..."); Object[] args = new Object[2]; args[0] = localizedIdentifier; args[1] = getMinInclusive(); return new ValidatorError("errors.minsize", args); } } if (hasMaxInclusive()) { if (doubleValue > getMaxInclusive().doubleValue()) { log.debug("Over max size 2 ..."); Object[] args = new Object[2]; args[0] = localizedIdentifier; args[1] = getMaxInclusive(); return new ValidatorError("errors.maxsize", args); } } } } catch (NumberFormatException e) { log.debug("NumberFormatException .. "); Object[] args = new Object[1]; args[0] = localizedIdentifier; return new ValidatorError("errors.notanumber", args); } return null; }
From source file:com.marvelution.jira.plugins.hudson.charts.renderers.BuildResultRenderer.java
/** * {@inheritDoc}/*from w w w. ja v a 2s . c om*/ */ @Override public Paint getItemPaint(int row, int column) { final int number = new Double(getPlot().getDataset().getXValue(0, column)).intValue(); final Build build = builds.get(number); switch (build.getResult()) { case SUCCESSFUL: return HudsonChartGenerator.GREEN_PAINT; case FAILED: return HudsonChartGenerator.RED_PAINT; case UNSTABLE: return HudsonChartGenerator.YELLOW_PAINT; case ABORTED: case NOTBUILD: default: return HudsonChartGenerator.GRAY_PAINT; } }
From source file:com.admob.rocksteady.domain.Revision.java
public Double getTimestamp() { return new Double(createOn.getTime() / 1000); }
From source file:MyStatsPanel.java
JPanel createPieChartPanel() { getIDTypesInfo();/*from w w w . j a v a 2 s.c o m*/ DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("FSU", new Double(FSU)); // set the value with number of FSU IDs dataset.setValue("PCTC", new Double(PCTC)); // set the value with number of PCTC IDs dataset.setValue("Driving License", new Double(DL));// set the value with number of Driving License IDs dataset.setValue("Other", new Double(OTHERS));// set the value with number of IDs in other category JFreeChart chart = ChartFactory.createPieChart3D("Guest ID Types", dataset, true, true, false); return new ChartPanel(chart); }
From source file:MarketTable.java
public Object getValueAt(int r, int c) { switch (c) {// w w w . jav a 2s. c o m case 0: return stocks[r].symbol; case 1: return new Double(stocks[r].price); case 2: return new Double(stocks[r].delta); case 3: return stocks[r].lastUpdate; } throw new IllegalArgumentException("Bad cell (" + r + ", " + c + ")"); }
From source file:com.stb.async.ParallelExecutionProcess.java
/** * * @param processList//from w w w . j a v a 2 s . c o m */ public void initiateDecode(List processList) { Date startTime = new java.util.Date(); System.out.println("Start Work" + startTime); ExecutorService es = Executors.newFixedThreadPool(10); Collections.sort(processList, new ProcessCompare()); List<Future> futures = new ArrayList<>(); for (Iterator it = processList.iterator(); it.hasNext();) { Process e = (Process) it.next(); workerId = processList.indexOf(e); System.out.println("* Start Decode process " + processList.indexOf(e)); futures.add(es.submit(() -> { new DecodedSTBProcesses((Process) processList.get(ParallelExecutionProcess.workerId)).doWork(); return null; })); } es.shutdown(); System.out.println( "... The Process is under execution! Using CPU core which are available, wait while work is being done...."); int ctr = 0; for (Future future : futures) { try { future.get(); // blocking call, explicitly waiting for the response from a specific task, not necessarily the first task that is completed System.out.println("** Response of process " + ++ctr + " is in."); } catch (InterruptedException | ExecutionException e) { } } Date endTime = new java.util.Date(); System.out.println("End work at " + endTime); System.out.println("Total decoding took " + new Double(0.001 * (endTime.getTime() - startTime.getTime())) + " seconds"); System.exit(0); }
From source file:de.unibayreuth.bayeos.goat.options.JOptionDialog.java
public boolean load() { lastConnectionCheckBox.setSelected(pref.getBoolean("rememberlastconnection", true)); jcbType.setSelectedIndex(pref.getInt("xyitemrenderer", DefaultXYItemRenderer.LINES) - 1); jSliderShapeSize.getModel().setValue(pref.getInt("shapesize", 8)); jCheckBoxToolTips.setSelected(pref.getBoolean("charttooltips", false)); jspGapThreshold.getModel().setValue(new Double(pref.getDouble("chartthreshold", 0.0))); statEditor.load();/*from ww w . j av a2 s . com*/ return true; }
From source file:org.cyberoam.iview.charts.ByteTickUnit.java
/** * Converts a value to a string./*from ww w . ja v a2 s . co m*/ * * @param value specifies number which should be converted to according byte formatting. * @return The formatted string. * */ public String valueToString(double value) { return ByteInUnit.getBytesInUnit((new Double(value)).longValue()); }
From source file:it.units.malelab.sse.OperationsChromosome.java
public List<Operation> getOperations() { List<Operation> operations = new ArrayList<>(); for (int i = 0; i < N_OPS; i++) { Operation operation = getOperation(i); if (operation != null) { operations.add(operation);// w w w . ja va 2 s .c om } } stats.put(Evaluator.ResultType.SIZE, new Double(operations.size())); return operations; }
From source file:mitm.application.djigzo.james.matchers.ToFloatFunction.java
public static ArrayList<?> getOneStringAndOneDouble(final String arguments, final char delimiter) throws FunctionException { ArrayList<Object> returnValues = new ArrayList<Object>(); try {//from w w w .ja v a2 s . c o m final ArgumentTokenizer tokenizer = new ArgumentTokenizer(arguments, delimiter); int tokenCtr = 0; while (tokenizer.hasMoreTokens()) { if (tokenCtr == 0) { final String token = tokenizer.nextToken(); returnValues.add(token); } else if (tokenCtr == 1) { final String token = tokenizer.nextToken().trim(); returnValues.add(new Double(token)); } else { throw new FunctionException("Invalid values in string."); } tokenCtr++; } } catch (Exception e) { throw new FunctionException("Invalid values in string.", e); } return returnValues; }