package edu.uprm.admg.nettraveler.sched;

public class SchedulerFactory {
	
	public static Scheduler getInstance(SchedType type, SchedMode mode, int numPartitions) throws SchedulerException{
		Scheduler result = null;
		switch(type){
			case JobFlowSched:
				result = new JobFlowSched(numPartitions);
				result.setMode(mode);
				result.setType(type);
				break;
			case PerformanceSched:
				result = new PerformanceSched(numPartitions);
				result.setMode(mode);
				result.setType(type);
				break;
			case RandomPerformanceSched:
				result = new RandomPerformanceSched(numPartitions);
				result.setMode(mode);
				result.setType(type);
				break;
			case RandomSched:
				result = new RandomSched(numPartitions);
				result.setMode(mode);
				result.setType(type);
				break;
			case RoundRobinSched:
				result = new RoundRobinSched(numPartitions);
				result.setMode(mode);
				result.setType(type);
				break;
			default:
				throw new SchedulerException("Scheduler Type not Supported");
		}
		return result;
	}
}
