2 # Generated python file of Graph SyrStruct
6 SyrStruct = Graph( 'SyrStruct' )
7 SyrStruct.SetName( 'SyrStruct' )
8 SyrStruct.SetAuthor( 'JR' )
9 SyrStruct.SetComment( 'Syracuse algorithm' )
10 SyrStruct.Coords( 0 , 0 )
12 # Creation of Factory Nodes
14 m3 = SyrStruct.FNode( 'SyrComponent' , 'SyrComponent' , 'C_M3' )
17 m3.SetContainer( 'localhost/FactoryServer' )
18 m3.SetComment( 'C_M3 from SyrComponent' )
21 m3incr = SyrStruct.FNode( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
22 m3incr.SetName( 'm3incr' )
23 m3incr.SetAuthor( '' )
24 m3incr.SetContainer( 'localhost/FactoryServer' )
25 m3incr.SetComment( 'C_INCR from SyrComponent' )
26 m3incr.Coords( 898 , 29 )
28 incra = SyrStruct.FNode( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
29 incra.SetName( 'incra' )
31 incra.SetContainer( 'localhost/FactoryServer' )
32 incra.SetComment( 'C_INCR from SyrComponent' )
33 incra.Coords( 803 , 195 )
35 div2 = SyrStruct.FNode( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' )
36 div2.SetName( 'div2' )
38 div2.SetContainer( 'localhost/FactoryServer' )
39 div2.SetComment( 'C_DIV2 from SyrComponent' )
40 div2.Coords( 810 , 435 )
42 incrb = SyrStruct.FNode( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
43 incrb.SetName( 'incrb' )
45 incrb.SetContainer( 'localhost/FactoryServer' )
46 incrb.SetComment( 'C_INCR from SyrComponent' )
47 incrb.Coords( 809 , 574 )
49 # Creation of InLine Nodes
51 PySyrComponent.append( 'from LifeCycleCORBA import * ' )
52 PySyrComponent.append( 'def SyrComponent( aContainer , aComponent ) : ' )
53 PySyrComponent.append( ' orb = CORBA.ORB_init([], CORBA.ORB_ID) ' )
54 PySyrComponent.append( ' lcc = LifeCycleCORBA(orb) ' )
55 PySyrComponent.append( ' ComponentRef = lcc.FindOrLoadComponent( aContainer , aComponent ) ' )
56 PySyrComponent.append( ' return ComponentRef ' )
57 SyrComponent = SyrStruct.INode( 'SyrComponent' , PySyrComponent )
58 SyrComponent.SetName( 'SyrComponent' )
59 SyrComponent.SetAuthor( '' )
60 SyrComponent.SetComment( 'SyrComponent( aContainer , aComponent )' )
61 SyrComponent.Coords( 0 , 0 )
62 SyrComponent.InPort( 'aContainer' , 'string' )
63 SyrComponent.InPort( 'aComponent' , 'string' )
64 SyrComponent.OutPort( 'SyrComponentobjref' , 'objref' )
66 # Creation of Loop Nodes
68 PyforN.append( 'def InitN( NN , K , SyrComponent , min , max ) : ' )
69 PyforN.append( ' N = max ' )
70 PyforN.append( ' if min > 0 : ' )
71 PyforN.append( ' if max >= min : ' )
72 PyforN.append( ' N = min ' )
73 PyforN.append( ' return N,K,SyrComponent,min,max ' )
75 PyMoreforN.append( 'def MoreN( NN , KK , SyrComponent , min , max ) : ' )
76 PyMoreforN.append( ' N = NN ' )
77 PyMoreforN.append( ' OutLoop = 0 ' )
78 PyMoreforN.append( ' if max > NN : ' )
79 PyMoreforN.append( ' OutLoop = 1 ' )
80 PyMoreforN.append( ' return OutLoop,N,0,SyrComponent,min,max ' )
82 PyNextforN.append( 'def NextN( NN , KK , SyrComponent , min , max ) : ' )
83 PyNextforN.append( ' N = NN + 1 ' )
84 PyNextforN.append( ' K = KK ' )
85 PyNextforN.append( ' return N,K,SyrComponent,min,max ' )
86 forN,EndOfforN = SyrStruct.LNode( 'InitN' , PyforN , 'MoreN' , PyMoreforN , 'NextN' , PyNextforN )
87 EndOfforN.SetName( 'EndOfforN' )
88 EndOfforN.SetAuthor( '' )
89 EndOfforN.SetComment( '' )
90 EndOfforN.Coords( 1535 , 332 )
91 forN.SetName( 'forN' )
93 forN.SetComment( 'InitN , MoreN , NextN' )
94 forN.Coords( 20 , 302 )
95 forN.InPort( 'N' , 'long' )
96 forN.InPort( 'K' , 'long' )
97 forN.InPort( 'SyrComponent' , 'objref' )
98 forN.InPort( 'min' , 'long' )
99 forN.InPort( 'max' , 'long' )
100 forN.OutPort( 'N' , 'long' )
101 forN.OutPort( 'K' , 'long' )
102 forN.OutPort( 'SyrComponent' , 'objref' )
103 forN.OutPort( 'min' , 'long' )
104 forN.OutPort( 'max' , 'long' )
107 PywhileNotOne.append( 'import threading' )
108 PywhileNotOne.append( 'import SyrComponent_idl' )
109 PywhileNotOne.append( 'def InitNotOne( SyrComponent , N , K ) :' )
110 PywhileNotOne.append( ' return SyrComponent,N,K' )
111 PyMorewhileNotOne = []
112 PyMorewhileNotOne.append( 'import SyrComponent_idl' )
113 PyMorewhileNotOne.append( 'def MoreNotOne( SyrComponent , N , K ) :' )
114 PyMorewhileNotOne.append( ' OutLoop = 1 - SyrComponent.C_ISONE( N )' )
115 PyMorewhileNotOne.append( ' return OutLoop,SyrComponent,N,K ' )
116 PyNextwhileNotOne = []
117 PyNextwhileNotOne.append( 'import SyrComponent_idl' )
118 PyNextwhileNotOne.append( 'def NextNotOne( SyrComponent , N , K ) :' )
119 PyNextwhileNotOne.append( ' return SyrComponent,N,K' )
120 whileNotOne,EndOfwhileNotOne = SyrStruct.LNode( 'InitNotOne' , PywhileNotOne , 'MoreNotOne' , PyMorewhileNotOne , 'NextNotOne' , PyNextwhileNotOne )
121 EndOfwhileNotOne.SetName( 'EndOfwhileNotOne' )
122 EndOfwhileNotOne.SetAuthor( '' )
123 EndOfwhileNotOne.SetComment( '' )
124 EndOfwhileNotOne.Coords( 1366 , 303 )
125 whileNotOne.SetName( 'whileNotOne' )
126 whileNotOne.SetAuthor( '' )
127 whileNotOne.SetComment( 'InitNotOne , MoreNotOne , NextNotOne' )
128 whileNotOne.Coords( 212 , 274 )
129 whileNotOne.InPort( 'SyrComponent' , 'objref' )
130 whileNotOne.InPort( 'N' , 'long' )
131 whileNotOne.InPort( 'K' , 'long' )
132 whileNotOne.OutPort( 'SyrComponent' , 'objref' )
133 whileNotOne.OutPort( 'N' , 'long' )
134 whileNotOne.OutPort( 'K' , 'long' )
137 Pyfori.append( 'def Initfori( ii , K ) :' )
138 Pyfori.append( ' return 1,0,K' )
140 PyMorefori.append( 'def Morefori( ii , K ) :' )
141 PyMorefori.append( ' OutLoop = 0' )
142 PyMorefori.append( ' if 2 > ii :' )
143 PyMorefori.append( ' OutLoop = 1' )
144 PyMorefori.append( ' return OutLoop,ii,K' )
146 PyNextfori.append( 'def Nextfori( ii , K ) :' )
147 PyNextfori.append( ' ii = ii + 1' )
148 PyNextfori.append( ' return ii,K' )
149 fori,EndOffori = SyrStruct.LNode( 'Initfori' , Pyfori , 'Morefori' , PyMorefori , 'Nextfori' , PyNextfori )
150 EndOffori.SetName( 'EndOffori' )
151 EndOffori.SetAuthor( '' )
152 EndOffori.SetComment( '' )
153 EndOffori.Coords( 976 , 212 )
154 fori.SetName( 'fori' )
156 fori.SetComment( 'Initfori, Morefori, Nextfori' )
157 fori.Coords( 635 , 212 )
158 fori.InPort( 'i' , 'long' )
159 fori.InPort( 'K' , 'long' )
160 fori.OutPort( 'i' , 'long' )
161 fori.OutPort( 'K' , 'long' )
164 PywhileEven.append( 'import SyrComponent_idl' )
165 PywhileEven.append( 'def InitEven( SyrComponent , N , K ) :' )
166 PywhileEven.append( ' return SyrComponent,N,K' )
168 PyMorewhileEven.append( 'import SyrComponent_idl' )
169 PyMorewhileEven.append( 'def MoreEven( SyrComponent , N , K ) :' )
170 PyMorewhileEven.append( ' OutLoop = SyrComponent.C_ISEVEN( N )' )
171 PyMorewhileEven.append( ' return OutLoop,SyrComponent,N,K ' )
173 PyNextwhileEven.append( 'import SyrComponent_idl' )
174 PyNextwhileEven.append( 'def NextEven( SyrComponent , N , K ) :' )
175 PyNextwhileEven.append( ' return SyrComponent,N,K' )
176 whileEven,EndOfwhileEven = SyrStruct.LNode( 'InitEven' , PywhileEven , 'MoreEven' , PyMorewhileEven , 'NextEven' , PyNextwhileEven )
177 EndOfwhileEven.SetName( 'EndOfwhileEven' )
178 EndOfwhileEven.SetAuthor( '' )
179 EndOfwhileEven.SetComment( '' )
180 EndOfwhileEven.Coords( 988 , 451 )
181 whileEven.SetName( 'whileEven' )
182 whileEven.SetAuthor( '' )
183 whileEven.SetComment( 'InitEven, MoreEven, NextEven' )
184 whileEven.Coords( 632 , 451 )
185 whileEven.InPort( 'SyrComponent' , 'objref' )
186 whileEven.InPort( 'N' , 'long' )
187 whileEven.InPort( 'K' , 'long' )
188 whileEven.OutPort( 'SyrComponent' , 'objref' )
189 whileEven.OutPort( 'N' , 'long' )
190 whileEven.OutPort( 'K' , 'long' )
192 # Creation of Switch Nodes
194 PyifNotEven.append( 'import SyrComponent_idl' )
195 PyifNotEven.append( 'def ifNotEven( SyrComponent , N , K ) :' )
196 PyifNotEven.append( ' Even = SyrComponent.C_ISEVEN( N )' )
197 PyifNotEven.append( ' Odd = 1 - Even' )
198 PyifNotEven.append( ' return Odd,Even,SyrComponent,N,K' )
199 ifNotEven,EndOfifNotEven = SyrStruct.SNode( 'ifNotEven' , PyifNotEven )
200 EndOfifNotEven.SetName( 'EndOfifNotEven' )
201 EndOfifNotEven.SetAuthor( '' )
202 EndOfifNotEven.SetComment( '' )
203 EndOfifNotEven.Coords( 1205 , 331 )
204 PyEndOfifNotEven = []
205 EndOfifNotEven.SetPyFunction( 'EndifNotEven' , PyEndOfifNotEven )
206 EndOfifNotEven.InPort( 'N' , 'long' )
207 EndOfifNotEven.InPort( 'K' , 'long' )
208 EndOfifNotEven.OutPort( 'N' , 'long' )
209 EndOfifNotEven.OutPort( 'K' , 'long' )
210 ifNotEven.SetName( 'ifNotEven' )
211 ifNotEven.SetAuthor( '' )
212 ifNotEven.SetComment( 'ifNotEven' )
213 ifNotEven.Coords( 418 , 274 )
214 ifNotEven.InPort( 'SyrComponent' , 'objref' )
215 ifNotEven.InPort( 'N' , 'long' )
216 ifNotEven.InPort( 'K' , 'long' )
217 ifNotEven.OutPort( 'Odd' , 'long' )
218 ifNotEven.OutPort( 'Even' , 'long' )
219 ifNotEven.OutPort( 'SyrComponent' , 'objref' )
220 ifNotEven.OutPort( 'N' , 'long' )
221 ifNotEven.OutPort( 'K' , 'long' )
224 m3anInteger = m3.Port( 'anInteger' )
225 m3incraCount = SyrStruct.Link( m3anInteger , m3incr.Port( 'aCount' ) )
227 m3incraNewCount = m3incr.Port( 'aNewCount' )
228 EndOfifNotEvenN = SyrStruct.Link( m3incraNewCount , EndOfifNotEven.Port( 'N' ) )
229 EndOfifNotEvenN.AddCoord( 1 , 1190 , 366 )
230 EndOfifNotEvenN.AddCoord( 2 , 1191 , 109 )
232 incraaNewCount = incra.Port( 'aNewCount' )
233 EndOfforiK = SyrStruct.Link( incraaNewCount , EndOffori.Port( 'K' ) )
235 div2anInteger = div2.Port( 'anInteger' )
236 EndOfwhileEvenN = SyrStruct.Link( div2anInteger , EndOfwhileEven.Port( 'N' ) )
238 incrbaNewCount = incrb.Port( 'aNewCount' )
239 EndOfwhileEvenK = SyrStruct.Link( incrbaNewCount , EndOfwhileEven.Port( 'K' ) )
240 EndOfwhileEvenK.AddCoord( 1 , 988 , 543 )
241 EndOfwhileEvenK.AddCoord( 2 , 988 , 654 )
243 SyrComponentSyrComponentobjref = SyrComponent.Port( 'SyrComponentobjref' )
244 forNSyrComponent = SyrStruct.Link( SyrComponentSyrComponentobjref , forN.Port( 'SyrComponent' ) )
245 forNSyrComponent.AddCoord( 1 , 13 , 394 )
246 forNSyrComponent.AddCoord( 2 , 12 , 181 )
247 forNSyrComponent.AddCoord( 3 , 196 , 181 )
248 forNSyrComponent.AddCoord( 4 , 197 , 81 )
250 forNN = forN.Port( 'N' )
251 whileNotOneN = SyrStruct.Link( forNN , whileNotOne.Port( 'N' ) )
253 EndOfforNN = SyrStruct.Link( forNN , EndOfforN.Port( 'N' ) )
255 forNK = forN.Port( 'K' )
256 whileNotOneK = SyrStruct.Link( forNK , whileNotOne.Port( 'K' ) )
258 forNSyrComponent = forN.Port( 'SyrComponent' )
259 EndOfforNSyrComponent = SyrStruct.Link( forNSyrComponent , EndOfforN.Port( 'SyrComponent' ) )
261 whileNotOneSyrComponent = SyrStruct.Link( forNSyrComponent , whileNotOne.Port( 'SyrComponent' ) )
262 whileNotOneSyrComponent.AddCoord( 1 , 192 , 309 )
263 whileNotOneSyrComponent.AddCoord( 2 , 191 , 394 )
265 forNmin = forN.Port( 'min' )
266 EndOfforNmin = SyrStruct.Link( forNmin , EndOfforN.Port( 'min' ) )
268 forNmax = forN.Port( 'max' )
269 EndOfforNmax = SyrStruct.Link( forNmax , EndOfforN.Port( 'max' ) )
271 whileNotOneSyrComponent = whileNotOne.Port( 'SyrComponent' )
272 EndOfwhileNotOneSyrComponent = SyrStruct.Link( whileNotOneSyrComponent , EndOfwhileNotOne.Port( 'SyrComponent' ) )
274 ifNotEvenSyrComponent = SyrStruct.Link( whileNotOneSyrComponent , ifNotEven.Port( 'SyrComponent' ) )
276 whileNotOneN = whileNotOne.Port( 'N' )
277 ifNotEvenN = SyrStruct.Link( whileNotOneN , ifNotEven.Port( 'N' ) )
279 whileNotOneK = whileNotOne.Port( 'K' )
280 ifNotEvenK = SyrStruct.Link( whileNotOneK , ifNotEven.Port( 'K' ) )
282 EndOfwhileNotOneK = EndOfwhileNotOne.Port( 'K' )
283 EndOfforNK = SyrStruct.Link( EndOfwhileNotOneK , EndOfforN.Port( 'K' ) )
285 forii = fori.Port( 'i' )
286 EndOfforii = SyrStruct.Link( forii , EndOffori.Port( 'i' ) )
288 foriK = fori.Port( 'K' )
289 incraaCount = SyrStruct.Link( foriK , incra.Port( 'aCount' ) )
291 EndOfforiK = EndOffori.Port( 'K' )
292 EndOfifNotEvenK = SyrStruct.Link( EndOfforiK , EndOfifNotEven.Port( 'K' ) )
293 EndOfifNotEvenK.AddCoord( 1 , 1170 , 396 )
294 EndOfifNotEvenK.AddCoord( 2 , 1169 , 275 )
296 whileEvenSyrComponent = whileEven.Port( 'SyrComponent' )
297 EndOfwhileEvenSyrComponent = SyrStruct.Link( whileEvenSyrComponent , EndOfwhileEven.Port( 'SyrComponent' ) )
299 whileEvenN = whileEven.Port( 'N' )
300 div2anEvenInteger = SyrStruct.Link( whileEvenN , div2.Port( 'anEvenInteger' ) )
302 whileEvenK = whileEven.Port( 'K' )
303 incrbaCount = SyrStruct.Link( whileEvenK , incrb.Port( 'aCount' ) )
304 incrbaCount.AddCoord( 1 , 796 , 655 )
305 incrbaCount.AddCoord( 2 , 795 , 543 )
307 EndOfwhileEvenN = EndOfwhileEven.Port( 'N' )
308 EndOfifNotEvenN = SyrStruct.Link( EndOfwhileEvenN , EndOfifNotEven.Port( 'N' ) )
309 EndOfifNotEvenN.AddCoord( 1 , 1191 , 366 )
310 EndOfifNotEvenN.AddCoord( 2 , 1191 , 513 )
312 EndOfwhileEvenK = EndOfwhileEven.Port( 'K' )
313 EndOfifNotEvenK = SyrStruct.Link( EndOfwhileEvenK , EndOfifNotEven.Port( 'K' ) )
314 EndOfifNotEvenK.AddCoord( 1 , 1169 , 395 )
315 EndOfifNotEvenK.AddCoord( 2 , 1170 , 543 )
317 ifNotEvenOdd = ifNotEven.Port( 'Odd' )
318 m3InGate = SyrStruct.Link( ifNotEvenOdd , m3.Port( 'InGate' ) )
319 m3InGate.AddCoord( 1 , 593 , 141 )
320 m3InGate.AddCoord( 2 , 593 , 307 )
322 foriInGate = SyrStruct.Link( ifNotEvenOdd , fori.Port( 'InGate' ) )
324 ifNotEvenEven = ifNotEven.Port( 'Even' )
325 whileEvenInGate = SyrStruct.Link( ifNotEvenEven , whileEven.Port( 'InGate' ) )
326 whileEvenInGate.AddCoord( 1 , 593 , 576 )
327 whileEvenInGate.AddCoord( 2 , 592 , 339 )
329 ifNotEvenSyrComponent = ifNotEven.Port( 'SyrComponent' )
330 whileEvenSyrComponent = SyrStruct.Link( ifNotEvenSyrComponent , whileEven.Port( 'SyrComponent' ) )
331 whileEvenSyrComponent.AddCoord( 1 , 586 , 486 )
332 whileEvenSyrComponent.AddCoord( 2 , 587 , 367 )
334 ifNotEvenN = ifNotEven.Port( 'N' )
335 whileEvenN = SyrStruct.Link( ifNotEvenN , whileEven.Port( 'N' ) )
336 whileEvenN.AddCoord( 1 , 604 , 513 )
337 whileEvenN.AddCoord( 2 , 603 , 397 )
339 m3anOddInteger = SyrStruct.Link( ifNotEvenN , m3.Port( 'anOddInteger' ) )
340 m3anOddInteger.AddCoord( 1 , 604 , 107 )
341 m3anOddInteger.AddCoord( 2 , 604 , 395 )
343 ifNotEvenK = ifNotEven.Port( 'K' )
344 whileEvenK = SyrStruct.Link( ifNotEvenK , whileEven.Port( 'K' ) )
345 whileEvenK.AddCoord( 1 , 621 , 544 )
346 whileEvenK.AddCoord( 2 , 622 , 426 )
348 foriK = SyrStruct.Link( ifNotEvenK , fori.Port( 'K' ) )
349 foriK.AddCoord( 1 , 622 , 275 )
350 foriK.AddCoord( 2 , 622 , 426 )
352 ifNotEvenDefault = ifNotEven.Port( 'Default' )
353 EndOfifNotEvenDefault = SyrStruct.Link( ifNotEvenDefault , EndOfifNotEven.Port( 'Default' ) )
354 EndOfifNotEvenDefault.AddCoord( 1 , 1204 , 429 )
355 EndOfifNotEvenDefault.AddCoord( 2 , 1203 , 12 )
356 EndOfifNotEvenDefault.AddCoord( 3 , 581 , 13 )
357 EndOfifNotEvenDefault.AddCoord( 4 , 581 , 458 )
359 EndOfifNotEvenN = EndOfifNotEven.Port( 'N' )
360 EndOfwhileNotOneN = SyrStruct.Link( EndOfifNotEvenN , EndOfwhileNotOne.Port( 'N' ) )
362 EndOfifNotEvenK = EndOfifNotEven.Port( 'K' )
363 EndOfwhileNotOneK = SyrStruct.Link( EndOfifNotEvenK , EndOfwhileNotOne.Port( 'K' ) )
365 # Creation of Input datas
366 SyrComponentaContainer = SyrComponent.Input( 'aContainer' , 'FactoryServer')
367 SyrComponentaComponent = SyrComponent.Input( 'aComponent' , 'SyrComponent')
368 forNN = forN.Input( 'N' , 0)
370 forNK = forN.Input( 'K' , 0)
371 forNmin = forN.Input( 'min' , 5)
372 forNmax = forN.Input( 'max' , 9)
373 forii = fori.Input( 'i' , 0)
375 # Creation of Output variables
376 EndOfforNN = EndOfforN.Port( 'N' )
377 EndOfforNK = EndOfforN.Port( 'K' )
378 EndOfforNSyrComponent = EndOfforN.Port( 'SyrComponent' )
379 EndOfforNmin = EndOfforN.Port( 'min' )
380 EndOfforNmax = EndOfforN.Port( 'max' )
381 EndOfwhileNotOneSyrComponent = EndOfwhileNotOne.Port( 'SyrComponent' )
382 EndOfwhileNotOneN = EndOfwhileNotOne.Port( 'N' )
383 EndOfforii = EndOffori.Port( 'i' )
384 EndOfwhileEvenSyrComponent = EndOfwhileEven.Port( 'SyrComponent' )
390 print SyrStruct.State()
392 SyrStruct.PrintPorts()
394 SyrStruct.Export( '/tmp/SyrStruct.xml' )
396 SyrStruct = Graph( '/tmp/SyrStruct.xml' )
402 print SyrStruct.State()