/// <summary> /// Create a new task based on a reference task from which the different parameters will be copied. /// </summary> /// <param name="id">The ID of the new task, potentially different from the reference task.</param> /// <param name="refTask">The parent task from which parameters will be copied</param> /// <param name="linkingType">Controls the possible sharing with the reference task some data structure</param> protected SimulationTask(int id, SimulationTask refTask, TaskLinkingType linkingType) { this.id = id; this.refTask = refTask; Reset(); { //Always linked this.crewmanTypes = refTask.crewmanTypes; this.phaseTypes = refTask.phaseTypes; } switch (linkingType) { case TaskLinkingType.Linked: this.simulationCurrentQualifications = refTask.simulationCurrentQualifications; this.parallelTasks = refTask.parallelTasks; this.slaveTasks = refTask.slaveTasks; this.masterTasks = refTask.masterTasks; break; case TaskLinkingType.Copy: //this.crewmanTypes = refTask.crewmanTypes.ToList(); //this.phaseTypes = refTask.phaseTypes.ToList(); this.simulationCurrentQualifications = new Dictionary <Crewman, byte>(this.refTask.simulationCurrentQualifications); this.parallelTasks = new Dictionary <int, SimulationTask>(this.refTask.parallelTasks); this.slaveTasks = new Dictionary <int, SimulationTask>(this.refTask.slaveTasks); this.masterTasks = new Dictionary <int, SimulationTask>(this.refTask.masterTasks); break; case TaskLinkingType.Clear: default: //this.crewmanTypes = refTask.crewmanTypes.ToList(); //this.phaseTypes = refTask.phaseTypes.ToList(); this.simulationCurrentQualifications = new Dictionary <Crewman, byte>(this.refTask.simulationCurrentQualifications); this.parallelTasks = new Dictionary <int, SimulationTask>(); this.slaveTasks = new Dictionary <int, SimulationTask>(); this.masterTasks = new Dictionary <int, SimulationTask>(); break; } this.refTask = refTask.RootTask; }
internal BasicTask(int id, SimulationTask refTask, TaskLinkingType linkingType = TaskLinkingType.Linked) : base(id, refTask, linkingType) { }
public BasicTask(SimulationTask refTask, TaskLinkingType linkingType = TaskLinkingType.Linked) : base(refTask, linkingType) { }
/// <summary> /// Create a new task based on a reference task from which the different parameters will be copied (including task ID). /// </summary> /// <param name="refTask">The parent task from which parameters will be copied</param> /// <param name="linkingType">Controls the possible sharing with the reference task some data structures</param> protected SimulationTask(SimulationTask refTask, TaskLinkingType linkingType) : this(refTask.id, refTask, linkingType) { }
protected internal abstract SimulationTask CreateTask(int id, SimulationTask refTask, TaskLinkingType linkingType); //TODO: Make protected internal
public abstract SimulationTask CreateTask(SimulationTask refTask, TaskLinkingType linkingType);
protected internal override SimulationTask CreateTask(int id, SimulationTask refTask, TaskLinkingType linkingType) { return(new BasicTask(id, refTask, linkingType)); }
public override SimulationTask CreateTask(SimulationTask refTask, TaskLinkingType linkingType) { return(new BasicTask(refTask, linkingType)); }