List of usage examples for java.lang Number doubleValue
public abstract double doubleValue();
From source file:de.hybris.platform.commerceorgaddon.forms.validation.B2BPermissionFormValidator.java
@Override public void validate(final Object object, final Errors errors) { final B2BPermissionForm b2BPermissionForm = (B2BPermissionForm) object; final String permissionType = b2BPermissionForm.getB2BPermissionTypeData().getCode(); if (!B2BPermissionTypeEnum.B2BBUDGETEXCEEDEDPERMISSION .equals(B2BPermissionTypeEnum.valueOf(permissionType))) { if (StringUtils.isEmpty(b2BPermissionForm.getCurrency())) { errors.rejectValue("currency", "general.required"); }/*from ww w . jav a2 s .c o m*/ final String thresholdValue = b2BPermissionForm.getValue(); if (StringUtils.isBlank(thresholdValue)) { errors.rejectValue("value", "general.required"); } else { final Number thresholdNumber; try { thresholdNumber = getFormatFactory().createNumberFormat().parse(thresholdValue); if (thresholdNumber.doubleValue() < 0D) { errors.rejectValue("value", "text.company.managePermissions.threshold.value.error"); } } catch (final ParseException e) { errors.rejectValue("value", "text.company.managePermissions.threshold.value.invalid"); } } if (B2BPermissionTypeEnum.B2BORDERTHRESHOLDTIMESPANPERMISSION .equals(B2BPermissionTypeEnum.valueOf(permissionType)) && StringUtils.isEmpty(b2BPermissionForm.getTimeSpan())) { errors.rejectValue("timeSpan", "general.required"); } } }
From source file:com.exxonmobile.ace.hybris.storefront.forms.validation.B2BPermissionFormValidator.java
@Override public void validate(final Object object, final Errors errors) { final B2BPermissionForm b2BPermissionForm = (B2BPermissionForm) object; final String permissionType = b2BPermissionForm.getB2BPermissionTypeData().getCode(); if (!B2BPermissionTypeEnum.B2BBUDGETEXCEEDEDPERMISSION .equals(B2BPermissionTypeEnum.valueOf(permissionType))) { if (StringUtils.isEmpty(b2BPermissionForm.getCurrency())) { errors.rejectValue("currency", "general.required"); }/* ww w . jav a 2 s .co m*/ final String thresholdValue = b2BPermissionForm.getValue(); if (StringUtils.isBlank(thresholdValue)) { errors.rejectValue("value", "general.required"); } else { final Number thresholdNumber; try { thresholdNumber = getFormatFactory().createNumberFormat().parse(thresholdValue); if (thresholdNumber.doubleValue() < 0D) { errors.rejectValue("value", "text.company.managePermissions.threshold.value.error"); } } catch (final ParseException e) { errors.rejectValue("value", "text.company.managePermissions.threshold.value.invalid"); } } if (B2BPermissionTypeEnum.B2BORDERTHRESHOLDTIMESPANPERMISSION .equals(B2BPermissionTypeEnum.valueOf(permissionType))) { if (StringUtils.isEmpty(b2BPermissionForm.getTimeSpan())) { errors.rejectValue("timeSpan", "general.required"); } } } }
From source file:com.appnativa.rare.ui.chart.jfreechart.ChartHelper.java
public static IntervalMarker createIntervalMarker(ChartDataItem item) { Number lower = (Number) item.getValue(); Number upper = (Number) item.getDomainValue(); IntervalMarker marker = new IntervalMarker(lower.doubleValue(), upper.doubleValue()); String s = item.getTitle();//from w w w.ja v a2s. c o m if (s != null) { marker.setLabel(s); } marker.setLabelAnchor(getRectangleAnchor(item)); marker.setLabelTextAnchor(getTextAnchor(item)); updateMarker(marker, item); return marker; }
From source file:com.github.hexosse.memworth.WorthBuilder.java
/** * Parse the csv file//w ww .j ava 2s. co m * * @return WorthBuilder */ public WorthBuilder parse() { try { // Free list of items items.clear(); // Load csv file into file reader FileReader reader = new FileReader(csvFile); // parse csv file using specified file format for (CSVRecord record : csvFormat.parse(reader)) { // Skip empty lines if (record.get(0).isEmpty()) continue; // Skip title if (record.get(0).equals("ID")) continue; // Skip item without price if (record.get(3).isEmpty()) continue; if (record.get(4).isEmpty()) continue; // Create Item String[] idData = record.get(0).replaceAll("[^0-9]", " ").trim().split(" "); int id = Integer.parseInt(idData[0]); int data = Integer.parseInt(idData.length > 1 ? idData[1] : "0"); String comment = record.get(1); String sworth = record.get(4).trim().replaceAll(" ", "") .replaceAll("^[^a-zA-Z0-9\\s]+|[^a-zA-Z0-9\\s]+$", ""); Number worth = numFormat.parse(sworth); // Add Item to list if (worth.doubleValue() != 0) items.add(new Item(id, data, comment, worth.doubleValue())); } // Close csv file reader.close(); // Sort the item list Collections.sort(items); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } return this; }
From source file:javadz.beanutils.locale.converters.FloatLocaleConverter.java
/** * Convert the specified locale-sensitive input object into an output object of the * specified type. This method will return Float value or throw exception if value * can not be stored in the Float./*from w w w.ja va 2s.com*/ * * @param value The input object to be converted * @param pattern The pattern is used for the convertion * @return The converted value * * @exception ConversionException if conversion cannot be performed * successfully * @throws ParseException if an error occurs parsing a String to a Number */ protected Object parse(Object value, String pattern) throws ParseException { final Number parsed = (Number) super.parse(value, pattern); double doubleValue = parsed.doubleValue(); double posDouble = (doubleValue >= (double) 0) ? doubleValue : (doubleValue * (double) -1); if (posDouble != 0 && (posDouble < Float.MIN_VALUE || posDouble > Float.MAX_VALUE)) { throw new ConversionException("Supplied number is not of type Float: " + parsed); } return new Float(parsed.floatValue()); // unlike superclass it returns Float type }
From source file:edu.cuny.jfree.chart.renderer.category.ValueListShapeRenderer.java
@Override public void drawItem(final Graphics2D g2, final CategoryItemRendererState state, final Rectangle2D dataArea, final CategoryPlot plot, final CategoryAxis domainAxis, final ValueAxis rangeAxis, final CategoryDataset dataset, final int row, final int column, final int pass) { final ListCategoryDataset setData = (ListCategoryDataset) dataset; final List list = setData.getList(row, column); if (list == null) { return;//from www.j ava 2 s . c om } final PlotOrientation orientation = plot.getOrientation(); final double x = domainAxis.getCategoryMiddle(column, getColumnCount(), dataArea, plot.getDomainAxisEdge()); final Iterator iterator = list.iterator(); while (iterator.hasNext()) { final Number value = (Number) iterator.next(); final double y = rangeAxis.valueToJava2D(value.doubleValue(), dataArea, plot.getRangeAxisEdge()); Shape shape = getItemShape(row, column); if (orientation == PlotOrientation.HORIZONTAL) { shape = ShapeUtilities.createTranslatedShape(shape, y, x); } else if (orientation == PlotOrientation.VERTICAL) { shape = ShapeUtilities.createTranslatedShape(shape, x, y); } if (getItemShapeVisible(row, column)) { if (getItemShapeFilled(row, column)) { g2.setPaint(getItemPaint(row, column)); g2.fill(shape); } else { if (getUseOutlinePaint()) { g2.setPaint(getItemOutlinePaint(row, column)); } else { g2.setPaint(getItemPaint(row, column)); } g2.setStroke(getItemOutlineStroke(row, column)); g2.draw(shape); } } g2.setPaint(getItemPaint(row, column)); if (isItemLabelVisible(row, column)) { if (orientation == PlotOrientation.HORIZONTAL) { drawItemLabel(g2, orientation, dataset, row, column, y, x, value.doubleValue() < 0.0D); } else if (orientation == PlotOrientation.VERTICAL) { drawItemLabel(g2, orientation, dataset, row, column, x, y, value.doubleValue() < 0.0D); } } if (state.getInfo() != null) { final EntityCollection entities = state.getEntityCollection(); if ((entities != null) && (shape != null)) { String tip = null; final CategoryToolTipGenerator tipster = getToolTipGenerator(row, column); if (tipster != null) { tip = tipster.generateToolTip(dataset, row, column); } String url = null; if (getItemURLGenerator(row, column) != null) { url = getItemURLGenerator(row, column).generateURL(dataset, row, column); } final CategoryItemEntity entity = new CategoryItemEntity(shape, tip, url, dataset, dataset.getRowKey(row), dataset.getColumnKey(column)); entities.add(entity); } } } }
From source file:au.org.ala.delta.model.NumericRange.java
private Range createRangeForSingleValue(Number value) { if ((_absoluteError == null) && (_percentageError == null)) { return new NumberRange(value); }//from w w w . j a v a 2s .c om double val = value.doubleValue(); if (_absoluteError != null) { return new NumberRange(val - _absoluteError, val + _absoluteError); } else { double lower = 100 * val / (100 + _percentageError); double upper = val * (100 + _percentageError) / 100; return new NumberRange(lower, upper); } }
From source file:com.projity.server.data.MPXConverter.java
/** * Convert an mpx task into a projity task * @param mpxTask// ww w. j av a 2s.co m * @param projityTask */ public static void toProjityTask(Task mpxTask, NormalTask projityTask, Context context) { //TODO what about resources that are unassigned, do they have a fictive task associated? boolean isNotPodServer = Environment.isNoPodServer(); if (!isNotPodServer) { oldToProjityTask(mpxTask, projityTask, context); return; } // JGao - 9/16/2009 Added leaf task which is a task that doesn't have any assignment and child task boolean isLeafTask = mpxTask.getResourceAssignments().isEmpty() && mpxTask.getChildTasks().size() == 0; projityTask.setName(truncName(mpxTask.getName())); if (mpxTask.getWBS() != null) projityTask.setWbs(mpxTask.getWBS()); //projityTask.setUniqueId(mpxTask.getUniqueIDValue()); projityTask.setNotes(mpxTask.getNotes()); Date s; Date f; if (context.isDatesWithoutTimeZone()) { if (mpxTask.getStart() == null) { System.out.println( "Null start found for task " + mpxTask.getName() + " uid " + mpxTask.getUniqueID()); mpxTask.setStart(new Date(DateTime.midnightToday())); mpxTask.setFinish(new Date(DateTime.midnightToday())); } if (!context.isDatesPinned()) { Date start = new Date( CalendarOption.getInstance().makeValidStart(mpxTask.getStart().getTime(), true)); mpxTask.setStart(start); if (mpxTask.getDuration() == null || mpxTask.getDuration().getDuration() == 0) mpxTask.setFinish(start); else mpxTask.setFinish(new Date( CalendarOption.getInstance().makeValidEnd(mpxTask.getFinish().getTime(), true))); } else { mpxTask.setStart(DateTime.gmtDate(mpxTask.getStart())); mpxTask.setFinish(DateTime.gmtDate(mpxTask.getFinish())); } projityTask.getCurrentSchedule().setStart(mpxTask.getStart().getTime()); } else { projityTask.getCurrentSchedule().setStart(DateTime.gmt(mpxTask.getStart())); // start needs to be correct for assignment import/ projityTask.getCurrentSchedule().setFinish(DateTime.gmt(mpxTask.getFinish())); // finish needs to be correct for assignment import } // projityTask.getCurrentSchedule().setStart(mpxTask.getStart().getTime()); // start needs to be correct for assignment import // // projityTask.getCurrentSchedule().setFinish(mpxTask.getFinish().getTime()); // finish needs to be correct for assignment import if (mpxTask.getID() == null) { // if no task id, generate one mpxTask.setID(++autoId); } projityTask.setId(mpxTask.getID()); if (isNotPodServer) { long uniqueId = mpxTask.getUniqueID(); // System.out.println("Importing task uniqueId="+uniqueId); if (uniqueId > 0) projityTask.setUniqueId(uniqueId); else if (uniqueId < 0) projityTask.setRoot(true); } projityTask.setCreated(toNormalDate(mpxTask.getCreateDate())); // projityTask.setRawDuration(toProjityDuration(mpxTask.getDuration(),context)); // set duration without controls projityTask.setDuration(toProjityDuration(mpxTask.getDuration(), context)); // set duration without controls // System.out.println("Task prj-mpx " + DurationFormat.format(projityTask.getDuration()) + " " + mpxTask.getName() + " dura " + DurationFormat.format(toProjityDuration(mpxTask.getDuration(),context))) ; projityTask.setEstimated(mpxTask.getEstimated()); if (mpxTask.getDeadline() != null) projityTask.setDeadline(DateTime.gmt(mpxTask.getDeadline())); Priority priority = mpxTask.getPriority(); if (priority != null) projityTask.setPriority(mpxTask.getPriority().getValue()); Number fc = mpxTask.getFixedCost(); if (fc != null) projityTask.setFixedCost(fc.doubleValue()); Date constraintDate = DateTime.gmtDate(mpxTask.getConstraintDate()); ConstraintType ct = mpxTask.getConstraintType(); if (ct != null) { long ctime = constraintDate == null ? 0 : constraintDate.getTime(); if (constraintDate != null && context.isDatesWithoutTimeZone()) { if (ct.equals(ConstraintType.MUST_START_ON) || ct.equals(ConstraintType.START_NO_EARLIER_THAN) || ct.equals(ConstraintType.START_NO_LATER_THAN)) ctime = CalendarOption.getInstance().makeValidStart(ctime, true); else ctime = CalendarOption.getInstance().makeValidEnd(ctime, true); } projityTask.setScheduleConstraint(ct.getType(), ctime); } ProjectCalendar mpxCalendar = mpxTask.getCalendar(); if (mpxCalendar != null) { WorkCalendar cal = ImportedCalendarService.getInstance().findImportedCalendar(mpxCalendar); if (cal == null) System.out.println("Error finding imported calendar " + mpxCalendar.getName()); else projityTask.setWorkCalendar(cal); } // System.out.println("reading %" + mpxTask.getPercentageComplete().doubleValue()); // projityTask.setPercentComplete(mpxTask.getPercentageComplete().doubleValue()); projityTask.setLevelingDelay(toProjityDuration(mpxTask.getLevelingDelay(), context)); // Date bs = toNormalDate(mpxTask.getBaselineStart()); projityTask.setEffortDriven(mpxTask.getEffortDriven()); long planWork = -1; if (mpxTask.getWork() != null) { planWork = toProjityDuration(mpxTask.getWork(), context); } long actualWork = -1; if (mpxTask.getActualWork() != null) actualWork = toProjityDuration(mpxTask.getActualWork(), context); // JGao 9/16/2009 If task is leaf task and actual work is greater than plan work, it is better to keep the default task type instead of fixed duration boolean needToKeepDefaultSchedulingType = isNotPodServer && isLeafTask && (planWork != -1 && actualWork > planWork) && mpxTask.getStop() == null; // if (needToSetWorkToActualWork) // projityTask.setWork( actualWork ); if (mpxTask.getType() != null) projityTask.setSchedulingType(mpxTask.getType().getValue()); else if (context.isUseFixedDuration() && !needToKeepDefaultSchedulingType) { projityTask.setSchedulingType(SchedulingType.FIXED_DURATION); // projityTask.setWork(toProjityDuration(mpxTask.getWork(), context)); } // System.out.println("sched type " + projityTask.getSchedulingType()); if (mpxTask.getResourceAssignments().isEmpty() && mpxTask.getChildTasks().size() == 0) { if (planWork == -1) planWork = 0; // JGao 9/25/2009 Added logic to surpress the fixed duration change message boolean batchMode = Environment.isBatchMode(); Environment.setBatchMode(true); projityTask.setWork(planWork); Environment.setBatchMode(batchMode); } //use stop and not percent complete because of rounding issues - this is a little odd, but true. setting stop in assignment can set % complete if (mpxTask.getStop() != null) { if (isNotPodServer && !mpxTask.getResourceAssignments().isEmpty() && context.isActualsProtected()) { if (!context.isShowedActualWarning()) { // show just once Alert.warn(Messages.getString("Message.importActualsRemoved")); context.setShowedActualWarning(true); } } else if (!isNotPodServer || (isNotPodServer && isLeafTask)) { // JGao - 9/15/2009 For the mariner integration, only set task stop if it is a leaf task without any assignments projityTask.setStop(DateTime.gmt(mpxTask.getStop())); } } if (mpxTask.getActualStart() != null && isNotPodServer) projityTask.setActualStart(DateTime.gmt(mpxTask.getActualStart())); // JGao - 9/3/2009 This section is added to deal with actuals being logged directly on task // long actualWork = toProjityDuration(mpxTask.getActualWork(), context); if (actualWork > 0 && isNotPodServer && isLeafTask) { FieldContext actualWorkContext = null; if (mpxTask.getStop() != null) { actualWorkContext = new FieldContext(); actualWorkContext.setScripting(true); actualWorkContext.setForceValue(true); actualWorkContext.setInterval(new ImmutableInterval(DateTime.gmt(mpxTask.getActualStart()), DateTime.gmt(mpxTask.getStop()))); } projityTask.setActualWork(actualWork, actualWorkContext); if (planWork >= 0 && actualWork > planWork) { projityTask.setFixedCost(mpxTask.getActualCost().doubleValue()); } if (mpxTask.getActualFinish() != null) { projityTask.setComplete(true); } } // Number fixed = mpxTask.getFixedCost(); // if (fixed != null) // projityTask.setFixedCost(fixed.doubleValue()); if (mpxTask.getFixedCostAccrual() != null) projityTask.setFixedCostAccrual(mpxTask.getFixedCostAccrual().getType()); if (!projityTask.isMilestone() && mpxTask.getMilestone()) // only set flag if marked - don't want the flag for 0d tasks projityTask.setMarkTaskAsMilestone(true); if (mpxTask.getEarnedValueMethod() != null) projityTask.setEarnedValueMethod(mpxTask.getEarnedValueMethod().getValue()); projityTask.setIgnoreResourceCalendar(mpxTask.getIgnoreResourceCalendar()); toProjityCustomFields(projityTask.getCustomFields(), mpxTask, CustomFieldsMapper.getInstance().taskMaps, context); }
From source file:org.jfree.chart.demo.CylinderRenderer.java
public void drawItem(Graphics2D graphics2d, CategoryItemRendererState categoryitemrendererstate, Rectangle2D rectangle2d, CategoryPlot categoryplot, CategoryAxis categoryaxis, ValueAxis valueaxis, CategoryDataset categorydataset, int i, int j, int k) { Number number = categorydataset.getValue(i, j); if (number == null) return;//from w w w.ja v a2 s .c om double d = number.doubleValue(); java.awt.geom.Rectangle2D.Double double1 = new java.awt.geom.Rectangle2D.Double(rectangle2d.getX(), rectangle2d.getY() + getYOffset(), rectangle2d.getWidth() - getXOffset(), rectangle2d.getHeight() - getYOffset()); PlotOrientation plotorientation = categoryplot.getOrientation(); double d1 = calculateBarW0(categoryplot, plotorientation, double1, categoryaxis, categoryitemrendererstate, i, j); double ad[] = calculateBarL0L1(d); if (ad == null) return; RectangleEdge rectangleedge = categoryplot.getRangeAxisEdge(); float f = (float) valueaxis.valueToJava2D(ad[0], double1, rectangleedge); float f1 = (float) valueaxis.valueToJava2D(ad[1], double1, rectangleedge); float f2 = Math.min(f, f1); float f3 = Math.abs(f1 - f); GeneralPath generalpath = new GeneralPath(); java.awt.geom.Ellipse2D.Double double2 = null; if (plotorientation == PlotOrientation.HORIZONTAL) { generalpath.moveTo((float) ((double) f2 + getXOffset() / 2D), (float) d1); generalpath.lineTo((float) ((double) (f2 + f3) + getXOffset() / 2D), (float) d1); java.awt.geom.Arc2D.Double double3 = new java.awt.geom.Arc2D.Double(f2 + f3, d1, getXOffset(), categoryitemrendererstate.getBarWidth(), 90D, 180D, 0); generalpath.append(double3, true); generalpath.lineTo((float) ((double) f2 + getXOffset() / 2D), (float) (d1 + categoryitemrendererstate.getBarWidth())); double3 = new java.awt.geom.Arc2D.Double(f2, d1, getXOffset(), categoryitemrendererstate.getBarWidth(), 270D, -180D, 0); generalpath.append(double3, true); generalpath.closePath(); double2 = new java.awt.geom.Ellipse2D.Double(f2 + f3, d1, getXOffset(), categoryitemrendererstate.getBarWidth()); } else { generalpath.moveTo((float) d1, (float) ((double) f2 - getYOffset() / 2D)); generalpath.lineTo((float) d1, (float) ((double) (f2 + f3) - getYOffset() / 2D)); java.awt.geom.Arc2D.Double double4 = new java.awt.geom.Arc2D.Double(d1, (double) (f2 + f3) - getYOffset(), categoryitemrendererstate.getBarWidth(), getYOffset(), 180D, 180D, 0); generalpath.append(double4, true); generalpath.lineTo((float) (d1 + categoryitemrendererstate.getBarWidth()), (float) ((double) f2 - getYOffset() / 2D)); double4 = new java.awt.geom.Arc2D.Double(d1, (double) f2 - getYOffset(), categoryitemrendererstate.getBarWidth(), getYOffset(), 0.0D, -180D, 0); generalpath.append(double4, true); generalpath.closePath(); double2 = new java.awt.geom.Ellipse2D.Double(d1, (double) f2 - getYOffset(), categoryitemrendererstate.getBarWidth(), getYOffset()); } Object obj = getItemPaint(i, j); if (getGradientPaintTransformer() != null && (obj instanceof GradientPaint)) { GradientPaint gradientpaint = (GradientPaint) obj; obj = getGradientPaintTransformer().transform(gradientpaint, generalpath); } graphics2d.setPaint(((java.awt.Paint) (obj))); graphics2d.fill(generalpath); if (obj instanceof GradientPaint) { graphics2d.setPaint(((GradientPaint) obj).getColor2()); } if (double2 != null) { graphics2d.fill(double2); } if (isDrawBarOutline() && categoryitemrendererstate.getBarWidth() > 3D) { graphics2d.setStroke(getItemOutlineStroke(i, j)); graphics2d.setPaint(getItemOutlinePaint(i, j)); graphics2d.draw(generalpath); if (double2 != null) graphics2d.draw(double2); } CategoryItemLabelGenerator categoryitemlabelgenerator = getItemLabelGenerator(i, j); if (categoryitemlabelgenerator != null && isItemLabelVisible(i, j)) drawItemLabel(graphics2d, categorydataset, i, j, categoryplot, categoryitemlabelgenerator, generalpath.getBounds2D(), d < 0.0D); if (categoryitemrendererstate.getInfo() != null) { EntityCollection entitycollection = categoryitemrendererstate.getEntityCollection(); if (entitycollection != null) { String s = null; CategoryToolTipGenerator categorytooltipgenerator = getToolTipGenerator(i, j); if (categorytooltipgenerator != null) s = categorytooltipgenerator.generateToolTip(categorydataset, i, j); String s1 = null; if (getItemURLGenerator(i, j) != null) s1 = getItemURLGenerator(i, j).generateURL(categorydataset, i, j); CategoryItemEntity categoryitementity = new CategoryItemEntity(generalpath.getBounds2D(), s, s1, categorydataset, categorydataset.getRowKey(i), categorydataset.getColumnKey(j)); entitycollection.add(categoryitementity); } } }
From source file:org.squale.squaleweb.util.graph.KiviatMaker.java
/** * Ajoute les d'un composant. <br /> * <b>Attention : </b> pour assurer la cohrences des donnes, si cette mthode est appelle plusieurs fois, pValues * doit avoir chaque fois la meme taille et les mme cls. * /* w ww .j a va 2s .c om*/ * @param pName nom associ la future courbe. * @param pValues SortedMap contenant en cl (tri!) des facteurs sous forme de String et en valeur des nombres * (Double). * @param pRequest pour avoir le nom des facteurs internationaliss */ public void addValues(String pName, SortedMap pValues, HttpServletRequest pRequest) { Set keys = pValues.keySet(); // Ajoute les donnes Iterator it = keys.iterator(); // Pour chaque axe, on cre l'axe avec son titre et on ajoute les valeurs while (it.hasNext()) { // Internationalisation du nom // On a besoin d'un tokenizer pour ne pas prendre en compte la partie entre () String key = (String) it.next(); StringTokenizer st = new StringTokenizer(key, "("); String axis = WebMessages.getString(pRequest, ("factor.internationalise.name." + st.nextToken()).trim()); // le facteur peut ne pas avoir de note, dans ce cas il n'y a plus de tokens // le premier token contient tout if (st.hasMoreTokens()) { axis += "(" + st.nextToken(); } mDataset.addValue(1.0D, "1.0", axis); mDataset.addValue(2.0D, "2.0", axis); final double thirdValue = 3.0D; mDataset.addValue(thirdValue, "3.0", axis); Number number = ((Number) pValues.get(key)); if (number != null && number.doubleValue() >= 0.0) { mDataset.addValue(number.doubleValue(), pName, axis); } } }