# Path: emma/query/spec.py
# class CompositeQuery(object):
#     """Base class for the specification"""
#     def conjoin(self, other):
#         """ConjunctionQuery factory"""
#         return ConjunctionQuery(self, other)
#     def __and__(self, other):
#         return self.conjoin(other)
# 
#     def disjoin(self, other):
#         """DisjunctionQuery factory"""
#         return DisjunctionQuery(self, other)
#     def __or__(self, other):
#         return self.disjoin(other)
# 
#     def negate(self):
#         """NegationQuery factory"""
#         return NegationQuery(self)
#     def __invert__(self):
#         return self.negate()


from emma.query.spec import CompositeQuery
class DateMatchQuery(CompositeQuery):
    """Match a date argument. All parts of the date must match."""
    def __init__(self, field, date):
        self.field = field
        self.date = date

    def to_tuple(self):
        return self.field, "datematch", self.date


class ContainsQuery(CompositeQuery):
    """Match a string against a shell-glob-style expression"""
    def __init__(self, field, value):
        self.field = field
        self.value = value

    def to_tuple(self):
        return self.field, "contains", self.value


class AnyQuery(CompositeQuery):
    """Match a given value against an array field"""
    def __init__(self, field, value):
        self.field = field
        self.value = value

    def to_tuple(self):
        return self.field, "any", self.value



# Path: emma/query/spec.py
# class CompositeQuery(object):
#     """Base class for the specification"""
#     def conjoin(self, other):
#         """ConjunctionQuery factory"""
#         return ConjunctionQuery(self, other)
#     def __and__(self, other):
#         return self.conjoin(other)
# 
#     def disjoin(self, other):
#         """DisjunctionQuery factory"""
#         return DisjunctionQuery(self, other)
#     def __or__(self, other):
#         return self.disjoin(other)
# 
#     def negate(self):
#         """NegationQuery factory"""
#         return NegationQuery(self)
#     def __invert__(self):
#         return self.negate()


# Path: emma/query/operator.py
from emma.query.spec import CompositeQuery

class DateMatchQuery(CompositeQuery):
    """Match a date argument. All parts of the date must match."""
    def __init__(self, field, date):
        self.field = field
        self.date = date

    def to_tuple(self):
        return self.field, "datematch", self.date


class ContainsQuery(CompositeQuery):
    """Match a string against a shell-glob-style expression"""
    def __init__(self, field, value):
        self.field = field
        self.value = value

    def to_tuple(self):
        return self.field, "contains", self.value


class AnyQuery(CompositeQuery):
    """Match a given value against an array field"""
    def __init__(self, field, value):
        self.field = field
        self.value = value

    def to_tuple(self):
        return self.field, "any", self.value



class IsInQuery(CompositeQuery):