5 GraphSyracuseControl = Graph( 'GraphSyracuseControl' )
6 print GraphSyracuseControl.SetName( 'GraphSyracuseControl' )
7 print GraphSyracuseControl.SetAuthor( 'JR' )
8 print GraphSyracuseControl.SetComment( 'Syracuse algorithm' )
9 GraphSyracuseControl.Coords( 0 , 0 )
12 test_ISEVEN = GraphSyracuseControl.Node( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' )
13 print test_ISEVEN.SetName( 'test_ISEVEN' )
14 print test_ISEVEN.SetAuthor( '' )
15 print test_ISEVEN.SetContainer( 'localhost/FactoryServer' )
16 print test_ISEVEN.SetComment( '' )
17 test_ISEVEN.Coords( 190 , 338 )
18 test_ISONE = GraphSyracuseControl.Node( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' )
19 print test_ISONE.SetName( 'test_ISONE' )
20 print test_ISONE.SetAuthor( '' )
21 print test_ISONE.SetContainer( 'localhost/FactoryServer' )
22 print test_ISONE.SetComment( '' )
23 test_ISONE.Coords( 196 , 131 )
24 m3p1 = GraphSyracuseControl.Node( 'SyrComponent' , 'SyrComponent' , 'C_M3P1' )
25 print m3p1.SetName( 'm3p1' )
26 print m3p1.SetAuthor( '' )
27 print m3p1.SetContainer( 'localhost/FactoryServer' )
28 print m3p1.SetComment( '' )
29 m3p1.Coords( 621 , 14 )
30 div2 = GraphSyracuseControl.Node( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' )
31 print div2.SetName( 'div2' )
32 print div2.SetAuthor( '' )
33 print div2.SetContainer( 'localhost/FactoryServer' )
34 print div2.SetComment( '' )
35 div2.Coords( 624 , 391 )
36 incr = GraphSyracuseControl.Node( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
37 print incr.SetName( 'incr' )
38 print incr.SetAuthor( '' )
39 print incr.SetContainer( 'localhost/FactoryServer' )
40 print incr.SetComment( '' )
41 incr.Coords( 622 , 199 )
42 label_begin = GraphSyracuseControl.LNode( 'label_begin' )
43 print label_begin.SetName( 'label_begin' )
44 print label_begin.SetAuthor( '' )
45 print label_begin.SetContainer( 'localhost/FactoryServerPy' )
46 print label_begin.SetComment( '' )
47 label_begin.Coords( 7 , 216 )
48 label_test = GraphSyracuseControl.LService( 'SyrControlComponent' , 'SyrControlComponent' , 'L_OneEven' )
49 print label_test.SetName( 'label_test' )
50 print label_test.SetAuthor( '' )
51 print label_test.SetContainer( 'localhost/FactoryServerPy' )
52 print label_test.SetComment( '' )
53 label_test.Coords( 399 , 176 )
54 control_m3p1 = GraphSyracuseControl.CService( 'SyrControlComponent' , 'SyrControlComponent' , 'C_NotOneIsEven' )
55 print control_m3p1.SetName( 'control_m3p1' )
56 print control_m3p1.SetAuthor( '' )
57 print control_m3p1.SetContainer( 'localhost/FactoryServerPy' )
58 print control_m3p1.SetComment( '' )
59 control_m3p1.Coords( 814 , 13 )
60 control_div2 = GraphSyracuseControl.CNode( 'control_div2' )
61 print control_div2.SetName( 'control_div2' )
62 print control_div2.SetAuthor( '' )
63 print control_div2.SetContainer( 'localhost/FactoryServerPy' )
64 print control_div2.SetComment( '' )
65 control_div2.Coords( 812 , 414 )
68 label_begin.BusPorts( 'NB' , 'long' , 'NT' , 'long' )
69 label_begin.BusPorts( 'KB' , 'long' , 'KT' , 'long' )
70 label_test.BusPorts( 'NT' , 'long' , 'N' , 'long' )
71 label_test.BusPorts( 'KT' , 'long' , 'K' , 'long' )
72 control_m3p1.BusPorts( 'N' , 'long' , 'NT' , 'long' )
73 control_m3p1.BusPorts( 'K' , 'long' , 'KT' , 'long' )
74 control_div2.BusPorts( 'N' , 'long' , 'NB' , 'long' )
75 control_div2.BusPorts( 'K' , 'long' , 'KB' , 'long' )
78 GraphSyracuseControl.Link( label_begin.Port( 'NT' ) , label_test.Port( 'NT' ) )
79 GraphSyracuseControl.Link( label_begin.Port( 'KT' ) , label_test.Port( 'KT' ) )
80 GraphSyracuseControl.Link( label_begin.Port( 'NT' ) , test_ISEVEN.Port( 'anInteger' ) )
81 GraphSyracuseControl.Link( label_begin.Port( 'NT' ) , test_ISONE.Port( 'anInteger' ) )
83 GraphSyracuseControl.Link( test_ISEVEN.Port( 'BoolEven' ) , label_test.Port( 'ValEven' ) )
84 GraphSyracuseControl.Link( test_ISONE.Port( 'BoolOne' ) , label_test.Port( 'ValOne' ) )
85 GraphSyracuseControl.Link( label_test.Port( 'N' ) , m3p1.Port( 'anOddInteger' ) )
86 GraphSyracuseControl.Link( label_test.Port( 'N' ) , div2.Port( 'anEvenInteger' ) )
87 GraphSyracuseControl.Link( label_test.Port( 'K' ) , incr.Port( 'aCount' ) )
88 GraphSyracuseControl.Link( label_test.Port( 'Incr' ) , incr.Port( 'InGate' ) )
89 GraphSyracuseControl.Link( label_test.Port( 'Even' ) , div2.Port( 'InGate' ) )
90 GraphSyracuseControl.Link( label_test.Port( 'Odd' ) , m3p1.Port( 'InGate' ) )
92 GraphSyracuseControl.Link( m3p1.Port( 'anEvenInteger' ) , control_m3p1.Port( 'N' ) )
93 GraphSyracuseControl.Link( div2.Port( 'anInteger' ) , control_div2.Port( 'N' ) )
94 GraphSyracuseControl.Link( incr.Port( 'aNewCount' ) , control_m3p1.Port( 'K' ) )
95 GraphSyracuseControl.Link( incr.Port( 'aNewCount' ) , control_div2.Port( 'K' ) )
97 GraphSyracuseControl.Link( control_m3p1.Port( 'OutGate' ) , label_test.Port( 'InGate' ) )
98 GraphSyracuseControl.Link( control_div2.Port( 'OutGate' ) , label_begin.Port( 'InGate' ) )
100 GraphSyracuseControl.IsValid()
102 GraphSyracuseControl.ThreadsMax()
104 GraphSyracuseControl.LevelMax()
106 GraphSyracuseControl.GraphsNumber()
108 label_begin.Input( 'NB' , 31 )
109 label_begin.Input( 'KB' , 0 )
111 GraphSyracuseControl.IsExecutable()
113 GraphSyracuseControl.Export('../GraphSyrControl')
116 GraphSyracuseControl.Run()
118 GraphSyracuseControl.DoneW()
120 print GraphSyracuseControl.State()
122 GraphSyracuseControl.PrintPorts()
124 label_test.PrintPorts()