Example usage for java.lang Double doubleValue

List of usage examples for java.lang Double doubleValue

Introduction

In this page you can find the example usage for java.lang Double doubleValue.

Prototype

@HotSpotIntrinsicCandidate
public double doubleValue() 

Source Link

Document

Returns the double value of this Double object.

Usage

From source file:net.sf.fspdfs.chartthemes.simple.SimpleChartTheme.java

protected void setAxisLabel(Axis axis, JRFont labelFont, Paint labelColor, AxisSettings axisSettings) {
    Boolean axisLabelVisible = axisSettings.getLabelVisible();

    if (axisLabelVisible == null || axisLabelVisible.booleanValue()) {
        //         if(axis.getLabel() == null)
        //            axis.setLabel(axisSettings.getLabel());

        Double labelAngle = axisSettings.getLabelAngle();
        if (labelAngle != null)
            axis.setLabelAngle(labelAngle.doubleValue());

        JRBaseFont font = new JRBaseFont();
        JRFontUtil.copyNonNullOwnProperties(axisSettings.getLabelFont(), font);
        JRFontUtil.copyNonNullOwnProperties(labelFont, font);
        font = new JRBaseFont(getChart(), font);
        axis.setLabelFont(JRFontUtil.getAwtFont(font, getLocale()));

        RectangleInsets labelInsets = axisSettings.getLabelInsets();
        if (labelInsets != null) {
            axis.setLabelInsets(labelInsets);
        }/*w  w w .  java2 s  . c  o  m*/
        Paint labelPaint = labelColor != null ? labelColor
                : axisSettings.getLabelPaint() != null ? axisSettings.getLabelPaint().getPaint() : null;
        if (labelPaint != null) {
            axis.setLabelPaint(labelPaint);
        }
    }
}

From source file:org.sakaiproject.tool.gradebook.business.impl.GradebookManagerHibernateImpl.java

public double getLiteralTotalPointsInternal(final Long gradebookId, final Gradebook gradebook,
        final List categories) {
    HibernateCallback hc = new HibernateCallback() {
        @Override/* ww  w .  ja  v  a  2s. c o m*/
        public Object doInHibernate(Session session) throws HibernateException {
            double totalPointsPossible = 0;
            Iterator assignmentIter = session.createQuery(
                    "select asn from Assignment asn where asn.gradebook.id=:gbid and asn.removed=false and asn.notCounted=false and asn.ungraded=false")
                    .setParameter("gbid", gradebookId).list().iterator();
            while (assignmentIter.hasNext()) {
                Assignment asn = (Assignment) assignmentIter.next();
                if (asn != null) {
                    Double pointsPossible = asn.getPointsPossible();

                    if (gradebook.getCategory_type() == GradebookService.CATEGORY_TYPE_NO_CATEGORY) {
                        totalPointsPossible += pointsPossible.doubleValue();
                    } else if (gradebook.getCategory_type() == GradebookService.CATEGORY_TYPE_ONLY_CATEGORY) {
                        totalPointsPossible += pointsPossible.doubleValue();
                    } else if (gradebook.getCategory_type() == GradebookService.CATEGORY_TYPE_WEIGHTED_CATEGORY
                            && categories != null) {
                        for (int i = 0; i < categories.size(); i++) {
                            Category cate = (Category) categories.get(i);
                            if (cate != null && !cate.isRemoved() && asn.getCategory() != null
                                    && cate.getId().equals(asn.getCategory().getId())) {
                                totalPointsPossible += pointsPossible.doubleValue();
                                break;
                            }
                        }
                    }
                }
            }
            return totalPointsPossible;
        }
    };
    return (Double) getHibernateTemplate().execute(hc);
}

From source file:net.sf.fspdfs.chartthemes.spring.GenericChartTheme.java

protected void setAxisLabel(Axis axis, JRFont labelFont, Paint labelColor, Integer baseFontSize) {
    Boolean defaultAxisLabelVisible = (Boolean) getDefaultValue(defaultAxisPropertiesMap,
            ChartThemesConstants.AXIS_LABEL_VISIBLE);
    if (defaultAxisLabelVisible != null && defaultAxisLabelVisible.booleanValue()) {
        if (axis.getLabel() == null)
            axis.setLabel((String) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LABEL));

        Double defaultLabelAngle = (Double) getDefaultValue(defaultAxisPropertiesMap,
                ChartThemesConstants.AXIS_LABEL_ANGLE);
        if (defaultLabelAngle != null)
            axis.setLabelAngle(defaultLabelAngle.doubleValue());
        Font themeLabelFont = getFont(
                (JRFont) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LABEL_FONT),
                labelFont, baseFontSize);
        axis.setLabelFont(themeLabelFont);

        RectangleInsets defaultLabelInsets = (RectangleInsets) getDefaultValue(defaultAxisPropertiesMap,
                ChartThemesConstants.AXIS_LABEL_INSETS);
        if (defaultLabelInsets != null) {
            axis.setLabelInsets(defaultLabelInsets);
        }//  w w w.j  a v a2  s  .  co  m
        Paint labelPaint = labelColor != null ? labelColor
                : (Paint) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LABEL_PAINT);
        if (labelPaint != null) {
            axis.setLabelPaint(labelPaint);
        }
    }
}

From source file:com.aurel.track.exchange.msProject.exporter.MsProjectExporterBL.java

/**
 * Set the project elements//from  www .ja  v  a 2  s.  co m
 * 
 * @param rootElement
 * @param name
 * @param existingTrackPlusWorkItems
 * @param projectBean
 * @param defaultTaskType
 * @param durationFormat
 * @param hoursPerWorkDay
 */
private static void setProjectElements(ProjectFile project, String name, String projectStartDate,
        String projectEndDate, TProjectBean projectBean, Integer defaultTaskType, Integer durationFormat,
        Double hoursPerWorkDay) {
    Integer oldMinutesPerDay = PropertiesHelper.getIntegerProperty(projectBean.getMoreProps(),
            TProjectBean.MOREPPROPS.MINUTES_PER_DAY);
    Integer oldMinutesPerWeek = PropertiesHelper.getIntegerProperty(projectBean.getMoreProps(),
            TProjectBean.MOREPPROPS.MINUTES_PER_WEEK);
    if (oldMinutesPerDay == null) {
        oldMinutesPerDay = Integer.valueOf(8 * 60);
    }
    if (oldMinutesPerWeek == null) {
        oldMinutesPerWeek = Integer.valueOf(5 * 8 * 60);
    }
    Integer newMinutesPerDay = oldMinutesPerDay;
    Integer newMinutesPerWeek = oldMinutesPerWeek;
    if (hoursPerWorkDay != null && Math.abs(hoursPerWorkDay.doubleValue()) > EPSILON) {
        newMinutesPerDay = new Double(hoursPerWorkDay * 60).intValue();
        if (EqualUtils.notEqual(newMinutesPerDay, oldMinutesPerDay)) {
            // the hoursPerWorkDay has been changed since the last project
            // import:
            // change also the minutes per week according to daysPerWeek
            double daysPerWeek = oldMinutesPerWeek / oldMinutesPerDay;
            newMinutesPerWeek = new Double(newMinutesPerDay * daysPerWeek).intValue();
        }
    }
    Date date = new Date();
    DateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
    try {
        project.getProjectHeader().setName(name);
        project.getProjectHeader().setSubject(projectBean.getDescription());
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        project.getProjectHeader().setCreationDate(cal.getTime());
        project.getProjectHeader().setLastSaved(cal.getTime());
        project.getProjectHeader().setStatusDate(dateTimeFormat.parse(projectStartDate));
        project.getProjectHeader().setCurrencyCode("EUR");
        project.getProjectHeader().setCurrentDate(cal.getTime());
        project.getProjectHeader().setStartDate(dateTimeFormat.parse(projectStartDate));
        project.getProjectHeader().setFinishDate(dateTimeFormat.parse(projectEndDate));
    } catch (Exception ex) {
        LOGGER.error(ExceptionUtils.getStackTrace(ex));
        LOGGER.error("Date parse error: " + ex.getMessage());
    }

    if (defaultTaskType != null) {
        project.getProjectHeader().setDefaultTaskType(TaskType.getInstance(defaultTaskType));
    }

    ProjectAccountingTO projectAccountingTO = ProjectBL.getProjectAccountingTO(projectBean.getObjectID());
    String curencySymbol = projectAccountingTO.getCurrencySymbol();// projectBean.getCurrencySymbol();
    if (curencySymbol != null) {
        project.getProjectHeader().setCurrencySymbol(curencySymbol);
    }
    if (newMinutesPerDay != null) {
        project.getProjectHeader().setMinutesPerDay(newMinutesPerDay);
    }
    if (newMinutesPerWeek != null) {
        project.getProjectHeader().setMinutesPerWeek(newMinutesPerWeek);
    }
    Integer daysPerMonth = PropertiesHelper.getIntegerProperty(projectBean.getMoreProps(),
            TProjectBean.MOREPPROPS.DAYS_PER_MONTH);
    if (daysPerMonth != null) {
        project.getProjectHeader().setDaysPerMonth(daysPerMonth);
    }
    // TODO Duration format field missing
    // if (durationFormat!=null) {
    // MsProjectExchangeDOMHelper.setChildTextByName(rootElement,
    // PROJECT_ELEMENTS.DurationFormat, durationFormat.toString(), false);
    // project.getProjectHeader().setDurat
    // }
    Integer weekStartDay = project.getProjectHeader().getWeekStartDay().getValue();
    if (weekStartDay == null) {
        project.getProjectHeader().setWeekStartDay(Day.getInstance(Calendar.getInstance().getFirstDayOfWeek()));
    }
}

From source file:net.sf.fspdfs.chartthemes.spring.GenericChartTheme.java

/**
 * Sets all the axis formatting options.  This includes the colors and fonts to use on
 * the axis as well as the color to use when drawing the axis line.
 *
 * @param axis the axis to format// w  w  w .jav a 2 s  .com
 * @param labelFont the font to use for the axis label
 * @param labelColor the color of the axis label
 * @param tickLabelFont the font to use for each tick mark value label
 * @param tickLabelColor the color of each tick mark value label
 * @param tickLabelMask formatting mask for the label.  If the axis is a NumberAxis then
 *                    the mask should be <code>java.text.DecimalFormat</code> mask, and
 *                   if it is a DateAxis then the mask should be a
 *                   <code>java.text.SimpleDateFormat</code> mask.
 * @param verticalTickLabels flag to draw tick labels at 90 degrees
 * @param lineColor color to use when drawing the axis line and any tick marks
 * @param isRangeAxis used to distinguish between range and domain axis type
 * @param timeUnit time unit used to create a DateAxis
 */
protected void configureAxis(Axis axis, JRFont labelFont, Color labelColor, JRFont tickLabelFont,
        Color tickLabelColor, String tickLabelMask, Boolean verticalTickLabels, Paint lineColor,
        boolean isRangeAxis, Comparable axisMinValue, Comparable axisMaxValue) throws JRException {
    Boolean axisVisible = (Boolean) getDefaultValue(defaultAxisPropertiesMap,
            ChartThemesConstants.AXIS_VISIBLE);

    if (axisVisible != null && axisVisible.booleanValue()) {
        setAxisLine(axis, lineColor);

        Double defaultFixedDimension = (Double) getDefaultValue(defaultAxisPropertiesMap,
                ChartThemesConstants.AXIS_FIXED_DIMENSION);
        if (defaultFixedDimension != null) {
            axis.setFixedDimension(defaultFixedDimension.doubleValue());
        }

        Integer baseFontSize = (Integer) getDefaultValue(defaultChartPropertiesMap,
                ChartThemesConstants.BASEFONT_SIZE);
        setAxisLabel(axis, labelFont, labelColor, baseFontSize);
        setAxisTickLabels(axis, tickLabelFont, tickLabelColor, tickLabelMask, baseFontSize);
        setAxisTickMarks(axis, lineColor);
        String timePeriodUnit = isRangeAxis
                ? (String) getDefaultValue(defaultAxisPropertiesMap,
                        ChartThemesConstants.RANGE_AXIS_TIME_PERIOD_UNIT)
                : (String) getDefaultValue(defaultAxisPropertiesMap,
                        ChartThemesConstants.DOMAIN_AXIS_TIME_PERIOD_UNIT);
        setAxisBounds(axis, isRangeAxis, timePeriodUnit, axisMinValue, axisMaxValue);

        if (verticalTickLabels != null && axis instanceof ValueAxis) {
            ((ValueAxis) axis).setVerticalTickLabels(verticalTickLabels.booleanValue());
        }
    } else {
        axis.setVisible(false);
    }
}

From source file:net.sourceforge.fenixedu.domain.CurricularCourse.java

private Double getContactLoadForPreBolonha() {
    final Double theoreticalHours = getTheoreticalHours() == null ? 0d : getTheoreticalHours();
    final Double theoPratHours = getTheoPratHours() == null ? 0d : getTheoPratHours();
    final Double praticalHours = getPraticalHours() == null ? 0d : getPraticalHours();
    final Double labHours = getLabHours() == null ? 0d : getLabHours();
    return CompetenceCourseLoad.NUMBER_OF_WEEKS * (theoreticalHours.doubleValue() + theoPratHours.doubleValue()
            + praticalHours.doubleValue() + labHours.doubleValue());
}

From source file:org.openmicroscopy.shoola.agents.metadata.editor.PropertiesUI.java

/**
 * Returns the pixels size as a string.//ww  w  .  ja va  2 s .c om
 * 
 * @param details The map to convert.
 * @param component The component displaying the information.
 * @return See above.
 */
private String formatPixelsSize(Map details, JLabel component) {
    String x = (String) details.get(EditorUtil.PIXEL_SIZE_X);
    String y = (String) details.get(EditorUtil.PIXEL_SIZE_Y);
    String z = (String) details.get(EditorUtil.PIXEL_SIZE_Z);
    Double dx = null, dy = null, dz = null;
    boolean number = true;
    NumberFormat nf = NumberFormat.getInstance();
    String units = null;
    UnitsObject o;
    try {
        dx = Double.parseDouble(x);
        o = EditorUtil.transformSize(dx);
        units = o.getUnits();
        dx = o.getValue();
    } catch (Exception e) {
        number = false;
    }
    try {
        dy = Double.parseDouble(y);
        o = EditorUtil.transformSize(dy);
        if (units == null)
            units = o.getUnits();
        dy = o.getValue();
    } catch (Exception e) {
        number = false;
    }
    try {
        dz = Double.parseDouble(z);
        o = EditorUtil.transformSize(dz);
        if (units == null)
            units = o.getUnits();
        dz = o.getValue();
    } catch (Exception e) {
        number = false;
    }

    String label = "Pixels Size (";
    String value = "";
    String tooltip = "<html><body>";
    if (dx != null && dx.doubleValue() > 0) {
        value += nf.format(dx);
        tooltip += "X: " + x + "<br>";
        label += "X";
    }
    if (dy != null && dy.doubleValue() > 0) {
        if (value.length() == 0)
            value += nf.format(dy);
        else
            value += "x" + nf.format(dy);
        ;
        tooltip += "Y: " + y + "<br>";
        label += "Y";
    }
    if (dz != null && dz.doubleValue() > 0) {
        if (value.length() == 0)
            value += nf.format(dz);
        else
            value += "x" + nf.format(dz);
        tooltip += "Z: " + z + "<br>";
        label += "Z";
    }
    label += ") ";
    if (!number) {
        component.setForeground(AnnotationUI.WARNING);
        component.setToolTipText("Values stored in the file...");
    } else {
        component.setToolTipText(tooltip);
    }
    if (value.length() == 0)
        return null;
    component.setText(value);
    if (units == null)
        units = UnitsObject.MICRONS;
    label += units;
    return label;
}

From source file:org.sakaiproject.tool.gradebook.business.impl.GradebookManagerHibernateImpl.java

private double getLiteralTotalPointsInternal(final Long gradebookId, Session session, final Gradebook gradebook,
        final List categories) {
    double totalPointsPossible = 0;
    Map<Long, Integer> numAssignments = new HashMap<Long, Integer>();

    Iterator assignmentIter = session.createQuery(
            "select asn from Assignment asn where asn.gradebook.id=:gbid and asn.removed=false and asn.notCounted=false and asn.ungraded=false and (asn.extraCredit=false or asn.extraCredit is null)")
            .setParameter("gbid", gradebookId).list().iterator();

    while (assignmentIter.hasNext()) {
        Assignment asn = (Assignment) assignmentIter.next();
        if (asn != null) {
            Double pointsPossible = asn.getPointsPossible();

            if (gradebook.getCategory_type() == GradebookService.CATEGORY_TYPE_NO_CATEGORY) {
                if (pointsPossible != null)
                    totalPointsPossible += pointsPossible.doubleValue();
            } else if (gradebook.getCategory_type() == GradebookService.CATEGORY_TYPE_ONLY_CATEGORY) {
                if (pointsPossible != null)
                    totalPointsPossible += pointsPossible.doubleValue();
                for (int i = 0; i < categories.size(); i++) {
                    Category cate = (Category) categories.get(i);
                    if (cate != null && !cate.isRemoved() && asn.getCategory() != null
                            && cate.getId().equals(asn.getCategory().getId())) {

                        Integer num = numAssignments.get(cate.getId()); // to calculate totalPointsToDrop, must know the number of assignments for each category
                        if (num == null) {
                            num = new Integer(0);
                        }//from w ww.j a v a 2s.  c o  m
                        num++;
                        numAssignments.put(cate.getId(), num);
                        break;
                    }
                }
            } else if (gradebook.getCategory_type() == GradebookService.CATEGORY_TYPE_WEIGHTED_CATEGORY
                    && categories != null) {
                for (int i = 0; i < categories.size(); i++) {
                    Category cate = (Category) categories.get(i);
                    if (cate != null && !cate.isRemoved() && asn.getCategory() != null
                            && cate.getId().equals(asn.getCategory().getId())) {
                        if (pointsPossible != null)
                            totalPointsPossible += pointsPossible.doubleValue();

                        Integer num = numAssignments.get(cate.getId()); // to calculate totalPointsToDrop, must know the number of assignments for each category
                        if (num == null) {
                            num = new Integer(0);
                        }
                        num++;
                        numAssignments.put(cate.getId(), num);
                        break;
                    }
                }
            }
        }
    }
    double totalPointsToDrop = 0;

    for (int i = 0; i < categories.size(); i++) {
        Category category = (Category) categories.get(i);
        if (category != null && !category.isRemoved() && category.isDropScores()) {
            Double itemValue = category.getItemValue();
            Integer dropHighest = category.getDropHighest();
            Integer dropLowest = category.getDrop_lowest();
            Integer keepHighest = category.getKeepHighest();

            Integer assignmentCount = numAssignments.get(category.getId());
            if (keepHighest != null && keepHighest > 0) {
                if (assignmentCount != null && assignmentCount > 0) {
                    dropLowest = assignmentCount - keepHighest; // dropLowest and keepHighest will not occur at the same time
                    if (dropLowest < 0) {
                        dropLowest = 0;
                    }
                }
            }
            if (assignmentCount != null && assignmentCount > (dropLowest + dropHighest)) {
                totalPointsToDrop += (itemValue * dropHighest);
                totalPointsToDrop += (itemValue * dropLowest);
            }
        }
    }
    totalPointsPossible -= totalPointsToDrop;
    return totalPointsPossible;
}

From source file:org.displaytag.util.NumberUtils.java

/**
 * <p>Turns a string value into a java.lang.Number.</p>
 *
 * <p>First, the value is examined for a type qualifier on the end
 * (<code>'f','F','d','D','l','L'</code>).  If it is found, it starts 
 * trying to create successively larger types from the type specified
 * until one is found that can represent the value.</p>
 *
 * <p>If a type specifier is not found, it will check for a decimal point
 * and then try successively larger types from <code>Integer</code> to
 * <code>BigInteger</code> and from <code>Float</code> to
 * <code>BigDecimal</code>.</p>
 *
 * <p>If the string starts with <code>0x</code> or <code>-0x</code>, it
 * will be interpreted as a hexadecimal integer.  Values with leading
 * <code>0</code>'s will not be interpreted as octal.</p>
 *
 * <p>Returns <code>null</code> if the string is <code>null</code>.</p>
 *
 * <p>This method does not trim the input string, i.e., strings with leading
 * or trailing spaces will generate NumberFormatExceptions.</p>
 *
 * @param str  String containing a number, may be null
 * @return Number created from the string
 * @throws NumberFormatException if the value cannot be converted
 *//*  www .  j a  v  a  2s.  c  o m*/
public static Number createNumber(String str) throws NumberFormatException {
    if (str == null) {
        return null;
    }
    if (StringUtils.isBlank(str)) {
        throw new NumberFormatException("A blank string is not a valid number");
    }
    if (str.startsWith("--")) {
        // this is protection for poorness in java.lang.BigDecimal.
        // it accepts this as a legal value, but it does not appear 
        // to be in specification of class. OS X Java parses it to 
        // a wrong value.
        return null;
    }
    if (str.startsWith("0x") || str.startsWith("-0x")) {
        return createInteger(str);
    }
    char lastChar = str.charAt(str.length() - 1);
    String mant;
    String dec;
    String exp;
    int decPos = str.indexOf('.');
    int expPos = str.indexOf('e') + str.indexOf('E') + 1;

    if (decPos > -1) {

        if (expPos > -1) {
            if (expPos < decPos || expPos > str.length()) {
                throw new NumberFormatException(str + " is not a valid number.");
            }
            dec = str.substring(decPos + 1, expPos);
        } else {
            dec = str.substring(decPos + 1);
        }
        mant = str.substring(0, decPos);
    } else {
        if (expPos > -1) {
            if (expPos > str.length()) {
                throw new NumberFormatException(str + " is not a valid number.");
            }
            mant = str.substring(0, expPos);
        } else {
            mant = str;
        }
        dec = null;
    }
    if (!Character.isDigit(lastChar) && lastChar != '.') {
        if (expPos > -1 && expPos < str.length() - 1) {
            exp = str.substring(expPos + 1, str.length() - 1);
        } else {
            exp = null;
        }
        //Requesting a specific type..
        String numeric = str.substring(0, str.length() - 1);
        boolean allZeros = isAllZeros(mant) && isAllZeros(exp);
        switch (lastChar) {
        case 'l':
        case 'L':
            if (dec == null && exp == null
                    && (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) {
                try {
                    return createLong(numeric);
                } catch (NumberFormatException nfe) {
                    //Too big for a long
                }
                return createBigInteger(numeric);

            }
            throw new NumberFormatException(str + " is not a valid number.");
        case 'f':
        case 'F':
            try {
                Float f = NumberUtils.createFloat(numeric);
                if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) {
                    //If it's too big for a float or the float value = 0 and the string
                    //has non-zeros in it, then float does not have the precision we want
                    return f;
                }

            } catch (NumberFormatException nfe) {
                // ignore the bad number
            }
            //$FALL-THROUGH$
        case 'd':
        case 'D':
            try {
                Double d = NumberUtils.createDouble(numeric);
                if (!(d.isInfinite() || (d.floatValue() == 0.0D && !allZeros))) {
                    return d;
                }
            } catch (NumberFormatException nfe) {
                // ignore the bad number
            }
            try {
                return createBigDecimal(numeric);
            } catch (NumberFormatException e) {
                // ignore the bad number
            }
            //$FALL-THROUGH$
        default:
            throw new NumberFormatException(str + " is not a valid number.");

        }
    } else {
        //User doesn't have a preference on the return type, so let's start
        //small and go from there...
        if (expPos > -1 && expPos < str.length() - 1) {
            exp = str.substring(expPos + 1, str.length());
        } else {
            exp = null;
        }
        if (dec == null && exp == null) {
            //Must be an int,long,bigint
            try {
                return createInteger(str);
            } catch (NumberFormatException nfe) {
                // ignore the bad number
            }
            try {
                return createLong(str);
            } catch (NumberFormatException nfe) {
                // ignore the bad number
            }
            return createBigInteger(str);

        } else {
            //Must be a float,double,BigDec
            boolean allZeros = isAllZeros(mant) && isAllZeros(exp);
            try {
                Float f = createFloat(str);
                if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) {
                    return f;
                }
            } catch (NumberFormatException nfe) {
                // ignore the bad number
            }
            try {
                Double d = createDouble(str);
                if (!(d.isInfinite() || (d.doubleValue() == 0.0D && !allZeros))) {
                    return d;
                }
            } catch (NumberFormatException nfe) {
                // ignore the bad number
            }

            return createBigDecimal(str);

        }
    }
}

From source file:net.sf.fspdfs.chartthemes.spring.GenericChartTheme.java

/**
 *
 *//* w  ww  .  j a  va2  s.co  m*/
protected void configureChart(JFreeChart jfreeChart, JRChartPlot jrPlot) throws JRException {
    Integer defaultBaseFontSize = (Integer) getDefaultValue(defaultChartPropertiesMap,
            ChartThemesConstants.BASEFONT_SIZE);

    setChartBackground(jfreeChart);
    setChartTitle(jfreeChart, defaultBaseFontSize);
    setChartSubtitles(jfreeChart, defaultBaseFontSize);
    setChartLegend(jfreeChart, defaultBaseFontSize);
    setChartBorder(jfreeChart);

    Boolean isAntiAlias = (Boolean) getDefaultValue(defaultChartPropertiesMap,
            ChartThemesConstants.CHART_ANTI_ALIAS);
    if (isAntiAlias != null)
        jfreeChart.setAntiAlias(isAntiAlias.booleanValue());

    Double padding = (Double) getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.CHART_PADDING);
    UnitType unitType = (UnitType) getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.UNIT_TYPE);
    if (padding != null && unitType != null) {
        double chartPadding = padding.doubleValue();
        jfreeChart.setPadding(
                new RectangleInsets(unitType, chartPadding, chartPadding, chartPadding, chartPadding));
    }
    configurePlot(jfreeChart.getPlot(), jrPlot);
}