private static void examineAsBrowser ( final UserAgent . Builder builder , final Data data ) { Matcher matcher ; VersionNumber version = VersionNumber . UNKNOWN ; for ( final Entry < BrowserPattern , Browser > entry : data . getPatternToBrowserMap ( ) . entrySet ( ) ) { matcher = entry . getKey ( ) . getPattern ( ) . matcher ( builder . getUserAgentString ( ) ) ; if ( matcher . find ( ) ) { entry . getValue ( ) . copyTo ( builder ) ; // try to get the browser version from the first subgroup if ( matcher . groupCount ( ) > ZERO_MATCHING_GROUPS ) { version = VersionNumber . parseVersion ( matcher . group ( 1 ) != null ? matcher . group ( 1 ) : "" ) ; } builder . setVersionNumber ( version ) ; break ; } } }
Examines the user agent string whether it is a browser .