2 # Generated python file of Graph GraphSyrControlGUI
6 GraphSyrControl1 = Graph( 'GraphSyrControl1' )
7 GraphSyrControl1.SetName( 'GraphSyrControl1' )
8 GraphSyrControl1.SetAuthor( 'JR' )
9 GraphSyrControl1.SetComment( 'Syracuse algorithm' )
10 GraphSyrControl1.Coords( 0 , 0 )
12 # Creation of Factory Nodes
14 test_ISEVEN = GraphSyrControl1.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' )
15 test_ISEVEN.SetName( 'test_ISEVEN' )
16 test_ISEVEN.SetAuthor( '' )
17 test_ISEVEN.SetContainer( 'localhost/FactoryServer' )
18 test_ISEVEN.SetComment( 'C_ISEVEN from SyrComponent' )
19 test_ISEVEN.Coords( 190 , 338 )
21 test_ISONE = GraphSyrControl1.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' )
22 test_ISONE.SetName( 'test_ISONE' )
23 test_ISONE.SetAuthor( '' )
24 test_ISONE.SetContainer( 'localhost/FactoryServer' )
25 test_ISONE.SetComment( 'C_ISONE from SyrComponent' )
26 test_ISONE.Coords( 196 , 131 )
28 m3p1 = GraphSyrControl1.FNode( 'SyrComponent' , 'SyrComponent' , 'C_M3P1' )
29 m3p1.SetName( 'm3p1' )
31 m3p1.SetContainer( 'localhost/FactoryServer' )
32 m3p1.SetComment( 'C_M3P1 from SyrComponent' )
33 m3p1.Coords( 615 , 30 )
35 div2 = GraphSyrControl1.FNode( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' )
36 div2.SetName( 'div2' )
38 div2.SetContainer( 'localhost/FactoryServer' )
39 div2.SetComment( 'C_DIV2 from SyrComponent' )
40 div2.Coords( 624 , 391 )
42 incr = GraphSyrControl1.FNode( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
43 incr.SetName( 'incr' )
45 incr.SetContainer( 'localhost/FactoryServer' )
46 incr.SetComment( 'C_INCR from SyrComponent' )
47 incr.Coords( 623 , 206 )
49 # Creation of InLine Nodes
51 Pylabel_begin.append( 'def label_begin( NB , KB ) :' )
52 Pylabel_begin.append( ' return NB,KB' )
53 label_begin = GraphSyrControl1.INode( 'label_begin' , Pylabel_begin )
54 label_begin.InPort( 'NB' , 'long' )
55 label_begin.InPort( 'KB' , 'long' )
56 label_begin.OutPort( 'NT' , 'long' )
57 label_begin.OutPort( 'KT' , 'long' )
58 label_begin.SetName( 'label_begin' )
59 label_begin.SetAuthor( '' )
60 label_begin.SetComment( 'Python function' )
61 label_begin.Coords( 5 , 190 )
63 # Creation of Switch Nodes
65 Pylabel_test.append( 'def L_OneEven( ValOne , ValEven , NT , KT ):' )
66 Pylabel_test.append( ' Finished = ValOne' )
67 Pylabel_test.append( ' if Finished == 0 :' )
68 Pylabel_test.append( ' Incr = 1' )
69 Pylabel_test.append( ' Even = ValEven' )
70 Pylabel_test.append( ' if Even == 0 :' )
71 Pylabel_test.append( ' Odd = 1' )
72 Pylabel_test.append( ' else :' )
73 Pylabel_test.append( ' Odd = 0' )
74 Pylabel_test.append( ' else :' )
75 Pylabel_test.append( ' Incr = 0' )
76 Pylabel_test.append( ' Even = 0' )
77 Pylabel_test.append( ' Odd = 0' )
78 Pylabel_test.append( ' Even = ValEven' )
79 Pylabel_test.append( ' return Finished,Incr,Even,Odd,NT,KT' )
80 label_test,EndL_OneEven = GraphSyrControl1.SNode( 'L_OneEven' , Pylabel_test )
81 EndL_OneEven.SetName( 'EndL_OneEven' )
82 EndL_OneEven.SetAuthor( '' )
83 EndL_OneEven.SetComment( '' )
84 EndL_OneEven.Coords( 1017 , 247 )
86 EndL_OneEven.SetPyFunction( 'EndL_OneEven' , PyEndL_OneEven )
87 label_test.InPort( 'ValOne' , 'long' )
88 label_test.InPort( 'ValEven' , 'long' )
89 label_test.InPort( 'NT' , 'long' )
90 label_test.InPort( 'KT' , 'long' )
91 label_test.OutPort( 'Finished' , 'long' )
92 label_test.OutPort( 'Incr' , 'long' )
93 label_test.OutPort( 'Even' , 'long' )
94 label_test.OutPort( 'Odd' , 'long' )
95 label_test.OutPort( 'N' , 'long' )
96 label_test.OutPort( 'K' , 'long' )
97 label_test.SetName( 'label_test' )
98 label_test.SetAuthor( '' )
99 label_test.SetComment( '' )
100 label_test.Coords( 399 , 177 )
102 # Creation of GOTO Nodes
104 Pycontrol_m3p1.append( 'def C_NotOneIsEven( N , K ):' )
105 Pycontrol_m3p1.append( ' return 0,1,N,K' )
106 control_m3p1 = GraphSyrControl1.GNode( 'C_NotOneIsEven' , Pycontrol_m3p1 , 'label_test' )
107 control_m3p1.InPort( 'N' , 'long' )
108 control_m3p1.InPort( 'K' , 'long' )
109 control_m3p1.OutPort( 'ValOne' , 'long' )
110 control_m3p1.OutPort( 'ValEven' , 'long' )
111 control_m3p1.OutPort( 'NT' , 'long' )
112 control_m3p1.OutPort( 'KT' , 'long' )
113 control_m3p1.SetName( 'control_m3p1' )
114 control_m3p1.SetAuthor( '' )
115 control_m3p1.SetComment( '' )
116 control_m3p1.Coords( 821 , 28 )
119 Pycontrol_div2.append( 'def control_div2( N , K ) :' )
120 Pycontrol_div2.append( ' return N,K' )
121 control_div2 = GraphSyrControl1.GNode( 'control_div2' , Pycontrol_div2 , 'label_begin' )
122 control_div2.InPort( 'N' , 'long' )
123 control_div2.InPort( 'K' , 'long' )
124 control_div2.OutPort( 'NB' , 'long' )
125 control_div2.OutPort( 'KB' , 'long' )
126 control_div2.SetName( 'control_div2' )
127 control_div2.SetAuthor( '' )
128 control_div2.SetComment( '' )
129 control_div2.Coords( 818 , 358 )
132 test_ISEVENBoolEven = test_ISEVEN.Port( 'BoolEven' )
133 label_testValEven = GraphSyrControl1.Link( test_ISEVENBoolEven , label_test.Port( 'ValEven' ) )
134 label_testValEven.AddCoord( 1 , 383 , 239 )
135 label_testValEven.AddCoord( 2 , 382 , 417 )
137 test_ISONEBoolOne = test_ISONE.Port( 'BoolOne' )
138 label_testValOne = GraphSyrControl1.Link( test_ISONEBoolOne , label_test.Port( 'ValOne' ) )
140 m3p1anEvenInteger = m3p1.Port( 'anEvenInteger' )
141 control_m3p1N = GraphSyrControl1.Link( m3p1anEvenInteger , control_m3p1.Port( 'N' ) )
142 control_m3p1N.AddCoord( 1 , 793 , 62 )
143 control_m3p1N.AddCoord( 2 , 792 , 111 )
145 div2anInteger = div2.Port( 'anInteger' )
146 control_div2N = GraphSyrControl1.Link( div2anInteger , control_div2.Port( 'N' ) )
147 control_div2N.AddCoord( 1 , 797 , 392 )
148 control_div2N.AddCoord( 2 , 798 , 471 )
150 incraNewCount = incr.Port( 'aNewCount' )
151 control_div2K = GraphSyrControl1.Link( incraNewCount , control_div2.Port( 'K' ) )
152 control_div2K.AddCoord( 1 , 809 , 420 )
153 control_div2K.AddCoord( 2 , 808 , 288 )
155 control_m3p1K = GraphSyrControl1.Link( incraNewCount , control_m3p1.Port( 'K' ) )
156 control_m3p1K.AddCoord( 1 , 807 , 91 )
157 control_m3p1K.AddCoord( 2 , 808 , 286 )
159 label_beginNT = label_begin.Port( 'NT' )
160 test_ISONEanInteger = GraphSyrControl1.Link( label_beginNT , test_ISONE.Port( 'anInteger' ) )
161 test_ISONEanInteger.AddCoord( 1 , 180 , 211 )
162 test_ISONEanInteger.AddCoord( 2 , 179 , 269 )
164 label_testNT = GraphSyrControl1.Link( label_beginNT , label_test.Port( 'NT' ) )
166 test_ISEVENanInteger = GraphSyrControl1.Link( label_beginNT , test_ISEVEN.Port( 'anInteger' ) )
167 test_ISEVENanInteger.AddCoord( 1 , 179 , 417 )
168 test_ISEVENanInteger.AddCoord( 2 , 179 , 271 )
170 label_beginKT = label_begin.Port( 'KT' )
171 label_testKT = GraphSyrControl1.Link( label_beginKT , label_test.Port( 'KT' ) )
173 label_testIncr = label_test.Port( 'Incr' )
174 incrInGate = GraphSyrControl1.Link( label_testIncr , incr.Port( 'InGate' ) )
175 incrInGate.AddCoord( 1 , 565 , 315 )
176 incrInGate.AddCoord( 2 , 564 , 240 )
178 label_testEven = label_test.Port( 'Even' )
179 div2InGate = GraphSyrControl1.Link( label_testEven , div2.Port( 'InGate' ) )
180 div2InGate.AddCoord( 1 , 583 , 500 )
181 div2InGate.AddCoord( 2 , 582 , 269 )
183 label_testOdd = label_test.Port( 'Odd' )
184 m3p1InGate = GraphSyrControl1.Link( label_testOdd , m3p1.Port( 'InGate' ) )
185 m3p1InGate.AddCoord( 1 , 571 , 138 )
186 m3p1InGate.AddCoord( 2 , 573 , 298 )
188 label_testN = label_test.Port( 'N' )
189 m3p1anOddInteger = GraphSyrControl1.Link( label_testN , m3p1.Port( 'anOddInteger' ) )
190 m3p1anOddInteger.AddCoord( 1 , 604 , 110 )
191 m3p1anOddInteger.AddCoord( 2 , 605 , 328 )
193 div2anEvenInteger = GraphSyrControl1.Link( label_testN , div2.Port( 'anEvenInteger' ) )
194 div2anEvenInteger.AddCoord( 1 , 606 , 471 )
195 div2anEvenInteger.AddCoord( 2 , 605 , 328 )
197 label_testK = label_test.Port( 'K' )
198 incraCount = GraphSyrControl1.Link( label_testK , incr.Port( 'aCount' ) )
199 incraCount.AddCoord( 1 , 594 , 287 )
200 incraCount.AddCoord( 2 , 595 , 356 )
202 label_testDefault = label_test.Port( 'Default' )
203 EndL_OneEvenDefault = GraphSyrControl1.Link( label_testDefault , EndL_OneEven.Port( 'Default' ) )
204 EndL_OneEvenDefault.AddCoord( 1 , 1008 , 281 )
205 EndL_OneEvenDefault.AddCoord( 2 , 1008 , 560 )
206 EndL_OneEvenDefault.AddCoord( 3 , 565 , 559 )
207 EndL_OneEvenDefault.AddCoord( 4 , 564 , 385 )
209 control_m3p1OutGate = control_m3p1.Port( 'OutGate' )
210 label_testInGate = GraphSyrControl1.Link( control_m3p1OutGate , label_test.Port( 'InGate' ) )
211 label_testInGate.AddCoord( 1 , 368 , 327 )
212 label_testInGate.AddCoord( 2 , 369 , 7 )
213 label_testInGate.AddCoord( 3 , 1009 , 8 )
214 label_testInGate.AddCoord( 4 , 1009 , 179 )
216 control_div2OutGate = control_div2.Port( 'OutGate' )
217 label_beginInGate = GraphSyrControl1.Link( control_div2OutGate , label_begin.Port( 'InGate' ) )
218 label_beginInGate.AddCoord( 1 , 3 , 327 )
219 label_beginInGate.AddCoord( 2 , 2 , 582 )
220 label_beginInGate.AddCoord( 3 , 991 , 583 )
221 label_beginInGate.AddCoord( 4 , 991 , 451 )
223 # Creation of Input datas
224 label_beginNB = label_begin.Input( 'NB' , 7)
225 label_beginKB = label_begin.Input( 'KB' , 0)
227 # Creation of Output variables
228 label_testFinished = label_test.Port( 'Finished' )
230 GraphSyrControl1.Run( 7 )
232 GraphSyrControl1.DoneW()
234 GraphSyrControl1.State()
236 GraphSyrControl1.PrintPorts()