# Path: lems/base/base.py
# class LEMSBase(object):
#     """
#     Base object for PyLEMS.
#     """
# 
#     def copy(self):
#         return copy.deepcopy(self)
# 
#     def toxml(self):
#         return ""
# 
# Path: lems/base/map.py
# class Map(dict, LEMSBase):
#     """
#     Map class.
# 
#     Same as dict, but iterates over values.
#     """
# 
#     def __init__(self, *params, **key_params):
#         """
#         Constructor.
#         """
# 
#         dict.__init__(self, *params, **key_params)
# 
#     def __iter__(self):
#         """
#         Returns an iterator.
#         """
# 
#         return iter(self.values())
# 
# Path: lems/base/errors.py
# class ModelError(LEMSError):
#     """
#     Exception class to signal errors in creating the model.
#     """
# 
#     pass


from lems.base.base import LEMSBase
from lems.base.map import Map
from lems.base.errors import ModelError
        self.multi_instantiates.append(mi)

    def add_for_each(self, fe):
        """
        Adds a for-each specification.

        :param fe: For-each specification.
        :type fe: lems.model.structure.ForEach
        """

        self.for_eachs.append(fe)

    def add(self, child):
        """
        Adds a typed child object to the structure object.

        :param child: Child object to be added.
        """

        if isinstance(child, With):
            self.add_with(child)
        elif isinstance(child, EventConnection):
            self.add_event_connection(child)
        elif isinstance(child, ChildInstance):
            self.add_child_instance(child)
        elif isinstance(child, MultiInstantiate):
            self.add_multi_instantiate(child)
        elif isinstance(child, ForEach):
            self.add_for_each(child)
        else:

# Path: lems/base/base.py
# class LEMSBase(object):
#     """
#     Base object for PyLEMS.
#     """
# 
#     def copy(self):
#         return copy.deepcopy(self)
# 
#     def toxml(self):
#         return ""
# 
# Path: lems/base/map.py
# class Map(dict, LEMSBase):
#     """
#     Map class.
# 
#     Same as dict, but iterates over values.
#     """
# 
#     def __init__(self, *params, **key_params):
#         """
#         Constructor.
#         """
# 
#         dict.__init__(self, *params, **key_params)
# 
#     def __iter__(self):
#         """
#         Returns an iterator.
#         """
# 
#         return iter(self.values())
# 
# Path: lems/base/errors.py
# class ModelError(LEMSError):
#     """
#     Exception class to signal errors in creating the model.
#     """
# 
#     pass


# Path: lems/model/structure.py
from lems.base.base import LEMSBase
from lems.base.map import Map
from lems.base.errors import ModelError

        self.multi_instantiates.append(mi)

    def add_for_each(self, fe):
        """
        Adds a for-each specification.

        :param fe: For-each specification.
        :type fe: lems.model.structure.ForEach
        """

        self.for_eachs.append(fe)

    def add(self, child):
        """
        Adds a typed child object to the structure object.

        :param child: Child object to be added.
        """

        if isinstance(child, With):
            self.add_with(child)
        elif isinstance(child, EventConnection):
            self.add_event_connection(child)
        elif isinstance(child, ChildInstance):
            self.add_child_instance(child)
        elif isinstance(child, MultiInstantiate):
            self.add_multi_instantiate(child)
        elif isinstance(child, ForEach):
            self.add_for_each(child)
        else:

            raise ModelError("Unsupported child element")