public boolean isDataDivision(final String line,
            final CleaningContext context) {
        if (context.isDataDivision()) {
            Matcher matcher = IDENTIFICATION_DIVISION.matcher(line);
            if (matcher.find()) {
                context.setDataDivision(false);
                emitErrorMessage("Found identification division in ["
                        + line.trim() + "]. Lines ignored till data division.");
            }
            matcher = PROCEDURE_DIVISION.matcher(line);
            if (matcher.find()) {
                context.setDataDivision(false);
                emitErrorMessage("Found procedure division in [" + line.trim()
                        + "]. Remaining lines ignored.");
            }
        } else {
            Matcher matcher = DATA_DIVISION.matcher(line);
            if (matcher.find()) {
                context.setDataDivision(true);
                emitErrorMessage("Found data division in [" + line.trim()
                        + "]. Started looking for data items.");
            }
        }
        return context.isDataDivision();
    }
public boolean isDataDivision ( final String line , final CleaningContext context ) { if ( context . isDataDivision ( ) ) { Matcher matcher = IDENTIFICATION_DIVISION . matcher ( line ) ; if ( matcher . find ( ) ) { context . setDataDivision ( false ) ; emitErrorMessage ( "Found identification division in [" + line . trim ( ) + "]. Lines ignored till data division." ) ; } matcher = PROCEDURE_DIVISION . matcher ( line ) ; if ( matcher . find ( ) ) { context . setDataDivision ( false ) ; emitErrorMessage ( "Found procedure division in [" + line . trim ( ) + "]. Remaining lines ignored." ) ; } } else { Matcher matcher = DATA_DIVISION . matcher ( line ) ; if ( matcher . find ( ) ) { context . setDataDivision ( true ) ; emitErrorMessage ( "Found data division in [" + line . trim ( ) + "]. Started looking for data items." ) ; } } return context . isDataDivision ( ) ; }
Rough triage of statements which are not strictly part of the data
division. Detects end of DATA DIVISION by looking for PROCEDURE DIVISION.
<p/>
Since we are not guaranteed to have identification division, we initially
consider we are in the data division. If we find an identification
division, then we stop processing till we find a data division.

@param line the line to set data description status from
@param context the data description detection context
@return true if we are within the data division