Tests if the current browser is matching the configuration.<p>

@param currentBrowser the users browser String to test
@return true if the browser matches the configuration, otherwise false
173730
public boolean matchesBrowser(String currentBrowser) {

        if (currentBrowser == null) {
            return false;
        }
        for (int i = 0; i < getBrowserPattern().size(); i++) {
            boolean matches = getBrowserPattern().get(i).matcher(currentBrowser.trim()).matches();
            if (matches) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug(Messages.get().getBundle().key(Messages.LOG_BROWSER_MATCHES_CONFIG_1, currentBrowser));
                }
                return true;
            }
        }
        return false;
    }
378574
protected function checkBrowserNokia()
    {
        if (preg_match("/Nokia([^\/]+)\/([^ SP]+)/i", $this->_agent, $matches)) {
            $this->setVersion($matches[2]);
            if (stripos($this->_agent, 'Series60') !== false || strpos($this->_agent, 'S60') !== false) {
                $this->setBrowser(self::BROWSER_NOKIA_S60);
            } else {
                $this->setBrowser(self::BROWSER_NOKIA);
            }
            $this->setMobile(true);
            return true;
        }
        return false;
    }
1345037
public static function checkBrowserSeaMonkey()
    {
        if (stripos(self::$userAgentString, 'safari') === false) {
            if (preg_match("/SeaMonkey[\/ \(]([^ ;\)]+)/i", self::$userAgentString, $matches)) {
                if (isset($matches[1])) {
                    self::$browser->setVersion($matches[1]);
                }
                self::$browser->setName(Browser::SEAMONKEY);

                return true;
            } elseif (preg_match('/SeaMonkey$/i', self::$userAgentString, $matches)) {
                self::$browser->setVersion('');
                self::$browser->setName(Browser::SEAMONKEY);

                return true;
            }
        }

        return false;
    }
1281167
protected final void registerBrowser( AbstractQueueBrowser browser )
    {
    	if (browsersMap.put(browser.getId(),browser) != null)
    		throw new IllegalArgumentException("Browser "+browser.getId()+" already exists");
    }
306268
private boolean isRealBrowser() {
        Browser browser = capabilities.getBrowser();
        return browser.getName() != BrowserName.NONE && browser.getName() != BrowserName.HTMLUNIT;
    }
1342290
private boolean checkFilteredXSSF() {
		XSSFWorkbook currentXSSFWorkbook = (XSSFWorkbook) this.currentWorkbook;
     		POIXMLProperties props = currentXSSFWorkbook.getProperties();
		SimpleDateFormat format = new SimpleDateFormat(MSExcelParser.DATE_FORMAT); 
		// check for each defined property
		// check if we need to match all
		boolean matchAll=true;
		boolean matchFull=true;
		boolean matchOnce=false;
		if (this.hocr.getMetaDataFilter().get(MATCH_ALL)!=null) {
			if ("true".equalsIgnoreCase(this.hocr.getMetaDataFilter().get(MATCH_ALL))) {
				matchAll=true;
				LOG.info("matching all metadata properties");
			} else if ("false".equalsIgnoreCase(this.hocr.getMetaDataFilter().get(MATCH_ALL)))	{
				matchAll=false;
				LOG.info("matching at least one metadata property");
			} else {
				LOG.error("Metadata property matchAll not defined correctly. Assuming that at only least one attribute needs to match");
			}
		}
		// check core properties
		String corePropertyName;
		POIXMLProperties.CoreProperties coreProp=props.getCoreProperties();
		corePropertyName="category";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getCategory();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
					LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="contentstatus";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getContentStatus();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="contenttype";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getContentType();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="created";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				Date corePropStr=coreProp.getCreated();
				if ((corePropStr!=null) && (format.format(corePropStr).matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+format.format(corePropStr)+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
						LOG.debug(corePropertyName);
				}
		}
		corePropertyName="creator";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getCreator();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="description";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getDescription();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="identifier";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getIdentifier();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="keywords";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getKeywords();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="lastmodifiedbyuser";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getLastModifiedByUser();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="lastprinted";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				Date corePropStr=coreProp.getLastPrinted();
				if ((corePropStr!=null) && (format.format(corePropStr).matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+format.format(corePropStr)+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
						LOG.debug(corePropertyName);
				}
		}
		corePropertyName="modified";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				Date corePropStr=coreProp.getModified();
				if ((corePropStr!=null) && (format.format(corePropStr).matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
						LOG.debug(corePropertyName);
				}
		}
		corePropertyName="revision";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getRevision();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="subject";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getSubject();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		corePropertyName="title";
		if (this.hocr.getMetaDataFilter().get(corePropertyName)!=null) {
				String corePropStr=coreProp.getTitle();
				if ((corePropStr!=null) && (corePropStr.matches(this.hocr.getMetaDataFilter().get(corePropertyName)))) {
					matchOnce=true;
				 } else {
						matchFull=false;
						LOG.debug(NOT_MATCHING+corePropStr+":"+this.hocr.getMetaDataFilter().get(corePropertyName));
				}
		}
		// check for custom properties
		POIXMLProperties.CustomProperties custProp = props.getCustomProperties();
		for (Map.Entry<String,String> entry: this.hocr.getMetaDataFilter().entrySet()) {
			if (entry.getKey().startsWith("custom.")) {
				String strippedKey=entry.getKey().substring("custom.".length());
				if (strippedKey.length()>0) {
					String valueMatch=entry.getValue();
					if (valueMatch!=null) {
						
						if ((custProp.getProperty(strippedKey)!=null) && (custProp.getProperty(strippedKey).getName()!=null)&& (custProp.getProperty(strippedKey).getLpwstr().matches(valueMatch))) {
		matchOnce=true;
	} else {
		matchFull=false;
	}
					}
				}
			}
		}		
		
		if (!(matchAll)) {
			return  matchOnce;
		} else {
			return matchFull;
		}
	}
830791
public static function checkBrowserQQ(){
		if (stripos(self::$userAgentString, 'QQBrowser') !== false) {
			$aresult = explode('/', stristr(self::$userAgentString, 'QQBrowser') );
			if (isset($aresult[1])) {
				$aversion = explode(' ', $aresult[1]);
				self::$browser->setVersion($aversion[0]);
			}
			self::$browser->setName(Browser::QQ);
			return true;
		}

		return false;
	}
597893
public boolean matches(String uri) {
		if (uri == null) {
			return false;
		}
		Matcher matcher = this.matchPattern.matcher(uri);
		return matcher.matches();
	}
597784
boolean matchText(
            final boolean blockMatching,
            final int markupLevel, final int markupBlockIndex) {

        checkMarkupLevel(markupLevel);

        if (this.markupSelectorItem.anyLevel() || markupLevel == 0 || (this.prev != null && this.prev.matchedMarkupLevels[markupLevel - 1])) {
            // This text has not matched yet, but might match, so we should check

            this.matchesThisLevel = this.markupSelectorItem.matchesText(markupBlockIndex, this.markupBlockMatchingCounter);

            if (matchesPreviousOrCurrentLevel(markupLevel)) {
                // This filter was already matched by a previous level (through an "open" event), so just delegate to next.

                if (this.next != null) {
                    return this.next.matchText(blockMatching, markupLevel, markupBlockIndex);
                }
                return (blockMatching? true : this.matchesThisLevel);

            } else if (this.matchesThisLevel) {
                // This filter was not matched before. So the fact that it matches now means we need to consume it,
                // therefore not delegating.

                return (this.next == null);

            }

        } else if (matchesPreviousOrCurrentLevel(markupLevel)) {
            // This filter was already matched by a previous level (through an "open" event), so just delegate to next.

            if (this.next != null) {
                return this.next.matchText(blockMatching, markupLevel, markupBlockIndex);
            }
            return blockMatching;

        }

        return false;

    }
20202
function getAvailableBrowsers(config, browsers, cb) {
  browsers.forEach(function(b) {
    b.protocol = 'browser';
  });

  return Bluebird.filter(browsers, function(browser) {
    return isInstalled(browser, config).then(function(result) {
      if (!result) {
        return false;
      }

      browser.exe = result;
      return true;
    });
  }).asCallback(cb);
}
340942
public boolean isMatchingAny(final int level) {
        if (level >= this.levelCounter) {
            throw new IllegalArgumentException(
                    "Cannot return current selection: max level is " + this.levelCounter + " (specified: " + level + ")");
        }
        if (this.levels == null) {
            return false;
        }
        return this.levels[level].isSelectionActive();
    }
395020
protected function checkBrowserIcab()
    {
        if (stripos($this->_agent, 'icab') !== false) {
            $aversion = explode(' ', stristr(str_replace('/', ' ', $this->_agent), 'icab'));
            if (isset($aversion[1])) {
                $this->setVersion($aversion[1]);
                $this->setBrowser(self::BROWSER_ICAB);
                return true;
            }
        }
        return false;
    }
194468
public boolean matches(URL url) {
        boolean matches = false;
        if(wildcardMatches(protocol, url.getProtocol()) && wildcardMatches(host, url.getHost()) && wildcardMatches(getPath(), url.getPath())) {
            matches = true;
        }
        return matches;
    }
265451
public function isCurrent($inc_parent = false, $inc_args = false)
    {
        // strict match with arguments
        if ($inc_args) {
            return $this->app->url()->getURL() == $this->getURL();
        }

        // match current page or parent page without arguments
        return $this->_current || ($inc_parent && $this->_current_sub);
    }
668423
private static boolean openBrowserJava6(String url) throws Exception {
        final Class<?> desktopClass;
        try {
            desktopClass = Class.forName("java.awt.Desktop");
        } catch (ClassNotFoundException e) {
            return false;
        }
        Boolean supported = (Boolean) desktopClass.getMethod("isDesktopSupported", new Class[0]).invoke(null);
        if (supported) {
            Object desktop = desktopClass.getMethod("getDesktop", new Class[0]).invoke(null);
            desktopClass.getMethod("browse", new Class[]{URI.class}).invoke(desktop, new URI(url));
            return true;
        }
        return false;
    }
764117
private static boolean isBrowserDead() {
        try {
            if (((FramesTransparentWebDriver) getDriver()).getWrappedDriver() instanceof AppiumDriver) {
                getDriver().getPageSource();
            } else {
                getDriver().getCurrentUrl();
            }
            return false;
        } catch (Throwable t) {
            Report.jenkins("*****BROWSER IS DEAD ERROR***** ", t);
            return true;
        }
    }
1139287
protected function checkBrowserFirefox()
    {
        //Safari heavily matches with Firefox, ensure that Safari is filtered out...
        if (preg_match('/.*Firefox[ (\/]*([a-z0-9.-]*)/i', $this->_agent, $matches) &&
                !$this->containString($this->_agent, 'Safari')) {
            $this->setBrowser(self::BROWSER_FIREFOX);
            $this->setVersion($matches[1]);
            $this->setMobile(false);
            $this->setRobot(false);

            return true;
        }

        return false;
    }