# Path: stripstream/pddl/logic/predicates.py
# class Predicate(Head):
#     pass
#     """
#   Predicate P which extends :class:`.NamedHead`.
#   """
# 
# Path: stripstream/pddl/objects.py
# class Type(object):
# 
#     def __init__(self, name, parent=None):
#         """
#         PDDL type.
# 
#         :param name: the string name of the type
#         :param parent: the parent :class:`.Type`
#         """
#         self.name = name.lower()
#         self.parent = parent
#         self._hash = None
# 
#     def __eq__(self, other):
#         return type(self) == type(other) and self.name == other.name
# 
#     def __ne__(self, other):
#         return not(self == other)
# 
#     def __hash__(self):
#         if self._hash is None:
#             self._hash = hash((self.__class__, self.name))
#         return self._hash
# 
#     def __repr__(self):
#         return self.name
# 
#     def pddl(self):
#         return self.name
# 
# class Constant(Object):
#     pass
#     """
#   PDDL constant which extends :class:`.Object`.
#   """
# 
# class Parameter(Object):
# 
#     def __init__(self, name, type):
#         """
#         PDDL parameter which extends :class:`.Object`.
# 
#         :param name: the string name of the parameter
#         :param type: the :class:`.Type` of the parameter
#         """
#         super(Parameter, self).__init__(PARAM_PREFIX + name, type)
# 
#     @property
#     def original(self):
#         return self.name[len(PARAM_PREFIX):]


from itertools import product
from stripstream.pddl.logic.predicates import Predicate
from stripstream.pddl.objects import Type, Constant, Parameter as SSParameter


def split_var(var):
    return var_name(var), var_args(var)


class Variable(object):

    def __init__(self, name, dtype, args=[]):
        self.name = name
        self.dtype = dtype
        self.args = args
        assert all(arg.domain is not None for arg in args)
        self.predicate = Predicate('%s_at' % name, args + [dtype])

    def __repr__(self):
        if not self.args:
            return self.name
        return '%s(%s)' % (self.name, ','.join(map(repr, self.args)))

Var = Variable


class VariableSet(object):

    def __init__(self, name):
        self.name = name

    def __getitem__(self, var):
        if not isinstance(var, tuple):

# Path: stripstream/pddl/logic/predicates.py
# class Predicate(Head):
#     pass
#     """
#   Predicate P which extends :class:`.NamedHead`.
#   """
# 
# Path: stripstream/pddl/objects.py
# class Type(object):
# 
#     def __init__(self, name, parent=None):
#         """
#         PDDL type.
# 
#         :param name: the string name of the type
#         :param parent: the parent :class:`.Type`
#         """
#         self.name = name.lower()
#         self.parent = parent
#         self._hash = None
# 
#     def __eq__(self, other):
#         return type(self) == type(other) and self.name == other.name
# 
#     def __ne__(self, other):
#         return not(self == other)
# 
#     def __hash__(self):
#         if self._hash is None:
#             self._hash = hash((self.__class__, self.name))
#         return self._hash
# 
#     def __repr__(self):
#         return self.name
# 
#     def pddl(self):
#         return self.name
# 
# class Constant(Object):
#     pass
#     """
#   PDDL constant which extends :class:`.Object`.
#   """
# 
# class Parameter(Object):
# 
#     def __init__(self, name, type):
#         """
#         PDDL parameter which extends :class:`.Object`.
# 
#         :param name: the string name of the parameter
#         :param type: the :class:`.Type` of the parameter
#         """
#         super(Parameter, self).__init__(PARAM_PREFIX + name, type)
# 
#     @property
#     def original(self):
#         return self.name[len(PARAM_PREFIX):]


# Path: stripstream/fts/variable.py
from itertools import product
from stripstream.pddl.logic.predicates import Predicate
from stripstream.pddl.objects import Type, Constant, Parameter as SSParameter



def split_var(var):
    return var_name(var), var_args(var)


class Variable(object):

    def __init__(self, name, dtype, args=[]):
        self.name = name
        self.dtype = dtype
        self.args = args
        assert all(arg.domain is not None for arg in args)
        self.predicate = Predicate('%s_at' % name, args + [dtype])

    def __repr__(self):
        if not self.args:
            return self.name
        return '%s(%s)' % (self.name, ','.join(map(repr, self.args)))

Var = Variable


class VariableSet(object):

    def __init__(self, name):
        self.name = name

    def __getitem__(self, var):
        if not isinstance(var, tuple):

            var = (var,)