/// <summary> /// Creates a new schedule. /// </summary> /// <param name="scheduleID">ID for the current task.</param> /// <param name="roadMaintenanceTask">The actual task.</param> /// <param name="from">Time where the task should start.</param> /// <param name="to">Time where the task should end.</param> public Schedule(int scheduleID, RoadMaintenanceTask roadMaintenanceTask, DateTime from, DateTime to) { this.ScheduleID = scheduleID; this.RoadMaintenanceTask = roadMaintenanceTask; this.From = from; this.To = to; this.Progress = 0.0; }
/// <summary> /// Orders the specified (ID, team) reinforcement. /// </summary> /// <param name="scheduleID">The ID of the current schedule.</param> /// <param name="team">The specified team.</param> public void OrderTeamReinforcement(int scheduledID, Team team) { RoadMaintenanceTask task = Schedules[scheduledID].GetRoadMaintenanceTask(); if (task == null) { throw new ArgumentException("Task cannot be null"); } if (team != null && Staff.IsReady(team)) { task.AssignTeam(team); team.SetOnMission(true); } }
/// <summary> /// Orders equipment as reinforcement. /// </summary> /// <param name="scheduleID">The ID of the current schedule.</param> /// <param name="equipment">The equipment which is needed.</param> public void OrderEquipmentReinforcement(int scheduledID, Equipment equipment) { RoadMaintenanceTask task = Schedules[scheduledID].GetRoadMaintenanceTask(); if (task == null) { throw new ArgumentException("Task cannot be null"); } if (equipment != null && Staff.IsReady(equipment)) { task.AssignEquipment(equipment); equipment.SetOnMission(true); } }
/// <summary> /// Schedules a given task. /// </summary> /// <param name="task">The given task which should be scheduled.</param> /// <param name="from">Defines when the task should start.</param> /// <param name="to">Defines when the task should end.</param> private void ScheduleTask(RoadMaintenanceTask task, DateTime from, DateTime to) { Schedule schedule = new Schedule(IDCounter++, task, from, to); Schedules.Add(schedule.GetScheduleID(), schedule); }