public IndexInterleave(List<Process> processes) { Processes = processes; List<string> tmp = new List<string>(Processes.Count); bool hasStop = false; for (int i = 0; i < Processes.Count; i++) { if (Processes[i] is IndexInterleave) { IndexInterleave newProc = (Processes[i] as IndexInterleave); if (newProc.Processes != null) { foreach (Process processe in newProc.Processes) { if (!hasStop && processe is Stop) { hasStop = true; } if (!(processe is Stop && hasStop) && !(processe is Skip)) { tmp.Add(processe.ProcessID); } } } else { tmp.Add(newProc.IndexedProcessDefinition.ToString()); } } else { if (!hasStop && Processes[i] is Stop) { hasStop = true; } if (!(Processes[i] is Stop && hasStop) && !(Processes[i] is Skip)) { tmp.Add(Processes[i].ProcessID); } } } if (tmp.Count == 0) { if (hasStop) { Stop stop = new Stop(); Processes = new List<Process>(); Processes.Add(stop); ProcessID = stop.ProcessID; } else { Skip skip = new Skip(); Processes = new List<Process>(); Processes.Add(skip); ProcessID = skip.ProcessID; } } else { //tmp.Sort(); ProcessID = Constants.INTERLEAVE + tmp[0]; for (int i = 1; i < tmp.Count; i++) { ProcessID += Constants.SEPARATOR + tmp[i]; } ProcessID = DataStore.DataManager.InitializeProcessID(ProcessID); } }
public IndexInterleave(List <Process> processes) { Processes = processes; List <string> tmp = new List <string>(Processes.Count); bool hasStop = false; for (int i = 0; i < Processes.Count; i++) { if (Processes[i] is IndexInterleave) { IndexInterleave newProc = (Processes[i] as IndexInterleave); if (newProc.Processes != null) { foreach (Process processe in newProc.Processes) { if (!hasStop && processe is Stop) { hasStop = true; } if (!(processe is Stop && hasStop) && !(processe is Skip)) { tmp.Add(processe.ProcessID); } } } else { tmp.Add(newProc.IndexedProcessDefinition.ToString()); } } else { if (!hasStop && Processes[i] is Stop) { hasStop = true; } if (!(Processes[i] is Stop && hasStop) && !(Processes[i] is Skip)) { tmp.Add(Processes[i].ProcessID); } } } if (tmp.Count == 0) { if (hasStop) { Stop stop = new Stop(); Processes = new List <Process>(); Processes.Add(stop); ProcessID = stop.ProcessID; } else { Skip skip = new Skip(); Processes = new List <Process>(); Processes.Add(skip); ProcessID = skip.ProcessID; } } else { //tmp.Sort(); ProcessID = Constants.INTERLEAVE + tmp[0]; for (int i = 1; i < tmp.Count; i++) { ProcessID += Constants.SEPARATOR + tmp[i]; } ProcessID = DataStore.DataManager.InitializeProcessID(ProcessID); } }