package be.iminds.ilabt.jfed.experiment.events;

import be.iminds.ilabt.jfed.experiment.ExperimentController;
import be.iminds.ilabt.jfed.experiment.ExperimentPart;

import java.util.Collection;
import java.util.Collections;

/**
 * User: twalcari
 * Date: 1/11/2016
 * Time: 09:30
 */
public class ExperimentPartsEvent extends ExperimentEvent {

    public static final ExperimentEventType<ExperimentPartsEvent> ANY =
            new ExperimentEventType<>(ExperimentEventType.ROOT, "ANY");

    public static final ExperimentEventType<ExperimentPartsEvent> STOPPED =
            new ExperimentEventType<>(ANY, "STOPPED");

    private final Collection<ExperimentPart> parts;

    public ExperimentPartsEvent(ExperimentController source, ExperimentEventType<? extends ExperimentEvent> type, Collection<ExperimentPart> parts) {
        super(source, type);
        this.parts = parts;
    }

    @Override
    public ExperimentController getSource() {
        return super.getSource();
    }

    @Override
    public ExperimentEventType<? extends ExperimentPartsEvent> getType() {
        //noinspection unchecked
        return (ExperimentEventType<? extends ExperimentPartsEvent>) super.getType();
    }

    public Collection<ExperimentPart> getParts() {
        return Collections.unmodifiableCollection(parts);
    }
}
