# Path: intelligine/core/exceptions.py
# class NoTypeInMolecule(NoMolecule):
#     pass
# 
# class NoCategoryInMolecule(NoMolecule):
#     pass
# 
# Path: intelligine/simulation/molecule/Molecule.py
# class Molecule():
# 
#     def __init__(self, category, type, distance=None, intensity=0, cycle_age=None):
#         self._category = category
#         self._type = type
#         self._distance = distance
#         self._intensity = intensity
#         self._cycle_age = cycle_age
# 
#     def get_category(self):
#         return self._category
# 
#     def get_type(self):
#         return self._type
# 
#     def get_distance(self):
#         return self._distance
# 
#     def set_distance(self, distance):
#         self._distance = distance
# 
#     def get_intensity(self):
#         return self._intensity
# 
#     def get_cycle_age(self):
#         return self._cycle_age
# 
#     def set_cycle_age(self, cycle_age):
#         self._cycle_age = cycle_age
# 
#     def increment_intensity(self, increment_value):
#         self._intensity += increment_value


from intelligine.core.exceptions import NoTypeInMolecule, NoCategoryInMolecule
from intelligine.simulation.molecule.Molecule import Molecule

class MoleculeFlavour():

    @classmethod
    def new_from_raw_data(cls, raw_data):
        flavour = {}
        for category in raw_data:
            molecules_by_category = raw_data[category]
            for type in molecules_by_category:
                distance, intensity, cycle_age = molecules_by_category[type]
                if category not in flavour:
                    flavour[category] = {}
                flavour[category][type] = Molecule(category, type, distance, intensity, cycle_age)
        return cls(flavour)

    def get_raw_data(self):
        raw_data = {}
        for category in self._flavour:
            molecules_by_category = self._flavour[category]
            for type in molecules_by_category:
                molecule = molecules_by_category[type]
                if category not in raw_data:
                    raw_data[category] = {}
                if molecule.get_intensity() >= 0:
                    raw_data[category][type] = (molecule.get_distance(),
                                                molecule.get_intensity(),
                                                molecule.get_cycle_age())
        return raw_data

    def __init__(self, flavour):

# Path: intelligine/core/exceptions.py
# class NoTypeInMolecule(NoMolecule):
#     pass
# 
# class NoCategoryInMolecule(NoMolecule):
#     pass
# 
# Path: intelligine/simulation/molecule/Molecule.py
# class Molecule():
# 
#     def __init__(self, category, type, distance=None, intensity=0, cycle_age=None):
#         self._category = category
#         self._type = type
#         self._distance = distance
#         self._intensity = intensity
#         self._cycle_age = cycle_age
# 
#     def get_category(self):
#         return self._category
# 
#     def get_type(self):
#         return self._type
# 
#     def get_distance(self):
#         return self._distance
# 
#     def set_distance(self, distance):
#         self._distance = distance
# 
#     def get_intensity(self):
#         return self._intensity
# 
#     def get_cycle_age(self):
#         return self._cycle_age
# 
#     def set_cycle_age(self, cycle_age):
#         self._cycle_age = cycle_age
# 
#     def increment_intensity(self, increment_value):
#         self._intensity += increment_value


# Path: intelligine/simulation/molecule/MoleculeFlavour.py
from intelligine.core.exceptions import NoTypeInMolecule, NoCategoryInMolecule
from intelligine.simulation.molecule.Molecule import Molecule


class MoleculeFlavour():

    @classmethod
    def new_from_raw_data(cls, raw_data):
        flavour = {}
        for category in raw_data:
            molecules_by_category = raw_data[category]
            for type in molecules_by_category:
                distance, intensity, cycle_age = molecules_by_category[type]
                if category not in flavour:
                    flavour[category] = {}
                flavour[category][type] = Molecule(category, type, distance, intensity, cycle_age)
        return cls(flavour)

    def get_raw_data(self):
        raw_data = {}
        for category in self._flavour:
            molecules_by_category = self._flavour[category]
            for type in molecules_by_category:
                molecule = molecules_by_category[type]
                if category not in raw_data:
                    raw_data[category] = {}
                if molecule.get_intensity() >= 0:
                    raw_data[category][type] = (molecule.get_distance(),
                                                molecule.get_intensity(),
                                                molecule.get_cycle_age())
        return raw_data

    def __init__(self, flavour):

        self._flavour = flavour