public void initiate_send() { if (handle_left != null) { requestList.Remove(handle_left); } int rank = comm.Rank; // Console.WriteLine(rank + ": shift-to-left : initiate_send : " + Cell.predecessor); handle_left = comm.ImmediateSend <double>(Output_buffer.Array, Cell.predecessor, DEFAULT_TAG); requestList.Add(handle_left); }
/// <summary> /// When an IMoveable is making a request we are adding it in the request list /// in this case if the maid or guest wants to use the elevator they will be added to the list and /// the status will be changed /// </summary> public void AddDestinationFloor() { //Same issues as in perform action since we cannot use a foreach loop because of threading issues we //are using a forloop to counter it. //This is how we can remove guests without breaking the application. If we had more time we wanted to implement it differently for (int i = 0; i < RequestList.Count; i++) { if (RequestList[i] is IMovable g) { if (g.Position.Y == Position.Y) { GuestList.Add(RequestList[i]); if (g.FinalDes.Position.Y < Position.Y) { Up.Add(g.FinalDes.Position.Y); UpdateList(); } else { Down.Add(g.FinalDes.Position.Y); UpdateList(); } try { GuestList[i].Status = MovableStatus.IN_ELEVATOR; RemoveGuests.Add(GuestList[i]); } catch (Exception) { } } } } for (int i = 0; i < RemoveGuests.Count; i++) { if (RemoveGuests[i] is IMovable g) { RequestList.Remove(RemoveGuests[i]); } } }
public void initiate_send_west() { //int rank = comm.Rank; //Console.Write(rank + ": x - initiate_send_west :"); if (Shift_x_west.HandleLeft != null) { requestList.Remove(Shift_x_west.HandleLeft); } //if (Shift_x_west.HandleRight != null) // requestList.Remove(Shift_x_west.HandleRight); Shift_x_west.initiate_send(); requestList.Add(Shift_x_west.HandleLeft); //requestList.Add(Shift_x_west.HandleRight); }
public void DeleteRequest(Request request) { lock (RequestList) { RequestList.Remove(request); } }