public bool IsDescendantOfBlock(PowerTaskList taskList) { if (taskList != null) { if (this.IsInBlock(taskList)) { return(true); } PowerTaskList origin = taskList.GetOrigin(); for (PowerTaskList list2 = this.GetParent(); list2 != null; list2 = list2.m_parent) { if (list2 == origin) { return(true); } } } return(false); }
private void BuildTaskList(List <Network.PowerHistory> powerList, ref int index, PowerTaskList taskList) { while (index < powerList.Count) { Network.PowerHistory netPower = powerList[index]; Network.PowerType type = netPower.Type; if (type == Network.PowerType.ACTION_START) { if (!taskList.IsEmpty()) { this.EnqueueTaskList(taskList); } PowerTaskList item = new PowerTaskList(); item.SetSourceAction((Network.HistActionStart)netPower); PowerTaskList origin = taskList.GetOrigin(); if (origin.IsSourceActionOrigin()) { item.SetParent(origin); } this.m_previousStack.Push(item); index++; this.BuildTaskList(powerList, ref index, item); return; } if (type == Network.PowerType.ACTION_END) { taskList.SetEndAction((Network.HistActionEnd)netPower); if (this.m_previousStack.Count > 0) { this.m_previousStack.Pop(); this.EnqueueTaskList(taskList); return; } break; } taskList.CreateTask(netPower).DoRealTimeTask(powerList, index); index++; } if (!taskList.IsEmpty()) { this.EnqueueTaskList(taskList); } }