初始化：
构造抽取规则查找结构

@param urlPatterns url模式列表
558299
private synchronized void init(List<UrlPattern> urlPatterns) {
        LOGGER.info("开始初始化URL抽取规则");
        //构造抽取规则查找结构
        Map<String, List<UrlPattern>> newUrlPatterns = toMap(urlPatterns);
        if (!newUrlPatterns.isEmpty()) {
            Map<String, List<UrlPattern>> oldUrlPatterns = urlPatternMap;
            urlPatternMap = newUrlPatterns;
            //清空之前的抽取规则查找结构（如果有）
            if (oldUrlPatterns != null) {
                for (List<UrlPattern> list : oldUrlPatterns.values()) {
                    list.clear();
                }
                oldUrlPatterns.clear();
            }
        }
        LOGGER.info("完成初始化URL抽取规则");
    }
599263
protected boolean excluded(String url) {
        for (final Pattern urlPattern : this.excludedUrls) {
            final Matcher matcher = urlPattern.matcher(url);
            if (matcher.matches()) {
                if (this.logger.isDebugEnabled()) {
                    this.logger.debug("Exclude pattern " + urlPattern.pattern() + " matches " + url);
                }
                return true;
            }
        }
        
        return false;
    }
1103557
public void urlSeeds(List<String> value) {
        string_vector v = new string_vector();

        for (String s : value) {
            v.push_back(s);
        }

        p.set_url_seeds(v);
    }
1103150
public static boolean containsURL(final URL[] urls, final URL url) {
        checkNotNull("urls", urls);
        checkNotNull("url", url);
        for (int i = 0; i < urls.length; i++) {
            final URL element = urls[i];
            final String elementStr = element.toExternalForm();
            final String urlStr = url.toExternalForm();
            if (elementStr.equals(urlStr)) {
                return true;
            }
        }
        return false;
    }
816341
public function checkUrls($urls)
    {
        $urls = $this->cleanParameterUrls($urls);

        foreach ($urls as $url) {
            if (!UrlHelper::isLookLikeUrl($url)) {
                throw new Exception(sprintf(Piwik::translate('SitesManager_ExceptionInvalidUrl'), $url));
            }
        }
    }
200749
public void setSearchLocations(Collection<String> searchLocations) {
        patchMatchingResolver = new PathMatchingResourcePatternResolver(getDefaultResourceLoader());
        for (String searchLocation : searchLocations) {
            initializeForSearchLocation(searchLocation);
        }
    }
527733
def extract_views_from_urlpatterns(self, urlpatterns, base='', namespace=None):
        
        views = []
        for p in urlpatterns:
            if isinstance(p, (URLPattern, RegexURLPattern)):
                try:
                    if not p.name:
                        name = p.name
                    elif namespace:
                        name = '{0}:{1}'.format(namespace, p.name)
                    else:
                        name = p.name
                    pattern = describe_pattern(p)
                    views.append((p.callback, base + pattern, name))
                except ViewDoesNotExist:
                    continue
            elif isinstance(p, (URLResolver, RegexURLResolver)):
                try:
                    patterns = p.url_patterns
                except ImportError:
                    continue
                if namespace and p.namespace:
                    _namespace = '{0}:{1}'.format(namespace, p.namespace)
                else:
                    _namespace = (p.namespace or namespace)
                pattern = describe_pattern(p)
                if isinstance(p, LocaleRegexURLResolver):
                    for language in self.LANGUAGES:
                        with translation.override(language[0]):
                            views.extend(self.extract_views_from_urlpatterns(patterns, base + pattern, namespace=_namespace))
                else:
                    views.extend(self.extract_views_from_urlpatterns(patterns, base + pattern, namespace=_namespace))
            elif hasattr(p, '_get_callback'):
                try:
                    views.append((p._get_callback(), base + describe_pattern(p), p.name))
                except ViewDoesNotExist:
                    continue
            elif hasattr(p, 'url_patterns') or hasattr(p, '_get_url_patterns'):
                try:
                    patterns = p.url_patterns
                except ImportError:
                    continue
                views.extend(self.extract_views_from_urlpatterns(patterns, base + describe_pattern(p), namespace=namespace))
            else:
                raise TypeError("%s does not appear to be a urlpattern object" % p)
        return views
875699
public static boolean isPathNameMatch(String uri, String urlPattern) {
        if (urlPattern.startsWith("/") && urlPattern.endsWith("/*")) {
            String s = urlPattern.substring(0, urlPattern.length() - 1);
            /**
             * First case,urlPattern
             * /a/b/c/ matches /a/b/c/*
             **/
            if (s.equalsIgnoreCase(uri)) {
                return true;
            }
            /**
             * Second case
             * /a/b/c matches /a/b/c/*
             **/
            if (uri.equalsIgnoreCase(s.substring(0, s.length() - 1))) {
                return true;
            }

            /**
             * Third case
             * /a/b/c/d/e matches /a/b/c/*
             **/
            if (uri.startsWith(s)) {
                return true;
            }
        }

        return false;
    }
355395
@Override
	public void setUrls(int type, List<String> urls) throws DatabaseException {
		this.deleteAllUrlsForType(type);
		for (String url : urls) {
			this.insert(type, url);
		}
	}
1029327
private Map<String, List<UrlPattern>> toMap(List<UrlPattern> urlPatterns) {
        Map<String, List<UrlPattern>> map = new ConcurrentHashMap<>();
        for (UrlPattern urlPattern : urlPatterns) {
            try {
                URL url = new URL(urlPattern.getUrlPattern());
                String key = urlPrefix(url);
                List<UrlPattern> value = map.get(key);
                if (value == null) {
                    value = new ArrayList<>();
                    map.put(key, value);
                }
                value.add(urlPattern);
            } catch (Exception e) {
                LOGGER.error("URL规则初始化失败：" + urlPattern.getUrlPattern(), e);
            }
        }
        return map;
    }
886946
private static URL[] mergeClassPath(URL... urls) {
    	final String path = System.getProperty("java.class.path"); //$NON-NLS-1$
    	final String separator = System.getProperty("path.separator"); //$NON-NLS-1$
    	final String[] parts = path.split(Pattern.quote(separator));
    	final URL[] u = new URL[parts.length + urls.length];
    	for (int i = 0; i < parts.length; ++i) {
    		try {
				u[i] = new File(parts[i]).toURI().toURL();
			} catch (MalformedURLException exception) {
				// ignore exception
			}
    	}
    	System.arraycopy(urls, 0, u, parts.length, urls.length);
    	return u;
    }
840260
public Pattern updatePattern(final Collection<String> prefixes) {
        final String XML_PREFIX = prefixes.stream()
                .map(s -> Pattern.quote(s + "/"))
                .collect(Collectors.joining("|"));

        return XML_PATH_PATTERN = Pattern.compile("^/?(?:" + XML_PREFIX + ")?(?:" + IDX_PREFIX + ")?(?<fieldPath>[^/]+(?:/[^/]+)*)$");
    }
1290584
private synchronized void init(String serverUrl) {
        LOGGER.info("开始下载URL抽取规则");
        LOGGER.info("serverUrl: " + serverUrl);
        //从配置管理web服务器获取完整的抽取规则
        String json = downJson(serverUrl);
        LOGGER.info("完成下载URL抽取规则");
        //抽取规则
        LOGGER.info("开始解析URL抽取规则");
        List<UrlPattern> urlPatterns = parseJson(json);
        LOGGER.info("完成解析URL抽取规则");
        init(urlPatterns);
    }
904711
public ConfigurationBuilder setUrls(@Nonnull final Collection<URL> urls) {
		this.urls = Sets.newHashSet(urls);
        return this;
	}
530895
public static boolean stringInPatterns(String s, List<Pattern> patterns) {
    for (Pattern pattern : patterns) {
      if (pattern.matcher(s).matches()) {
        return true;
      }
    }
    return false;
  }
419547
public static String[] normalizePatterns(final String[] urlPatterns) {
		String[] normalized = null;
		if (urlPatterns != null) {
			normalized = new String[urlPatterns.length];
			for (int i = 0; i < urlPatterns.length; i++) {
				normalized[i] = normalizePattern(urlPatterns[i]);
			}
		}
		return normalized;
	}
1165666
public void setTrackingUrls(com.google.api.ads.admanager.axis.v201902.ConversionEvent_TrackingUrlsMapEntry[] trackingUrls) {
        this.trackingUrls = trackingUrls;
    }