package filter

import (
	
	
)

// Filter represents a compiled filter, which can be used to match text.
type Filter interface {
	Match(s string) bool
}

type andFilter struct {
	queries []Filter
}

func ( andFilter) ( string) bool {
	for ,  := range .queries {
		if !.Match() {
			return false
		}
	}
	return true
}

type orFilter struct {
	queries []Filter
}

func ( orFilter) ( string) bool {
	for ,  := range .queries {
		if .Match() {
			return true
		}
	}
	return false
}

type substringFilter struct {
	pattern    string
	ignoreCase bool
}

func ( substringFilter) ( string) bool {
	if .ignoreCase {
		 = strings.ToLower()
	}
	return strings.Contains(, .pattern)
}

type regexpFilter struct {
	pattern *regexp.Regexp
}

func ( regexpFilter) ( string) bool {
	return .pattern.MatchString()
}