Input: 𝑓 𝑟 𝑎 𝑔 𝑚 𝑒 𝑛 𝑡 𝐼 𝑑 : Fragment, a tag indicating the type of fragment
    𝑐 𝑢 𝑟 𝑁 𝑜 𝑑 𝑒 𝐴
Output: 𝑒 𝑥 𝑖 𝑡 𝑁 𝑜 𝑑 𝑒 𝐴
1:While ! End Offragment do // end of current fragment
2:   𝑥 = 𝐺 𝑒 𝑡 𝑁 𝑒 𝑥 𝑡 𝐸 𝑙 𝑒 𝑚 𝑒 𝑛 𝑡 ( ) ;   // Read the next element
   in the fragment
3:  if 𝑥 = 𝐸 𝑂 𝐹 then // Termination condition
4:   𝑒 𝑥 𝑖 𝑡 𝑁 𝑜 𝑑 𝑒 = 𝑐 𝑢 𝑟 𝑁 𝑜 𝑑 𝑒 ;
5:  return 𝑒 𝑥 𝑖 𝑡 𝑁 𝑜 𝑑 𝑒
6:  end if
7:  case: 𝑥 = 𝑚 𝑒 𝑠 𝑠 𝑎 𝑔 𝑒     // 𝑥 is a message element
8:    InsertAtPos ( 𝑖 , 𝑥 , 𝐿 ) ;
9:    x = GetNextElement();
10:  while 𝑥 = 𝑚 𝑒 𝑠 𝑠 𝑎 𝑔 𝑒 do
11:     InsertAtPos ( 𝑖 + 1 , 𝑥 , 𝐿 ) ;
12:     x = GetNextElement();
13:  end while
14:  if 𝑥 ! = 𝑚 𝑒 𝑠 𝑠 𝑎 𝑔 𝑒 then
15:      unread(x); break;
16:  end if
17:   𝐵 𝑁 = 𝐶 𝑟 𝑒 𝑎 𝑡 𝑒 𝐵 𝑙 𝑜 𝑐 𝑘 𝑁 𝑜 𝑑 𝑒 ( 𝐿 )    // Create a block
  node, 𝐵 𝑁 with block of messages in partial order 𝑂 ;
18:    ConnectEdge ( 𝑐 𝑢 𝑟 𝑁 𝑜 𝑑 𝑒 , 𝐵 𝑁 ) ;   // Edge from
   𝑐 𝑢 𝑟 𝑁 𝑜 𝑑 𝑒 to the next node 𝐵 𝑁
19:    𝑐 𝑢 𝑟 𝑁 𝑜 𝑑 𝑒 = 𝐵 𝑁 ;
20:  end case;
21:  case: 𝑥 = 𝑙 𝑜 𝑜 𝑝      // 𝑥 is a loop fragment
22:        𝐷 𝑁 = 𝐶 𝑟 𝑒 𝑎 𝑡 𝑒 𝐷 𝑒 𝑐 𝑖 𝑠 𝑖 𝑜 𝑛 𝑁 𝑜 𝑑 𝑒 ( 𝑥 . 𝑔 𝑢 𝑎 𝑟 𝑑 )
         // Create decision node with predicate
      𝑔 𝑢 𝑎 𝑟 𝑑 in 𝑥 ;
23:       ConnectEdge ( 𝑐 𝑢 𝑟 𝑁 𝑜 𝑑 𝑒 , 𝐷 𝑁 ) ;
24:        𝑦 = 𝑃 𝑟 𝑜 𝑐 𝑒 𝑠 𝑠 𝐹 𝑟 𝑎 𝑔 𝑚 𝑒 𝑛 𝑡 ( 𝑥 , 𝐷 𝑁 . 𝑇 𝑅 𝑈 𝐸 ) ;
25:       ConnectEdge ( 𝑦 , 𝐷 𝑁 ) ;     // Create back edge
26:        𝑐 𝑢 𝑟 𝑁 𝑜 𝑑 𝑒 = 𝐷 𝑁 . 𝐹 𝐴 𝐿 𝑆 𝐸 ;      // Out edge
      from decision node
27:    end case;
28:    case: 𝑥 = 𝑜 𝑝 𝑡      // 𝑥 is an opt fragment
29:       𝐷 𝑁    =    𝐶 𝑟 𝑒 𝑎 𝑡 𝑒 𝐷 𝑒 𝑐 𝑖 𝑠 𝑖 𝑜 𝑛 𝑁 𝑜 𝑑 𝑒 ( 𝑥 . 𝑔 𝑢 𝑎 𝑟 𝑑 )
         // Create decision node with predicate
      𝑔 𝑢 𝑎 𝑟 𝑑 in 𝑥 ;
30:       ConnectEdge ( 𝑐 𝑢 𝑟 𝑁 𝑜 𝑑 𝑒 , 𝐷 𝑁 ) ;
31:        𝑦 = 𝑃 𝑟 𝑜 𝑐 𝑒 𝑠 𝑠 𝐹 𝑟 𝑎 𝑔 𝑚 𝑒 𝑛 𝑡 ( 𝑥 , 𝐷 𝑁 . 𝑇 𝑅 𝑈 𝐸 ) ;
32:        𝑀 𝑁 = 𝐶 𝑟 𝑒 𝑎 𝑡 𝑒 𝑀 𝑒 𝑟 𝑔 𝑒 𝑁 𝑜 𝑑 𝑒 ( ) ;
33:       ConnectEdge ( 𝐷 𝑁 . 𝐹 𝐴 𝐿 𝑆 𝐸 , 𝑀 𝑁 ) ;
34:       ConnectEdge ( 𝑦 , 𝑀 𝑁 ) ;
35:        𝑐 𝑢 𝑟 𝑁 𝑜 𝑑 𝑒 = 𝑀 𝑁 ;
36:    end case;
37:    case: 𝑥 = 𝑏 𝑟 𝑒 𝑎 𝑘      // 𝑥 is a break fragment
38:       𝐷 𝑁    =    𝐶 𝑟 𝑒 𝑎 𝑡 𝑒 𝐷 𝑒 𝑐 𝑖 𝑠 𝑖 𝑜 𝑛 𝑁 𝑜 𝑑 𝑒 ( 𝑥 . 𝑔 𝑢 𝑎 𝑟 𝑑 )
         // Create decision node with predicate
      𝑔 𝑢 𝑎 𝑟 𝑑 in 𝑥 ;
39:       ConnectEdge ( 𝑐 𝑢 𝑟 𝑁 𝑜 𝑑 𝑒 , 𝐷 𝑁 ) ;
40:        𝑦 = 𝑃 𝑟 𝑜 𝑐 𝑒 𝑠 𝑠 𝐹 𝑟 𝑎 𝑔 𝑚 𝑒 𝑛 𝑡 ( 𝑥 , 𝐷 𝑁 . 𝑇 𝑅 𝑈 𝐸 ) ;
41:        𝑓 𝑛 = 𝐶 𝑟 𝑒 𝑎 𝑡 𝑒 𝐹 𝑖 𝑛 𝑎 𝑙 𝑁 𝑜 𝑑 𝑒 ( ) ;
42:       ConnectEdge ( 𝑦 , 𝑓 𝑛 ) ;
43:        𝑐 𝑢 𝑟 𝑁 𝑜 𝑑 𝑒 = 𝐷 𝑁 . 𝐹 𝐴 𝐿 𝑆 𝐸 ;
44:    end case;
45:    case: 𝑥 = 𝑎 𝑙 𝑡      // 𝑥 is an alt fragment
46:       𝐷 𝑁 = 𝐶 𝑟 𝑒 𝑎 𝑡 𝑒 𝐷 𝑒 𝑐 𝑖 𝑠 𝑖 𝑜 𝑛 𝑁 𝑜 𝑑 𝑒 ( 𝑛 𝑖 𝑙 )      //
      Create decision node with multioperands;
47:       ConnectEdge ( 𝑐 𝑢 𝑟 𝑁 𝑜 𝑑 𝑒 , 𝐷 𝑁 ) ;
48:        𝑀 𝑁 = 𝐶 𝑟 𝑒 𝑎 𝑡 𝑒 𝑀 𝑒 𝑟 𝑔 𝑒 𝑁 𝑜 𝑑 𝑒 ( ) ;
49:       for 𝑒 𝑎 𝑐 𝑜 𝑝 𝑒 𝑟 𝑎 𝑛 𝑑 𝑜 𝑝 𝑑 𝑖 𝑥
50:            𝑒 𝑖 = 𝑔 𝑢 𝑎 𝑟 𝑑 ( 𝑜 𝑝 𝑑 𝑖 ) ;
51:            𝑦 = 𝑃 𝑟 𝑜 𝑐 𝑒 𝑠 𝑠 𝐹 𝑟 𝑎 𝑔 𝑚 𝑒 𝑛 𝑡 ( 𝑜 𝑝 𝑑 𝑖 , 𝐷 𝑁 . 𝑒 𝑖 ) ;
52:           ConnectEdge ( 𝑦 , 𝑀 𝑁 ) ;
53:       end for
54:        𝑐 𝑢 𝑟 𝑁 𝑜 𝑑 𝑒 = 𝑀 𝑁 ;
55:    end case;
56:    case: 𝑥 = 𝑝 𝑎 𝑟      // 𝑥 is a par fragment
57:        𝐹 𝑁 = 𝐶 𝑟 𝑒 𝑎 𝑡 𝑒 𝐹 𝑜 𝑟 𝑘 𝑁 𝑜 𝑑 𝑒 ( )      //Create fork
      node;
58:       ConnectEdge ( 𝑐 𝑢 𝑟 𝑁 𝑜 𝑑 𝑒 , 𝐹 𝑁 ) ;
59:        𝐽 𝑁 = 𝐶 𝑟 𝑒 𝑎 𝑡 𝑒 𝐽 𝑜 𝑖 𝑛 𝑁 𝑜 𝑑 𝑒 ( ) ;
60:       for   𝑒 𝑎 𝑐 𝑜 𝑝 𝑒 𝑟 𝑎 𝑛 𝑑 𝑜 𝑝 𝑑 𝑖 𝑥
61:            𝑦 = 𝑃 𝑟 𝑜 𝑐 𝑒 𝑠 𝑠 𝐹 𝑟 𝑎 𝑔 𝑚 𝑒 𝑛 𝑡 ( 𝑜 𝑝 𝑑 𝑖 , 𝐹 𝑁 ) ;
62:           ConnectEdge ( 𝑦 , 𝐽 𝑁 ) ;
63:       end for
64:        𝑐 𝑢 𝑟 𝑁 𝑜 𝑑 𝑒 = 𝐽 𝑁 ;
65:    end case;
66:end while
67:exitNode = curNode;
68:return 𝑒 𝑥 𝑖 𝑡 𝑁 𝑜 𝑑 𝑒
Function ProcessFragment ( 𝐹 𝑟 𝑎 𝑔 𝑚 𝑒 𝑛 𝑡 , 𝐴 )
Algorithm 1: Function ProcessFragment (Fragment: fragmentId, A: curNode).