10.07.2015 Views

pdf - 395 K - Ecole des mines de Nantes

pdf - 395 K - Ecole des mines de Nantes

pdf - 395 K - Ecole des mines de Nantes

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}Monitor.Exit(aLock);public overri<strong>de</strong> bool Equals(object obj){if (obj == null || !(obj is Conversation)) return false;Conversation peer = (Conversation) obj;return this.i<strong>de</strong>ntifier.Equals(peer.i<strong>de</strong>ntifier);}/// /// Returns whether a reply is expected in the context of this./// True only after an AsyncSend until Reply becomes not null./// public bool IsExpectingReply{get{lock (aLock) {return expectingMessage;}}}public overri<strong>de</strong> int GetHashCo<strong>de</strong>(){return i<strong>de</strong>ntifier.GetHashCo<strong>de</strong>();}/// /// Gets a clone to send and updates states of clone and this./// /// private Conversation GetUpdatedClone(){// Clone because can be used by local peer AgentConversation clone = (Conversation)this.Clone();if (currentState == States.JUST_CREATED){clone.currentState = States.NOT_INITIATED;this.currentState = States.INITIATED;}else if (currentState == States.NOT_INITIATED){clone.currentState = States.INITIATED;this.currentState = States.INITIATED;} // If state = INITIATED or CLOSED than keep statereturn clone;}AsyncSend./// /// Called by event MessageArrived in MessageQueue after an/// /// private void HandleAsyncNotification(Message m){Monitor.Enter(aLock);if (this.AppliesTo(m)){asyncReply = m;agent.MessageArrived -= asyncHandler;agent = null;MSc EMOOSE Thesis – http://www.emn.fr/EMOOSE 93

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!