@Override
    public boolean matches(int lineNumber, String line) {
        if (lineNumber == 4
            && line.length() > 7
            && (!line.contains("2000")) && // MDL Mol V2000 format
            (!line.contains("3000"))) // MDL Mol V3000 format
        {
            // possibly a MDL mol file
            try {
                String atomCountString = line.substring(0, 3).trim();
                String bondCountString = line.substring(3, 6).trim();
                Integer.valueOf(atomCountString);
                Integer.valueOf(bondCountString);
                String remainder = line.substring(6).trim();
                for (int i = 0; i < remainder.length(); ++i) {
                    char c = remainder.charAt(i);
                    if (!(Character.isDigit(c) || Character.isWhitespace(c))) {
                        return false;
                    }
                }
            } catch (NumberFormatException nfe) {
                // Integers not found on fourth line; therefore not a MDL file
                return false;
            }
            return true;
        }
        return false;
    }
@ Override public boolean matches ( int lineNumber , String line ) { if ( lineNumber == 4 && line . length ( ) > 7 && ( ! line . contains ( "2000" ) ) && ( ! line . contains ( "3000" ) ) ) { try { String atomCountString = line . substring ( 0 , 3 ) . trim ( ) ; String bondCountString = line . substring ( 3 , 6 ) . trim ( ) ; Integer . valueOf ( atomCountString ) ; Integer . valueOf ( bondCountString ) ; String remainder = line . substring ( 6 ) . trim ( ) ; for ( int i = 0 ; i < remainder . length ( ) ; ++ i ) { char c = remainder . charAt ( i ) ; if ( ! ( Character . isDigit ( c ) || Character . isWhitespace ( c ) ) ) { return false ; } } } catch ( NumberFormatException nfe ) { return false ; } return true ; } return false ; }
{@inheritDoc}