package cz.vutbr.feec.burget.advanced;

import cz.vutbr.feec.simlib.Simulation;

public class AddReceivers extends cz.vutbr.feec.simlib.Proc {
	private FT rft;
	private int num;
	
	public AddReceivers(int num, FT rootFt) {
		this.num = num;
		this.rft = rootFt;
	}
	
	@Override
	public void action() {
		for (Member member : rft.getChilds()) {
			FT f = (FT) member;
			for (int i = 0; i < num; i++) {
				Receiver r = new Receiver(Main.R_PERIOD);
				f.addChild(r);
				getSimulation().addProcess(r, 0);
			}
		}
	}
}
