protected int resolveFields ( int [ ] [ ] [ ] precedenceTable ) { int bestField = - 1 ; int tempBestField ; for ( int g = 0 ; g < precedenceTable . length && bestField < 0 ; ++ g ) { int [ ] [ ] group = precedenceTable [ g ] ; int bestStamp = UNSET ; linesInGroup : for ( int l = 0 ; l < group . length ; ++ l ) { int [ ] line = group [ l ] ; int lineStamp = UNSET ; // Skip over first entry if it is negative for ( int i = ( line [ 0 ] >= RESOLVE_REMAP ) ? 1 : 0 ; i < line . length ; ++ i ) { int s = stamp [ line [ i ] ] ; // If any field is unset then don't use this line if ( s == UNSET ) { continue linesInGroup ; } else { lineStamp = Math . max ( lineStamp , s ) ; } } // Record new maximum stamp & field no. if ( lineStamp > bestStamp ) { tempBestField = line [ 0 ] ; // First field refers to entire line if ( tempBestField >= RESOLVE_REMAP ) { tempBestField &= ( RESOLVE_REMAP - 1 ) ; // This check is needed to resolve some issues with UCAL_YEAR precedence mapping if ( tempBestField != DATE || ( stamp [ WEEK_OF_MONTH ] < stamp [ tempBestField ] ) ) { bestField = tempBestField ; } } else { bestField = tempBestField ; } if ( bestField == tempBestField ) { bestStamp = lineStamp ; } } } } return ( bestField >= RESOLVE_REMAP ) ? ( bestField & ( RESOLVE_REMAP - 1 ) ) : bestField ; }
Given a precedence table return the newest field combination in the table or - 1 if none is found .