private void DoApply(IteratorMethod method, int i, IActor actor) { CollectionBehaviors <T> linkedBehavior = LinkedTo as CollectionBehaviors <T>; switch (method) { case IteratorMethod.MoveNext: { if ((i < linkedBehavior.List.Count) && (i >= 0)) { actor.SendMessage(IteratorMethod.OkMoveNext, true); } else { actor.SendMessage(IteratorMethod.OkMoveNext, false); } break; } case IteratorMethod.Current: { if ((i >= 0) && (i < linkedBehavior.List.Count)) { actor.SendMessage(IteratorMethod.OkCurrent, linkedBehavior.List[i]); } else { Debug.WriteLine("Bad current"); } break; } default: throw new ActorException(string.Format(CultureInfo.InvariantCulture, "Bad IteratorMethod call {0}", method)); } }
private void DoApply(CollectionRequest request, T Data) { CollectionBehaviors <T> linkedBehavior = LinkedTo as CollectionBehaviors <T>; switch (request) { case CollectionRequest.Add: linkedBehavior.List.Add(Data); linkedBehavior.LinkedActor.SendMessage(CollectionRequest.OkAdd); break; case CollectionRequest.Remove: linkedBehavior.List.Remove(Data); linkedBehavior.LinkedActor.SendMessage(CollectionRequest.OkRemove); break; } }