int getState ( ) { if ( tc . isEntryEnabled ( ) ) tc . entry ( this , cclass , "getState" ) ; int state ; if ( ! prefixDone ) { // Somewhere in the prefix or at beginning and there is no prefix Pattern . Clause prefix = pattern . getPrefix ( ) ; if ( prefix == null || next >= prefix . items . length ) { // There is no prefix or we're at the end of it Pattern . Clause suffix = pattern . getSuffix ( ) ; // Answer depends on the suffix state = suffix == null ? FINAL_MANY : suffix == prefix ? FINAL_EXACT : SWITCH_TO_SUFFIX ; } else // We're somewhere in the body of the prefix state = prefix . items [ next ] == Pattern . matchOne ? SKIP_ONE_PREFIX : PREFIX_CHARS ; } else { // We're in the suffix Pattern . Clause suffix = pattern . getSuffix ( ) ; state = ( next < 0 ) ? FINAL_MANY : suffix . items [ next ] == Pattern . matchOne ? SKIP_ONE_SUFFIX : SUFFIX_CHARS ; } if ( tc . isEntryEnabled ( ) ) tc . exit ( this , cclass , "getState" , new Integer ( state ) ) ; return state ; }
Get the state of this Pattern ( which item is next to process