private void checkAdvancedTime(ArrayList<Module> modules, ArrayList<Room> rooms,int examPeriodLength) throws IllegalArgumentException{
		Set<String> roomTypes = new HashSet<String>();
		Set<String> moduleTypes = new HashSet<String>();
		
		for(Module module:modules){
			moduleTypes.add(module.getType());
		}
		
		for(Room room:rooms){
			roomTypes.add(room.getRoomType());
		}
		
		ArrayList<String> roomTimeType = new ArrayList<String>(roomTypes);
		ArrayList<String> moduleTimeType = new ArrayList<String>(moduleTypes);
		
		HashMap<String, Integer> roomTimeByType = new HashMap<String, Integer>();
		
		for(String room: roomTimeType){
			roomTimeByType.put(room, 0);
		}
		
		HashMap<String, Integer> moduleTimeByType = new HashMap<String, Integer>();
		
		for(String module: moduleTimeType){
			moduleTimeByType.put(module, 0);
		}
		
		int value=0;
		
		for(Module module:modules){
			value= moduleTimeByType.get(module.getType());
			value=value+module.getExamLength();
			moduleTimeByType.put(module.getType(), value);
		}
		
		for(Room room:rooms){
			value= roomTimeByType.get(room.getRoomType());
			value=value+(room.getRoomEnd()-room.getRoomStart());
			roomTimeByType.put(room.getRoomType(), value);
		}
		
		for (String module:moduleTypes){
			System.out.println(moduleTimeByType.get(module)+"  "+roomTimeByType.get(module)*examPeriodLength);
			if (moduleTimeByType.get(module)>(roomTimeByType.get(module)*examPeriodLength)){
				throw new IllegalArgumentException("Number of hours of exam scheduled in " + module +" room type is greater than number of hours of that type avialable!" );
			}
		}	
	}