class MediaWikiUtil {

    static double parseDecDeg(String docDegMarkup) {
        Validate.notNull(docDegMarkup, "string must not be null");
        WikiTemplate templateData = extractTemplate(docDegMarkup);
        String degStr = templateData.getEntry("deg", "0");
        String minStr = templateData.getEntry("min", "1");
        String secStr = templateData.getEntry("sec", "2");
        String hem = templateData.getEntry("hem", "3");
        try {
            double deg = StringUtils.isNotBlank(degStr) ? Double.parseDouble(degStr) : 0;
            double min = StringUtils.isNotBlank(minStr) ? Double.parseDouble(minStr) : 0;
            double sec = StringUtils.isNotBlank(secStr) ? Double.parseDouble(secStr) : 0;
            int sgn;
            if (StringUtils.isNotBlank(hem)) {
                sgn = "W".equals(hem) || "S".equals(hem) ? -1 : 1;
            } else {
                sgn = degStr.startsWith("-") ? -1 : 1;
            }
            double result = sgn * (Math.abs(deg) + min / 60. + sec / 3600.);
            String rndStr = templateData.getEntry("rnd", "4");
            if (StringUtils.isNotBlank(rndStr)) {
                int rnd = Integer.parseInt(rndStr);
                result = MathHelper.round(result, rnd);
            }
            return result;
        } catch (Exception e) {
            throw new NumberFormatException("The coordinate data from \"" + docDegMarkup + "\" could not be parsed.");
        }
    }

    private  MediaWikiUtil();

}