// Match compares the trie to the given data stream.
// Match returns true if data can be completely matched to the trie.
17139
func (node *TrieNode) Match(data []byte) *TrieNode {
	dataLen := len(data)
	suffixLen := len(node.suffix)
	if dataLen < suffixLen {
		return nil // ### return, cannot be fully matched ###
	}

	for i := 0; i < suffixLen; i++ {
		if data[i] != node.suffix[i] {
			return nil // ### return, no match ###
		}
	}

	if dataLen == suffixLen {
		if node.PathLen > 0 {
			return node // ### return, full match ###
		}
		return nil // ### return, invalid match ###
	}

	data = data[suffixLen:]
	numChildren := len(node.children)
	for i := 0; i < numChildren; i++ {
		matchedNode := node.children[i].Match(data)
		if matchedNode != nil {
			return matchedNode // ### return, match found ###
		}
	}

	return nil // ### return, no valid path ###
}
432557
func (c *Constraint) Match(v string) bool {
	if c.Excludes(v) {
		return false
	}
	if c.Includes(v) {
		return true
	}
	if len(c.Include) == 0 {
		return true
	}
	return false
}
1108980
func (src List) Match(f Filter) (List, error) {
	var result List
	for _, tools := range src {
		if f.match(tools) {
			result = append(result, tools)
		}
	}
	if len(result) == 0 {
		return nil, ErrNoMatches
	}
	return result, nil
}
565999
func (l *Lexer) match(matchTo string, skip int) bool {

	//u.Debugf("match(%q)  peek:%q ", matchTo, l.PeekWord())
	for _, matchRune := range matchTo {
		//u.Debugf("match rune? %v", string(matchRune))
		if skip > 0 {
			skip--
			continue
		}

		nr := l.Next()
		//u.Debugf("rune=%s n=%s   %v  %v", string(matchRune), string(nr), matchRune != nr, unicode.ToLower(nr) != matchRune)
		if matchRune != nr && unicode.ToLower(nr) != matchRune {
			//u.Debugf("setting done = false?, ie did not match")
			return false
		}
	}
	if l.IsEnd() {
		return true
	}
	// If we finished looking for the match word, and the next item is not
	// whitespace, it means we failed
	if !isWhiteSpace(l.Peek()) {
		return false
	}
	//u.Debugf("Found match():  %v", matchTo)
	return true
}
1098129
func (t *Trie) Match(addr [16]byte) (bool, error) {
	current := t.root
	next := t.root
	for i := 0; i < 127; i++ {
		maskPosition := i % 8
		currentByte := i / 8

		left := (addr[currentByte] & singleBitMask[maskPosition]) == 0

		if left {
			next = current.children[0]
		} else {
			next = current.children[1]
		}

		if next == nil {
			return false, nil
		}

		if next.match {
			return true, nil
		}

		current = next
	}

	return false, nil
}
25679
func Match(t1 Token, t2 Token) bool {
	var temp Token
	if t1.Type() > t2.Type() {
		temp = t1
		t1 = t2
		t2 = temp
	}

	switch t1.Type() {
	case TTCharacter:
		ch := t1.(*character)

		switch t2.Type() {
		case TTCharacter:
			return matchCharacters(ch, t2.(*character))
		case TTDot:
			return matchCharacterDot(ch, t2.(*dot))
		case TTSet:
			return matchCharacterSet(ch, t2.(*set))
		default:
			panic(errBadImplementation)
		}

	case TTDot:
		d := t1.(*dot)

		switch t2.Type() {
		case TTDot:
			return matchDots(d, t2.(*dot))
		case TTSet:
			return matchDotSet(d, t2.(*set))
		default:
			panic(errBadImplementation)
		}

	case TTSet:
		switch t2.Type() {
		case TTSet:
			return matchSets(t1.(*set), t2.(*set))
		default:
			panic(errBadImplementation)
		}

	default:
		panic(errBadImplementation)

	}
}
224182
func matches(s, pattern string) bool {
	return regexp.MustCompile(pattern).MatchString(s)
}
761411
func (self *Constraint) Match(version string) bool {
	return Compare(version, self.version, self.operator)
}
975878
func (a *any) match(path []string, tokens []*Token) bool {
	// if we have no more tokens, then we have matched this path
	// if there are also no more path elements, otherwise there's no match
	if len(tokens) == 0 {
		return len(path) == 0
	}

	// what token are we trying to match?
	_token := tokens[0]
	switch _token.Type {
	case ANY:
		if len(path) == 0 {
			return a.match(path, tokens[1:])
		} else {
			return a.match(path, tokens[1:]) || a.match(path[1:], tokens)
		}

	default:
		// if we have a non-ANY token, then we must have a non-empty path
		if len(path) != 0 {
			// if the current path element matches this token,
			// we match if the remainder of the path matches the
			// remaining tokens
			if fnmatch.Match(_token.Token(), path[0], fnmatch.FNM_PATHNAME) {
				return a.match(path[1:], tokens[1:])
			}
		}
	}

	// if we are here, then we have no match
	return false
}
1206604
func (g *GlobPath) Match() []string {
	if !g.hasMeta {
		return []string{g.path}
	}
	if !g.HasSuperMeta {
		files, _ := filepath.Glob(g.path)
		return files
	}
	roots, err := filepath.Glob(g.rootGlob)
	if err != nil {
		return []string{}
	}
	out := []string{}
	walkfn := func(path string, _ *godirwalk.Dirent) error {
		if g.g.Match(path) {
			out = append(out, path)
		}
		return nil

	}
	for _, root := range roots {
		fileinfo, err := os.Stat(root)
		if err != nil {
			continue
		}
		if !fileinfo.IsDir() {
			if g.MatchString(root) {
				out = append(out, root)
			}
			continue
		}
		godirwalk.Walk(root, &godirwalk.Options{
			Callback: walkfn,
			Unsorted: true,
		})
	}
	return out
}
614064
func (l *LogLevelType) Matches(v LogLevelType) bool {
	c := l.Value()
	return c&v == v
}
472497
func (c *Called) Match(actual interface{}) (success bool, err error) {
	val := reflect.ValueOf(actual)
	if val.Kind() != reflect.Struct && val.Kind() != reflect.Chan {
		return false, errors.New("BeCalled requires a channel or struct full of channel fields")
	}
	if len(c.calls) == 0 {
		c.calls = append(c.calls, []interface{}{})
	}
	success = true
	for _, call := range c.calls {
		args := args(val)
		actualCall := make([]interface{}, 0, len(args))
		for i, arg := range args {
			recvd, ok := receiveArg(arg)
			if !ok {
				return false, nil
			}
			actualCall = append(actualCall, recvd)
			if i >= len(call) {
				continue
			}
			switch src := call[i].(type) {
			case types.GomegaMatcher:
				matched, err := src.Match(recvd)
				if err != nil {
					return false, err
				}
				if !matched {
					success = false
					c.matchFailures = append(c.matchFailures, fmt.Sprintf("%s: %s", arg.name, src.FailureMessage(recvd)))
				}
			default:
				if !reflect.DeepEqual(call[i], recvd) {
					success = false
					c.matchFailures = append(c.matchFailures, fmt.Sprintf("%s: %v (expected) != %v (actual)", arg.name, call[i], recvd))
				}
			}
		}
		if !success {
			// This was actually an unmatched call, so reset matched
			c.calls = append(c.calls, c.matched...)
			c.matched = nil
			break
		}
		c.matched = append([][]interface{}{call}, c.matched...)
		c.calls = c.calls[1:]
	}
	return success, nil
}
326466
func (r *ResponseMatcher) match(res *http.Response) (bool, int) {
	if r.method != "" {
		if r.method != res.Request.Method {
			return false, 0
		}
	}
	if r.contentType != "" {
		if r.contentType != getContentType(res.Header.Get("Content-Type")) {
			return false, 0
		}
	}
	if r.minStatus != 0 || r.maxStatus != 0 {
		if res.StatusCode < r.minStatus || res.StatusCode > r.maxStatus {
			return false, 0
		}
	}
	if r.scheme != "" {
		if res.Request.URL.Scheme != r.scheme {
			return false, 0
		}
	}
	if r.host != "" {
		if res.Request.URL.Host != r.host {
			return false, 0
		}
	}
	if r.predicate != nil {
		if !r.predicate(res) {
			return false, 0
		}
	}
	if r.path != "" {
		if strings.HasPrefix(res.Request.URL.Path, r.path) {
			return true, len(r.path)
		}
		return false, 0
	}
	return true, 0
}
915726
func (p SupportsAllVerbs) Match(groupVersion string, r *metav1.APIResource) bool {
	return sets.NewString([]string(r.Verbs)...).HasAll(p.Verbs...)
}
726807
func (r *Matcher) Matches() bool {
	return r.scope() &&
		r.operation() &&
		r.group() &&
		r.version() &&
		r.resource()
}
94916
func (g *Grok) Match(pattern, text string) (bool, error) {
	gr, err := g.compile(pattern)
	if err != nil {
		return false, err
	}

	if ok := gr.regexp.MatchString(text); !ok {
		return false, nil
	}

	return true, nil
}
643246
func (p Principal) Match(principal string) bool {
	for _, pattern := range p.AWS.ToSlice() {
		if wildcard.MatchSimple(pattern, principal) {
			return true
		}
	}

	return false
}