# Path: ndlib/models/compartments/Compartment.py
# class Compartiment(object):
#     """
#     """
# 
#     def __init__(self, *args, **kwargs):
#         self.composed = None
#         if 'composed' in args[0]:
#             if isinstance(args[0]['composed'], Compartiment):
#                 self.composed = args[0]['composed']
# 
#     def execute(self, *args, **kwargs):
#         pass
# 
#     def compose(self, *args, **kwargs):
#         if self.composed is not None:
#             return self.composed.execute(*args, **kwargs)
#         else:
#             return True
# 
# class ConfigurationException(Exception):
#     """Configuration Exception"""


from ndlib.models.compartments.Compartment import Compartiment, ConfigurationException

__author__ = 'Giulio Rossetti'
__license__ = "BSD-2-Clause"
__email__ = "giulio.rossetti@gmail.com"


class ConditionalComposition(Compartiment):

    def __init__(self, condition, first_branch, second_branch, **kwargs):
        super(self.__class__, self).__init__(kwargs)

# Path: ndlib/models/compartments/Compartment.py
# class Compartiment(object):
#     """
#     """
# 
#     def __init__(self, *args, **kwargs):
#         self.composed = None
#         if 'composed' in args[0]:
#             if isinstance(args[0]['composed'], Compartiment):
#                 self.composed = args[0]['composed']
# 
#     def execute(self, *args, **kwargs):
#         pass
# 
#     def compose(self, *args, **kwargs):
#         if self.composed is not None:
#             return self.composed.execute(*args, **kwargs)
#         else:
#             return True
# 
# class ConfigurationException(Exception):
#     """Configuration Exception"""


# Path: ndlib/models/compartments/ConditionalComposition.py
from ndlib.models.compartments.Compartment import Compartiment, ConfigurationException


__author__ = 'Giulio Rossetti'
__license__ = "BSD-2-Clause"
__email__ = "giulio.rossetti@gmail.com"


class ConditionalComposition(Compartiment):

    def __init__(self, condition, first_branch, second_branch, **kwargs):
        super(self.__class__, self).__init__(kwargs)

        if not isinstance(condition, Compartiment) or not isinstance(first_branch, Compartiment) \