# 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/errors.py
# class ModelError(LEMSError):
#     """
#     Exception class to signal errors in creating the model.
#     """
# 
#     pass
# 
# 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())


from lems.base.base import LEMSBase
from lems.base.errors import ModelError
from lems.base.map import Map
    def add_event_writer(self, event_writer):
        """
        Adds an event writer to this simulation section.

        :param event_writer: event writer to be added.
        :type event_writer: lems.model.simulation.EventWriter
        """

        self.event_writers[event_writer.path] = event_writer

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

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

        if isinstance(child, Run):
            self.add_run(child)
        elif isinstance(child, Record):
            self.add_record(child)
        elif isinstance(child, EventRecord):
            self.add_event_record(child)
        elif isinstance(child, DataDisplay):
            self.add_data_display(child)
        elif isinstance(child, DataWriter):
            self.add_data_writer(child)
        elif isinstance(child, EventWriter):
            self.add_event_writer(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/errors.py
# class ModelError(LEMSError):
#     """
#     Exception class to signal errors in creating the model.
#     """
# 
#     pass
# 
# 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/model/simulation.py
from lems.base.base import LEMSBase
from lems.base.errors import ModelError
from lems.base.map import Map

    def add_event_writer(self, event_writer):
        """
        Adds an event writer to this simulation section.

        :param event_writer: event writer to be added.
        :type event_writer: lems.model.simulation.EventWriter
        """

        self.event_writers[event_writer.path] = event_writer

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

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

        if isinstance(child, Run):
            self.add_run(child)
        elif isinstance(child, Record):
            self.add_record(child)
        elif isinstance(child, EventRecord):
            self.add_event_record(child)
        elif isinstance(child, DataDisplay):
            self.add_data_display(child)
        elif isinstance(child, DataWriter):
            self.add_data_writer(child)
        elif isinstance(child, EventWriter):
            self.add_event_writer(child)
        else:

            raise ModelError("Unsupported child element")