internal void RemoveActionAtIndex(int index, HashElement element) { var action = element.ActionStates[index]; if (action == element.CurrentActionState && (!element.CurrentActionSalvaged)) { element.CurrentActionSalvaged = true; } element.ActionStates.RemoveAt(index); // update actionIndex in case we are in tick. looping over the actions if (element.ActionIndex >= index) { element.ActionIndex--; } if (element.ActionStates.Count == 0) { if (currentTarget == element) { currentTargetSalvaged = true; } else { DeleteHashElement(element); } } }
public ActionState AddAction(BaseAction action, Node target, bool paused = false) { Debug.Assert(action != null); Debug.Assert(target != null); HashElement element; if (!targets.TryGetValue(target, out element)) { element = new HashElement(); element.Paused = paused; element.Target = target; targets.Add(target, element); targetsAvailable = true; } ActionAllocWithHashElement(element); var isActionRunning = false; foreach (var existingState in element.ActionStates) { if (existingState.Action == action) { isActionRunning = true; break; } } Debug.Assert(!isActionRunning, "Action is already running for this target."); var state = action.StartAction(target); element.ActionStates.Add(state); return(state); }
protected void ActionAllocWithHashElement(HashElement element) { if (element.Actions == null) { element.Actions = new List <CCAction>(); } }
public MTActionState AddAction(MTAction action, GameObject target, bool paused = false) { Debug.Assert(action != null); Debug.Assert(target != null); HashElement element; if (!targets.TryGetValue(target, out element)) { element = new HashElement(); element.Paused = paused; element.Target = target; targets.Add(target, element); targetsAvailable = true; } ActionAllocWithHashElement(element); var isActionRunning = false; for (int i = 0; i < element.ActionStates.Count; i++) { var existingState = element.ActionStates [i]; if (existingState.Action == action) { isActionRunning = true; break; } } Debug.Assert(!isActionRunning, "MTUnityAction : Action is already running for this target."); var state = action.StartAction(target); element.ActionStates.Add(state); return state; }
protected void RemoveActionAtIndex(int index, HashElement element) { CCAction action = element.Actions[index]; if (action == element.CurrentAction && (!element.CurrentActionSalvaged)) { element.CurrentActionSalvaged = true; } element.Actions.RemoveAt(index); // update actionIndex in case we are in tick. looping over the actions if (element.ActionIndex >= index) { element.ActionIndex--; } if (element.Actions.Count == 0) { if (m_pCurrentTarget == element) { m_bCurrentTargetSalvaged = true; } else { DeleteHashElement(element); } } }
internal void DeleteHashElement(HashElement element) { element.ActionStates.Clear(); targets.Remove(element.Target); element.Target = null; targetsAvailable = targets.Count > 0; }
internal void ActionAllocWithHashElement(HashElement element) { if (element.ActionStates == null) { element.ActionStates = new List <ActionState>(); } }
internal void DeleteHashElement(HashElement element) { element.ActionStates.Clear(); // target can be null, if DeleteHashElement is called twice on the sme element if (element.Target != null) { targets.Remove(element.Target); element.Target = null; } targetsAvailable = targets.Count > 0; }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as Attachment; if (dest != null) { base.CopyTo(dest); if (ContentTypeElement != null) { dest.ContentTypeElement = (Hl7.Fhir.Model.Code)ContentTypeElement.DeepCopy(); } if (LanguageElement != null) { dest.LanguageElement = (Hl7.Fhir.Model.Code)LanguageElement.DeepCopy(); } if (DataElement != null) { dest.DataElement = (Hl7.Fhir.Model.Base64Binary)DataElement.DeepCopy(); } if (UrlElement != null) { dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopy(); } if (SizeElement != null) { dest.SizeElement = (Hl7.Fhir.Model.UnsignedInt)SizeElement.DeepCopy(); } if (HashElement != null) { dest.HashElement = (Hl7.Fhir.Model.Base64Binary)HashElement.DeepCopy(); } if (TitleElement != null) { dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopy(); } if (CreationElement != null) { dest.CreationElement = (Hl7.Fhir.Model.FhirDateTime)CreationElement.DeepCopy(); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
public void AddAction(CCAction action, CCNode target, bool paused) { Debug.Assert(action != null); Debug.Assert(target != null); HashElement element; if (!m_pTargets.TryGetValue(target, out element)) { element = new HashElement(); element.Paused = paused; element.Target = target; m_pTargets.Add(target, element); } ActionAllocWithHashElement(element); Debug.Assert(!element.Actions.Contains(action)); element.Actions.Add(action); action.StartWithTarget(target); }
public void AddAction(CCAction action, CCNode target, bool paused) { Debug.Assert(action != null); Debug.Assert(target != null); HashElement element; if (!m_pTargets.TryGetValue(target, out element)) { element = new HashElement(); element.Paused = paused; element.Target = target; m_pTargets.Add(target, element); } ActionAllocWithHashElement(element); Debug.Assert(!element.Actions.Contains(action)); element.Actions.Add(action); action.StartWithTarget(target); }
public void AddAction(Action action, CocosNode target) { if (action == null) { throw new ArgumentNullException("action"); } if (target == null) { throw new ArgumentNullException("target"); } HashElement element = null; if (_hash.ContainsKey(target)) { element = _hash[target]; } else { element = new HashElement(); element.Target = target; _hash.Add(target, element); } element.Actions.Add(action); action.Target = target; action.Start(); }
public override ErrorList Validate() { var result = new ErrorList(); result.AddRange(base.Validate()); if (ContentTypeElement != null) { result.AddRange(ContentTypeElement.Validate()); } if (LanguageElement != null) { result.AddRange(LanguageElement.Validate()); } if (DataElement != null) { result.AddRange(DataElement.Validate()); } if (UrlElement != null) { result.AddRange(UrlElement.Validate()); } if (SizeElement != null) { result.AddRange(SizeElement.Validate()); } if (HashElement != null) { result.AddRange(HashElement.Validate()); } if (TitleElement != null) { result.AddRange(TitleElement.Validate()); } return(result); }
public JActionState AddAction(JAction action, GameObject target, bool paused = false) { Debug.Assert(action != null); Debug.Assert(target != null); HashElement element; if (!targets.TryGetValue(target, out element)) { element = new HashElement(); element.Paused = paused; element.Target = target; targets.Add(target, element); targetsAvailable = true; } ActionAllocWithHashElement(element); var isActionRunning = false; for (int i = 0; i < element.ActionStates.Count; i++) { var existingState = element.ActionStates [i]; if (existingState.Action == action) { isActionRunning = true; break; } } Debug.Assert(!isActionRunning, "JUnityAction : Action is already running for this target."); var state = action.StartAction(target); element.ActionStates.Add(state); return(state); }
public static Move AlfaBeta(ContextMakao stanje, int dubina, int alfa, int beta) { if (stop) { return(null); } if (stanje == null) { return(null); } List <Move> potezi = stanje.GetListaMogucihPoteza(); if (TranspozicionaTabela.Sadrzi(stanje)) { HashElement tmp = TranspozicionaTabela.VratiEl(stanje); if (tmp.Dubina >= dubina) { return(tmp.Nabolji); } else { potezi.Insert(0, tmp.Nabolji); } } if (TranspozicionaTabela.Sadrzi(stanje) && TranspozicionaTabela.VratiEl(stanje).Dubina < dubina) { Move najbolji = TranspozicionaTabela.VratiEl(stanje).Nabolji; } if (dubina == 0 || potezi.Count == 0) { Move pom = new Move(); pom.Value = stanje.Evaluate(); pom.NarednoStanje = null; //Careful we still don't know what move is the best return(pom); } else if (stanje.NaPotezu == 1) //komp { Move temp = new Move(); temp.Value = Int32.MinValue; int alfa1 = Int32.MinValue; foreach (var sledecciPotez in potezi) { if (TranspozicionaTabela.Sadrzi(stanje)) { alfa1 = TranspozicionaTabela.VratiEl(stanje).Alfa; } Move b = AlfaBeta(sledecciPotez.NarednoStanje, dubina - 1, alfa1, beta); if (b.Value > temp.Value) { temp = sledecciPotez; temp.Value = b.Value; } if (alfa1 < temp.Value) { alfa1 = temp.Value; } if (beta <= alfa1) { break; } } if (TranspozicionaTabela.Sadrzi(stanje)) { HashElement pom = TranspozicionaTabela.VratiEl(stanje); if (pom.Dubina <= dubina) { pom.Alfa = alfa1; pom.Dubina = dubina; pom.Nabolji = temp; pom.Beta = beta; pom.Flag = 0; } } else { HashElement pom = new HashElement { Alfa = alfa1, Dubina = dubina, Nabolji = temp, Beta = beta, Flag = 0 }; TranspozicionaTabela.Add(stanje, pom); } return(temp); } else { if (TranspozicionaTabela.Sadrzi(stanje)) { HashElement el = TranspozicionaTabela.VratiEl(stanje); if (el.Dubina >= dubina) { return(el.Nabolji); } } Move temp = new Move(); temp.Value = Int32.MaxValue; int beta1 = Int32.MaxValue; foreach (var sledeciPotez in potezi) { if (TranspozicionaTabela.Sadrzi(stanje)) { beta1 = TranspozicionaTabela.VratiEl(stanje).Beta; } Move b = AlfaBeta(sledeciPotez.NarednoStanje, dubina - 1, alfa, beta1); if (b.Value < temp.Value) { temp = sledeciPotez; temp.Value = b.Value; } if (beta1 > temp.Value) { beta1 = temp.Value; } if (beta1 <= alfa) { break; } } if (TranspozicionaTabela.Sadrzi(stanje)) { HashElement tmp = TranspozicionaTabela.VratiEl(stanje); if (tmp.Dubina <= dubina) { tmp.Alfa = alfa; tmp.Beta = dubina; tmp.Nabolji = temp; tmp.Beta = beta1; tmp.Flag = 0; } } else { HashElement pom = new HashElement { Nabolji = temp, Alfa = alfa, Beta = beta1, Flag = 0, Dubina = dubina }; TranspozicionaTabela.Add(stanje, pom); } return(temp); } }
public void Update(float dt) { int count = m_pTargets.Keys.Count; while (m_pTmpKeysArray.Length < count) { m_pTmpKeysArray = new CCNode[m_pTmpKeysArray.Length * 2]; } m_pTargets.Keys.CopyTo(m_pTmpKeysArray, 0); for (int i = 0; i < count; i++) { HashElement elt; if (!m_pTargets.TryGetValue(m_pTmpKeysArray[i], out elt)) { continue; } m_pCurrentTarget = elt; m_bCurrentTargetSalvaged = false; if (!m_pCurrentTarget.Paused) { // The 'actions' may change while inside this loop. for (m_pCurrentTarget.ActionIndex = 0; m_pCurrentTarget.ActionIndex < m_pCurrentTarget.Actions.Count; m_pCurrentTarget.ActionIndex++) { m_pCurrentTarget.CurrentAction = m_pCurrentTarget.Actions[m_pCurrentTarget.ActionIndex]; if (m_pCurrentTarget.CurrentAction == null) { continue; } m_pCurrentTarget.CurrentActionSalvaged = false; m_pCurrentTarget.CurrentAction.Step(dt); if (m_pCurrentTarget.CurrentActionSalvaged) { // The currentAction told the node to remove it. To prevent the action from // accidentally deallocating itself before finishing its step, we retained // it. Now that step is done, it's safe to release it. //m_pCurrentTarget->currentAction->release(); } else if (m_pCurrentTarget.CurrentAction.IsDone) { m_pCurrentTarget.CurrentAction.Stop(); CCAction action = m_pCurrentTarget.CurrentAction; // Make currentAction nil to prevent removeAction from salvaging it. m_pCurrentTarget.CurrentAction = null; RemoveAction(action); } m_pCurrentTarget.CurrentAction = null; } } // only delete currentTarget if no actions were scheduled during the cycle (issue #481) if (m_bCurrentTargetSalvaged && m_pCurrentTarget.Actions.Count == 0) { DeleteHashElement(m_pCurrentTarget); } } // issue #635 m_pCurrentTarget = null; }
public void Update() { if (!targetsAvailable) return; float dt = Time.deltaTime; int count = targets.Count; // Debug.Log ("tarr count " + count); // while (tmpKeysArray.Count < count) // { // tmpKeysArray = new GameObject[tmpKeysArray.Count * 2]; // } // targets.Keys.CopyTo(tmpKeysArray, 0); tmpKeysArray.Clear(); var curEn = targets.GetEnumerator(); while(curEn.MoveNext()) { tmpKeysArray.Add(curEn.Current.Key); } for (int i = 0; i < count; i++) { HashElement elt; if (!targets.TryGetValue(tmpKeysArray[i], out elt)) { continue; } currentTarget = elt; currentTargetSalvaged = false; if (!currentTarget.Paused) { // The 'actions' may change while inside this loop. for (currentTarget.ActionIndex = 0; currentTarget.ActionIndex < currentTarget.ActionStates.Count; currentTarget.ActionIndex++) { currentTarget.CurrentActionState = currentTarget.ActionStates[currentTarget.ActionIndex]; if (currentTarget.CurrentActionState == null) { continue; } currentTarget.CurrentActionSalvaged = false; currentTarget.CurrentActionState.Step(dt); if (currentTarget.CurrentActionSalvaged) { // The currentAction told the node to remove it. To prevent the action from // accidentally deallocating itself before finishing its step, we retained // it. Now that step is done, it's safe to release it. //currentTarget->currentAction->release(); } else if (currentTarget.CurrentActionState.IsDone) { currentTarget.CurrentActionState.Stop(); var actionState = currentTarget.CurrentActionState; // Make currentAction nil to prevent removeAction from salvaging it. currentTarget.CurrentActionState = null; RemoveAction(actionState); } currentTarget.CurrentActionState = null; } } // only delete currentTarget if no actions were scheduled during the cycle (issue #481) if (currentTargetSalvaged && currentTarget.ActionStates.Count == 0) { DeleteHashElement(currentTarget); } if (tmpKeysArray [i] == null || ((GameObject)tmpKeysArray [i]).gameObject == null) { DeleteHashElement (currentTarget); } } // issue #635 currentTarget = null; // for (int i = 0; i < toRemove.Count; i++) { // // } }
internal void DeleteHashElement(HashElement element) { element.ActionStates.Clear(); targets.Remove(element.Target); element.Target = null; }
internal void RemoveActionAtIndex(int index, HashElement element) { var action = element.ActionStates[index]; if (action == element.CurrentActionState && (!element.CurrentActionSalvaged)) { element.CurrentActionSalvaged = true; } element.ActionStates.RemoveAt(index); // update actionIndex in case we are in tick. looping over the actions if (element.ActionIndex >= index) { element.ActionIndex--; } if (element.ActionStates.Count == 0) { if (currentTarget == element) { currentTargetSalvaged = true; } else { DeleteHashElement(element); } } }
public CCActionState AddAction(CCAction action, CCNode target, bool paused = false) { Debug.Assert(action != null); Debug.Assert(target != null); HashElement element; if (!targets.TryGetValue(target, out element)) { element = new HashElement(); element.Paused = paused; element.Target = target; targets.Add(target, element); } ActionAllocWithHashElement(element); var isActionRunning = false; foreach (var existingState in element.ActionStates) { if (existingState.Action == action) { isActionRunning = true; break; } } Debug.Assert(!isActionRunning, "CocosSharp : Action is already running for this target."); var state = action.StartAction(target); element.ActionStates.Add(state); return state; }
public void Update() { if (!targetsAvailable) { return; } float dt = Time.deltaTime; int count = targets.Count; // Debug.Log ("tarr count " + count); // while (tmpKeysArray.Count < count) // { // tmpKeysArray = new GameObject[tmpKeysArray.Count * 2]; // } // targets.Keys.CopyTo(tmpKeysArray, 0); tmpKeysArray.Clear(); var enumK = targets.GetEnumerator(); while (enumK.MoveNext()) { tmpKeysArray.Add(enumK.Current.Key); } // tmpKeysArray.AddRange (targets.Keys); for (int i = 0; i < count; i++) { HashElement elt; if (!targets.TryGetValue(tmpKeysArray[i], out elt)) { continue; } currentTarget = elt; currentTargetSalvaged = false; if (!currentTarget.Paused) { // The 'actions' may change while inside this loop. for (currentTarget.ActionIndex = 0; currentTarget.ActionIndex < currentTarget.ActionStates.Count; currentTarget.ActionIndex++) { currentTarget.CurrentActionState = currentTarget.ActionStates[currentTarget.ActionIndex]; if (currentTarget.CurrentActionState == null) { continue; } currentTarget.CurrentActionSalvaged = false; currentTarget.CurrentActionState.Step(dt); if (currentTarget.CurrentActionSalvaged) { // The currentAction told the node to remove it. To prevent the action from // accidentally deallocating itself before finishing its step, we retained // it. Now that step is done, it's safe to release it. //currentTarget->currentAction->release(); } else if (currentTarget.CurrentActionState.IsDone) { currentTarget.CurrentActionState.Stop(); var actionState = currentTarget.CurrentActionState; // Make currentAction nil to prevent removeAction from salvaging it. currentTarget.CurrentActionState = null; RemoveAction(actionState); } currentTarget.CurrentActionState = null; } } // only delete currentTarget if no actions were scheduled during the cycle (issue #481) if (currentTargetSalvaged && currentTarget.ActionStates.Count == 0) { DeleteHashElement(currentTarget); } if (tmpKeysArray [i] == null || ((GameObject)tmpKeysArray [i]).gameObject == null) { DeleteHashElement(currentTarget); } } // issue #635 currentTarget = null; // for (int i = 0; i < toRemove.Count; i++) { // // } }
protected void ActionAllocWithHashElement(HashElement element) { if (element.Actions == null) { element.Actions = new List<CCAction>(); } }
public void Update(float dt) { int count = m_pTargets.Keys.Count; while (m_pTmpKeysArray.Length < count) { m_pTmpKeysArray = new CCNode[m_pTmpKeysArray.Length * 2]; } m_pTargets.Keys.CopyTo(m_pTmpKeysArray, 0); for (int i = 0; i < count; i++) { HashElement elt; if (!m_pTargets.TryGetValue(m_pTmpKeysArray[i], out elt)) { continue; } m_pCurrentTarget = elt; m_bCurrentTargetSalvaged = false; if (!m_pCurrentTarget.Paused) { // The 'actions' may change while inside this loop. for (m_pCurrentTarget.ActionIndex = 0; m_pCurrentTarget.ActionIndex < m_pCurrentTarget.Actions.Count; m_pCurrentTarget.ActionIndex++) { m_pCurrentTarget.CurrentAction = m_pCurrentTarget.Actions[m_pCurrentTarget.ActionIndex]; if (m_pCurrentTarget.CurrentAction == null) { continue; } m_pCurrentTarget.CurrentActionSalvaged = false; m_pCurrentTarget.CurrentAction.Step(dt); if (m_pCurrentTarget.CurrentActionSalvaged) { // The currentAction told the node to remove it. To prevent the action from // accidentally deallocating itself before finishing its step, we retained // it. Now that step is done, it's safe to release it. //m_pCurrentTarget->currentAction->release(); } else if (m_pCurrentTarget.CurrentAction.IsDone) { m_pCurrentTarget.CurrentAction.Stop(); CCAction action = m_pCurrentTarget.CurrentAction; // Make currentAction nil to prevent removeAction from salvaging it. m_pCurrentTarget.CurrentAction = null; RemoveAction(action); } m_pCurrentTarget.CurrentAction = null; } } // only delete currentTarget if no actions were scheduled during the cycle (issue #481) if (m_bCurrentTargetSalvaged && m_pCurrentTarget.Actions.Count == 0) { DeleteHashElement(m_pCurrentTarget); } } // issue #635 m_pCurrentTarget = null; }
protected void DeleteHashElement(HashElement element) { element.Actions.Clear(); m_pTargets.Remove(element.Target); element.Target = null; }
public override ErrorList Validate() { var result = new ErrorList(); result.AddRange(base.Validate()); if (MasterIdentifier != null) { result.AddRange(MasterIdentifier.Validate()); } if (Identifier != null) { Identifier.ForEach(elem => result.AddRange(elem.Validate())); } if (Subject != null) { result.AddRange(Subject.Validate()); } if (Type != null) { result.AddRange(Type.Validate()); } if (Subtype != null) { result.AddRange(Subtype.Validate()); } if (Author != null) { Author.ForEach(elem => result.AddRange(elem.Validate())); } if (Custodian != null) { result.AddRange(Custodian.Validate()); } if (Authenticator != null) { result.AddRange(Authenticator.Validate()); } if (CreatedElement != null) { result.AddRange(CreatedElement.Validate()); } if (IndexedElement != null) { result.AddRange(IndexedElement.Validate()); } if (StatusElement != null) { result.AddRange(StatusElement.Validate()); } if (DocStatus != null) { result.AddRange(DocStatus.Validate()); } if (Supercedes != null) { result.AddRange(Supercedes.Validate()); } if (DescriptionElement != null) { result.AddRange(DescriptionElement.Validate()); } if (Confidentiality != null) { result.AddRange(Confidentiality.Validate()); } if (PrimaryLanguageElement != null) { result.AddRange(PrimaryLanguageElement.Validate()); } if (MimeTypeElement != null) { result.AddRange(MimeTypeElement.Validate()); } if (Format != null) { result.AddRange(Format.Validate()); } if (SizeElement != null) { result.AddRange(SizeElement.Validate()); } if (HashElement != null) { result.AddRange(HashElement.Validate()); } if (LocationElement != null) { result.AddRange(LocationElement.Validate()); } if (Service != null) { result.AddRange(Service.Validate()); } if (Context != null) { result.AddRange(Context.Validate()); } return(result); }
public void Update(float dt) { if (!targetsAvailable) { return; } int count = targets.Count; while (tmpKeysArray.Length < count) { tmpKeysArray = new Node[tmpKeysArray.Length * 2]; } targets.Keys.CopyTo(tmpKeysArray, 0); for (int i = 0; i < count; i++) { HashElement elt; if (!targets.TryGetValue(tmpKeysArray[i], out elt)) { continue; } if (elt.Target.IsDeleted) { targets.Remove(elt.Target); } currentTarget = elt; currentTargetSalvaged = false; if (!currentTarget.Paused) { // The 'actions' may change while inside this loop. for (currentTarget.ActionIndex = 0; currentTarget.ActionIndex < currentTarget.ActionStates.Count; currentTarget.ActionIndex++) { currentTarget.CurrentActionState = currentTarget.ActionStates[currentTarget.ActionIndex]; if (currentTarget.CurrentActionState == null) { continue; } if (currentTarget.Target.IsDeleted) { break; } currentTarget.CurrentActionSalvaged = false; currentTarget.CurrentActionState.Step(dt); if (currentTarget.CurrentActionSalvaged) { // The currentAction told the node to remove it. To prevent the action from // aidentally deallocating itself before finishing its step, we retained // it. Now that step is done, it's safe to release it. //currentTarget->currentAction->release(); } else if (currentTarget.CurrentActionState.IsDone) { currentTarget.CurrentActionState.Stop(); var actionState = currentTarget.CurrentActionState; // Make currentAction nil to prevent removeAction from salvaging it. currentTarget.CurrentActionState = null; RemoveAction(actionState); } currentTarget.CurrentActionState = null; } } // only delete currentTarget if no actions were scheduled during the cycle (issue #481) if (currentTargetSalvaged && currentTarget.ActionStates.Count == 0) { DeleteHashElement(currentTarget); } } currentTarget = null; }
internal void DeleteHashElement(HashElement element) { element.ActionStates.Clear(); targets.Remove(element.Target); element.Target = null; targetsAvailable = targets.Count > 0; }
public void Update(float dt) { if (!targetsAvailable) return; int count = targets.Count; while (tmpKeysArray.Length < count) { tmpKeysArray = new CCNode[tmpKeysArray.Length * 2]; } targets.Keys.CopyTo(tmpKeysArray, 0); for (int i = 0; i < count; i++) { HashElement elt; if (!targets.TryGetValue(tmpKeysArray[i], out elt)) { continue; } currentTarget = elt; currentTargetSalvaged = false; if (!currentTarget.Paused) { // The 'actions' may change while inside this loop. for (currentTarget.ActionIndex = 0; currentTarget.ActionIndex < currentTarget.ActionStates.Count; currentTarget.ActionIndex++) { currentTarget.CurrentActionState = currentTarget.ActionStates[currentTarget.ActionIndex]; if (currentTarget.CurrentActionState == null) { continue; } currentTarget.CurrentActionSalvaged = false; currentTarget.CurrentActionState.Step(dt); if (currentTarget.CurrentActionSalvaged) { // The currentAction told the node to remove it. To prevent the action from // accidentally deallocating itself before finishing its step, we retained // it. Now that step is done, it's safe to release it. //currentTarget->currentAction->release(); } else if (currentTarget.CurrentActionState.IsDone) { currentTarget.CurrentActionState.Stop(); var actionState = currentTarget.CurrentActionState; // Make currentAction nil to prevent removeAction from salvaging it. currentTarget.CurrentActionState = null; RemoveAction(actionState); } currentTarget.CurrentActionState = null; } } // only delete currentTarget if no actions were scheduled during the cycle (issue #481) if (currentTargetSalvaged && currentTarget.ActionStates.Count == 0) { DeleteHashElement(currentTarget); } } // issue #635 currentTarget = null; }
protected void RemoveActionAtIndex(int index, HashElement element) { CCAction action = element.Actions[index]; if (action == element.CurrentAction && (!element.CurrentActionSalvaged)) { element.CurrentActionSalvaged = true; } element.Actions.RemoveAt(index); // update actionIndex in case we are in tick. looping over the actions if (element.ActionIndex >= index) { element.ActionIndex--; } if (element.Actions.Count == 0) { if (m_pCurrentTarget == element) { m_bCurrentTargetSalvaged = true; } else { DeleteHashElement(element); } } }
internal void DeleteHashElement(HashElement element) { element.ActionStates.Clear(); targets.Remove(element.Target); element.Target = null; }
protected void DeleteHashElement(HashElement element) { element.Actions.Clear(); m_pTargets.Remove(element.Target); element.Target = null; }
internal void ActionAllocWithHashElement(HashElement element) { if (element.ActionStates == null) { element.ActionStates = new List<CCActionState>(); } }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as DocumentReference; if (dest != null) { base.CopyTo(dest); if (MasterIdentifier != null) { dest.MasterIdentifier = (Hl7.Fhir.Model.Identifier)MasterIdentifier.DeepCopy(); } if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (Subject != null) { dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy(); } if (Type != null) { dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy(); } if (Class != null) { dest.Class = (Hl7.Fhir.Model.CodeableConcept)Class.DeepCopy(); } if (Author != null) { dest.Author = new List <Hl7.Fhir.Model.ResourceReference>(Author.DeepCopy()); } if (Custodian != null) { dest.Custodian = (Hl7.Fhir.Model.ResourceReference)Custodian.DeepCopy(); } if (PolicyManagerElement != null) { dest.PolicyManagerElement = (Hl7.Fhir.Model.FhirUri)PolicyManagerElement.DeepCopy(); } if (Authenticator != null) { dest.Authenticator = (Hl7.Fhir.Model.ResourceReference)Authenticator.DeepCopy(); } if (CreatedElement != null) { dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopy(); } if (IndexedElement != null) { dest.IndexedElement = (Hl7.Fhir.Model.Instant)IndexedElement.DeepCopy(); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.DocumentReference.DocumentReferenceStatus>)StatusElement.DeepCopy(); } if (DocStatus != null) { dest.DocStatus = (Hl7.Fhir.Model.CodeableConcept)DocStatus.DeepCopy(); } if (RelatesTo != null) { dest.RelatesTo = new List <Hl7.Fhir.Model.DocumentReference.DocumentReferenceRelatesToComponent>(RelatesTo.DeepCopy()); } if (DescriptionElement != null) { dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopy(); } if (Confidentiality != null) { dest.Confidentiality = new List <Hl7.Fhir.Model.CodeableConcept>(Confidentiality.DeepCopy()); } if (PrimaryLanguageElement != null) { dest.PrimaryLanguageElement = (Hl7.Fhir.Model.Code)PrimaryLanguageElement.DeepCopy(); } if (MimeTypeElement != null) { dest.MimeTypeElement = (Hl7.Fhir.Model.Code)MimeTypeElement.DeepCopy(); } if (FormatElement != null) { dest.FormatElement = new List <Hl7.Fhir.Model.FhirUri>(FormatElement.DeepCopy()); } if (SizeElement != null) { dest.SizeElement = (Hl7.Fhir.Model.Integer)SizeElement.DeepCopy(); } if (HashElement != null) { dest.HashElement = (Hl7.Fhir.Model.FhirString)HashElement.DeepCopy(); } if (LocationElement != null) { dest.LocationElement = (Hl7.Fhir.Model.FhirUri)LocationElement.DeepCopy(); } if (Service != null) { dest.Service = (Hl7.Fhir.Model.DocumentReference.DocumentReferenceServiceComponent)Service.DeepCopy(); } if (Context != null) { dest.Context = (Hl7.Fhir.Model.DocumentReference.DocumentReferenceContextComponent)Context.DeepCopy(); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as Attachment; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (ContentTypeElement != null) { dest.ContentTypeElement = (Hl7.Fhir.Model.Code)ContentTypeElement.DeepCopy(); } if (LanguageElement != null) { dest.LanguageElement = (Hl7.Fhir.Model.Code)LanguageElement.DeepCopy(); } if (DataElement != null) { dest.DataElement = (Hl7.Fhir.Model.Base64Binary)DataElement.DeepCopy(); } if (UrlElement != null) { dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)UrlElement.DeepCopy(); } if (SizeElement != null) { dest.SizeElement = (Hl7.Fhir.Model.Integer64)SizeElement.DeepCopy(); } if (HashElement != null) { dest.HashElement = (Hl7.Fhir.Model.Base64Binary)HashElement.DeepCopy(); } if (TitleElement != null) { dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopy(); } if (CreationElement != null) { dest.CreationElement = (Hl7.Fhir.Model.FhirDateTime)CreationElement.DeepCopy(); } if (HeightElement != null) { dest.HeightElement = (Hl7.Fhir.Model.PositiveInt)HeightElement.DeepCopy(); } if (WidthElement != null) { dest.WidthElement = (Hl7.Fhir.Model.PositiveInt)WidthElement.DeepCopy(); } if (FramesElement != null) { dest.FramesElement = (Hl7.Fhir.Model.PositiveInt)FramesElement.DeepCopy(); } if (DurationElement != null) { dest.DurationElement = (Hl7.Fhir.Model.FhirDecimal)DurationElement.DeepCopy(); } if (PagesElement != null) { dest.PagesElement = (Hl7.Fhir.Model.PositiveInt)PagesElement.DeepCopy(); } return(dest); }