private boolean processBrowserRegex ( String useragent , UserAgentInfo retObj ) { try { lock . lock ( ) ; boolean osFound = false ; for ( Map . Entry < String , Long > entry : browserRegMap . entrySet ( ) ) { Pattern pattern = Pattern . compile ( entry . getKey ( ) , Pattern . CASE_INSENSITIVE | Pattern . DOTALL ) ; Matcher matcher = pattern . matcher ( useragent ) ; if ( matcher . find ( ) ) { // if a browse was found... Long idBrowser = entry . getValue ( ) ; // ... but the browser type from browser type map into the typ copyType ( retObj , idBrowser ) ; // get all the browser data from the browser map BrowserEntry be = browserMap . get ( idBrowser ) ; if ( be != null ) { // first try to get the browser version from the first subgroup of the regex String browserVersionInfo = null ; if ( matcher . groupCount ( ) > 0 ) { browserVersionInfo = matcher . group ( 1 ) ; } // copy the browser data into the result be . copyTo ( retObj , browserVersionInfo ) ; } // check if this browser has exactly one OS mapped Long idOs = browserOsMap . get ( idBrowser ) ; if ( idOs != null ) { osFound = true ; OsEntry os = osMap . get ( idOs ) ; if ( os != null ) { os . copyTo ( retObj ) ; } } break ; } } return osFound ; } finally { lock . unlock ( ) ; } }
Searchs in the browser regex table . if found a match copies the browser data and if possible os data