X ChatRoom提供兩個方法處理到達的事件。request處理來到的請求,每個請求都有參數clientID和roomID。ChatRoom把接收或拒絕通知發回擁有全局ID標識clientID的發送者。它也使用參數roomID來決定請求是發給它自己還是發給另外一個聊天室了1。send方法接收由客戶clientID發送的消息msg。這條msg將會在一秒鐘之后被廣播出去。
X Client的方法accept和reject處理到達的接收和拒絕通知。參數clientID用來確定目標客戶。當一個Client接收到一個broadcast事件,它會檢查自己是否在clients集合中。假如情況確實如此,消息msg就會在輸出中被打印出來。
X Manager中繼連接請求、接收和拒絕通知、來自客戶的消息以及聊天室的廣播。例如,假如它收到來自聊天室的廣播,有三個參數會告訴它消息最初的發送者(客戶),廣播者(聊天室)以及消息字符串。然后它把消息發給所有連接在聊天室中的,除了最初發送者以外的客戶。
[1] D. Harel and R. Marelly. Specifying and executing behavioral requirements: The play-in/play-out approach. Technical Report MSC01-15, The Weizmann Institute of Science, 2001.
[2] Thomas Feng. An extended semantics for a Statechart Virtual Machine. In A. Bruzzone and hamed Itmi, editors, Summer Computer Simulation Conference. Student Workshop, pages S147 ? S166. The Society for Computer Modelling and Simulation, July 2003. Montr′eal, Canada.
[4] David Harel and Amnon Naamad. The STATEMATE semantics of statecharts. ACM Transactions on Software Engineering and Methodology, 5(4):293?333, 1996.
[5] Python 2.2.3 documentation, May 2003. http://www.python.org/doc/2.2.3/.
[6] David Harel. Statecharts: A visual formalism for complex systems. Science of Computer Programming, 8(3):231?274, June 1987.
[7] Michael von der Beeck. A strUCtured Operational semantics for UML statecharts. Software and Systems Modeling, 1(2), 2002.
[8] Jim Rumbaugh, Ivar Jacobson, and Grady Booch. The Unified Modeling Language Reference Manual. Addison-Wesley, 1998.