from collections import Iterable

from evolalg.base.step import Step


class UnionStep(Step):
    def __init__(self, steps):
        if isinstance(steps, Iterable):
            self.steps = steps
        else:
            self.steps = [steps]

    def call(self, population):
        for s in self.steps:
            population = s(population)
        return population
