@SuppressWarnings("PMD.NPathComplexity")
    private static boolean checkAndApply(final String fillPattern, final String coordPattern, final int row, final GridLayout grid, final int viewPos) {
        if (coordPattern == null) {
            return false;
        }
        final TextParser coordParser = new TextParser(coordPattern.trim());
        int vp = viewPos;
        if (!checkAndApplyHemisphere(row, coordParser, grid, vp)) {
            return false;
        }
        if (vp >= 0) {
            vp++;
        }

        for (char fp : fillPattern.toCharArray()) {
            switch (fp) {
                case '_':
                case '1':
                    if (fp == '1' && row == 0) {
                        if (vp > 0) {
                            vp++;
                        }
                        break;
                    }
                    coordParser.skipWhitespaces();
                    if (coordParser.eof()) {
                        return false;
                    }
                    final String digitText;
                    if (coordParser.ch() == '(') {
                        try {
                            final Formula f = Formula.compile(coordPattern, coordParser.pos() + 1, CLOSING_PAREN_SET);
                            digitText = f.getExpression();
                            coordParser.setPos(coordParser.pos() + digitText.length() + 2);
                        } catch (FormulaException fe) {
                            return false;
                        }
                    } else if (coordParser.chIsIn(SIGNIFICANT_CHARS)) {
                        digitText = coordParser.ch() + "";
                        coordParser.next();
                    } else {
                        return false;
                    }
                    if (vp >= 0) {
                        ((CharButton) grid.getChildAt(vp)).setText(digitText);
                        vp++;
                    }
                    break;
                default:
                    final boolean isWs = Character.isWhitespace(coordParser.ch());
                    coordParser.skipWhitespaces();
                    if (!isWs && coordParser.ch() != fp) {
                        return false;
                    }
                    if (coordParser.ch() == fp) {
                        coordParser.next();
                    }
                    if (vp >= 0) {
                        vp++;
                    }
            }
        }
        return coordParser.eof();
    }
returns true if latPatternn/lonPattern could be applied, false otherwise
main/src/main/java/cgeo/geocaching/ui/CalculatedCoordinateInputGuideView.java