private boolean keyMatch ( String key , LazyNode token ) { if ( token . type == LazyNode . EFIELD ) { String field = token . getStringValue ( ) ; return field . equals ( key ) ; } else { // Quickly check the length first int length = key . length ( ) ; if ( token . endIndex - token . startIndex != length ) { return false ; } // Now go through the field character for character to compare if ( token . dirty ) { for ( int i = 0 ; i < length ; i ++ ) { char c = key . charAt ( i ) ; if ( c != token . dirtyBuf . charAt ( token . startIndex + i ) ) { return false ; } } } else { for ( int i = 0 ; i < length ; i ++ ) { char c = key . charAt ( i ) ; if ( c != token . cbuf [ token . startIndex + i ] ) { return false ; } } } return true ; } }
Utility method to evaluate wether a given string matches the value of a field .