# Path: stripstream/utils.py
# def flatten(iterable_of_iterables):
#     return (item for iterables in iterable_of_iterables for item in iterables)


from stripstream.utils import flatten


class Formula(object):

    def is_valid_condition(self):
        return isinstance(self, Condition) and all(f.is_valid_condition() for f in self.get_formulas())

    def is_valid_effect(self):
        return isinstance(self, Effect) and all(f.is_valid_effect() for f in self.get_formulas())

    def get_atoms(self): raise NotImplementedError()

    def get_literals(self): raise NotImplementedError()

    def get_formulas(self): raise NotImplementedError()

    def de_morgan(self, sign=True): raise NotImplementedError()

    def simplify(self): return self

    def get_objects(self):
        return set(flatten(atom.args for atom in self.get_atoms()))

    def get_parameters(self):

# Path: stripstream/utils.py
# def flatten(iterable_of_iterables):
#     return (item for iterables in iterable_of_iterables for item in iterables)


# Path: stripstream/pddl/logic/formulas.py
from stripstream.utils import flatten



class Formula(object):

    def is_valid_condition(self):
        return isinstance(self, Condition) and all(f.is_valid_condition() for f in self.get_formulas())

    def is_valid_effect(self):
        return isinstance(self, Effect) and all(f.is_valid_effect() for f in self.get_formulas())

    def get_atoms(self): raise NotImplementedError()

    def get_literals(self): raise NotImplementedError()

    def get_formulas(self): raise NotImplementedError()

    def de_morgan(self, sign=True): raise NotImplementedError()

    def simplify(self): return self

    def get_objects(self):
        return set(flatten(atom.args for atom in self.get_atoms()))

    def get_parameters(self):

        return set(flatten(atom.get_parameters() for atom in self.get_atoms()))