# Path: pyknow/conditionalelement.py
# class ConditionalElement(tuple):
#     """Base Conditional Element"""
# 
#     def __new__(cls, *args):
#         return super(ConditionalElement, cls).__new__(cls, args)
# 
#     def __repr__(self):  # pragma: no cover
#         return "%s%s" % (self.__class__.__name__, super().__repr__())
# 
# Path: pyknow/pattern.py
# class Bindable:
#     def __rlshift__(self, other):
#         if not isinstance(other, str):
#             raise TypeError("%s can only be binded to a string" % self)
#         elif self.__bind__ is not None:
#             raise RuntimeError("%s can only be binded once" % repr(self))
#         else:
#             self.__bind__ = other
#             return self
# 
#     def __hash__(self):
#         return hash((self.__bind__, ) + tuple(self))
# 
#     def __eq__(self, other):
#         return (self.__class__ == other.__class__
#                 and self.__bind__ == other.__bind__
#                 and super().__eq__(other))


from collections.abc import Callable
from pyknow.conditionalelement import ConditionalElement
from pyknow.pattern import Bindable


__all__ = ['L', 'W', 'P']


class FieldConstraint(ConditionalElement):
    def __and__(self, other):
        if isinstance(self, ANDFC) and isinstance(other, ANDFC):
            return ANDFC(*[x for x in chain(self, other)])
        elif isinstance(self, ANDFC):
            return ANDFC(*[x for x in self]+[other])
        elif isinstance(other, ANDFC):

# Path: pyknow/conditionalelement.py
# class ConditionalElement(tuple):
#     """Base Conditional Element"""
# 
#     def __new__(cls, *args):
#         return super(ConditionalElement, cls).__new__(cls, args)
# 
#     def __repr__(self):  # pragma: no cover
#         return "%s%s" % (self.__class__.__name__, super().__repr__())
# 
# Path: pyknow/pattern.py
# class Bindable:
#     def __rlshift__(self, other):
#         if not isinstance(other, str):
#             raise TypeError("%s can only be binded to a string" % self)
#         elif self.__bind__ is not None:
#             raise RuntimeError("%s can only be binded once" % repr(self))
#         else:
#             self.__bind__ = other
#             return self
# 
#     def __hash__(self):
#         return hash((self.__bind__, ) + tuple(self))
# 
#     def __eq__(self, other):
#         return (self.__class__ == other.__class__
#                 and self.__bind__ == other.__bind__
#                 and super().__eq__(other))


# Path: pyknow/fieldconstraint.py
from collections.abc import Callable
from pyknow.conditionalelement import ConditionalElement
from pyknow.pattern import Bindable



__all__ = ['L', 'W', 'P']


class FieldConstraint(ConditionalElement):
    def __and__(self, other):
        if isinstance(self, ANDFC) and isinstance(other, ANDFC):
            return ANDFC(*[x for x in chain(self, other)])
        elif isinstance(self, ANDFC):
            return ANDFC(*[x for x in self]+[other])
        elif isinstance(other, ANDFC):

            return ANDFC(*[self]+[x for x in other])