2 # Generated python file of Graph GraphSwitchCheckBranch1_1
6 # Graph creation of GraphSwitchCheckBranch1_1
7 def DefGraphSwitchCheckBranch1_1() :
8 GraphSwitchCheckBranch1_1 = Graph( 'GraphSwitchCheckBranch1_1' )
9 GraphSwitchCheckBranch1_1.SetName( 'GraphSwitchCheckBranch1_1' )
10 GraphSwitchCheckBranch1_1.SetAuthor( 'JR' )
11 GraphSwitchCheckBranch1_1.SetComment( 'Switch with two SwitchBranches, One NotSwitchBranch and the DefaultBranch' )
12 GraphSwitchCheckBranch1_1.Coords( 0 , 0 )
14 # Creation of Factory Nodes
16 # Creation of InLine Nodes
18 PyIsOdd.append( 'from time import * ' )
19 PyIsOdd.append( 'def IsOdd(a) : ' )
20 PyIsOdd.append( ' print a,"IsOdd (GraphSwitch)" ' )
21 PyIsOdd.append( ' sleep( 1 ) ' )
22 PyIsOdd.append( ' return a ' )
23 IsOdd = GraphSwitchCheckBranch1_1.INode( 'IsOdd' , PyIsOdd )
24 IsOdd.SetName( 'IsOdd' )
26 IsOdd.SetComment( 'Python function' )
27 IsOdd.Coords( 415 , 7 )
28 IIsOdda = IsOdd.InPort( 'a' , 'long' )
29 IIsOddGate = IsOdd.GetInPort( 'Gate' )
30 OIsOdda = IsOdd.OutPort( 'a' , 'long' )
31 OIsOddGate = IsOdd.GetOutPort( 'Gate' )
34 PyIsEven.append( 'from time import * ' )
35 PyIsEven.append( 'def IsEven(a) : ' )
36 PyIsEven.append( ' print a,"IsEven (GraphSwitch)" ' )
37 PyIsEven.append( ' sleep( 1 ) ' )
38 PyIsEven.append( ' return a ' )
39 IsEven = GraphSwitchCheckBranch1_1.INode( 'IsEven' , PyIsEven )
40 IsEven.SetName( 'IsEven' )
41 IsEven.SetAuthor( '' )
42 IsEven.SetComment( 'Compute Node' )
43 IsEven.Coords( 421 , 438 )
44 IIsEvena = IsEven.InPort( 'a' , 'long' )
45 IIsEvenGate = IsEven.GetInPort( 'Gate' )
46 OIsEvena = IsEven.OutPort( 'a' , 'long' )
47 OIsEvenGate = IsEven.GetOutPort( 'Gate' )
50 PyBranchNode.append( 'from time import * ' )
51 PyBranchNode.append( 'def Print_1(Branch) : ' )
52 PyBranchNode.append( ' print "Print ",Branch ' )
53 PyBranchNode.append( ' sleep(1) ' )
54 PyBranchNode.append( ' return Branch ' )
55 BranchNode = GraphSwitchCheckBranch1_1.INode( 'Print_1' , PyBranchNode )
56 BranchNode.SetName( 'BranchNode' )
57 BranchNode.SetAuthor( '' )
58 BranchNode.SetComment( 'Compute Node' )
59 BranchNode.Coords( 529 , 177 )
60 IBranchNodeBranch = BranchNode.InPort( 'Branch' , 'string' )
61 IBranchNodeGate = BranchNode.GetInPort( 'Gate' )
62 OBranchNodeBranch = BranchNode.OutPort( 'Branch' , 'string' )
63 OBranchNodeGate = BranchNode.GetOutPort( 'Gate' )
66 Pydefault.append( 'from time import * ' )
67 Pydefault.append( 'def default(a) : ' )
68 Pydefault.append( ' sleep(1) ' )
69 Pydefault.append( ' return a ' )
70 default = GraphSwitchCheckBranch1_1.INode( 'default' , Pydefault )
71 default.SetName( 'default' )
72 default.SetAuthor( '' )
73 default.SetComment( 'Compute Node' )
74 default.Coords( 428 , 308 )
75 Idefaulta = default.InPort( 'a' , 'long' )
76 IdefaultGate = default.GetInPort( 'Gate' )
77 Odefaulta = default.OutPort( 'a' , 'long' )
78 OdefaultGate = default.GetOutPort( 'Gate' )
80 # Creation of Loop Nodes
82 PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' )
83 PyInitLoopSwitch.append( ' Index = Max ' )
84 PyInitLoopSwitch.append( ' return Index,Min,Max ' )
85 PyMoreInitLoopSwitch = []
86 PyMoreInitLoopSwitch.append( 'from time import * ' )
87 PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' )
88 PyMoreInitLoopSwitch.append( ' sleep(1) ' )
89 PyMoreInitLoopSwitch.append( ' if Index >= Min : ' )
90 PyMoreInitLoopSwitch.append( ' DoLoop = 1 ' )
91 PyMoreInitLoopSwitch.append( ' else : ' )
92 PyMoreInitLoopSwitch.append( ' DoLoop = 0 ' )
93 PyMoreInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' )
94 PyNextInitLoopSwitch = []
95 PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' )
96 PyNextInitLoopSwitch.append( ' Index = Index - 1 ' )
97 PyNextInitLoopSwitch.append( ' return Index,Min,Max ' )
98 InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchCheckBranch1_1.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
99 EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
100 EndOfInitLoopSwitch.SetAuthor( '' )
101 EndOfInitLoopSwitch.SetComment( 'Compute Node' )
102 EndOfInitLoopSwitch.Coords( 1073 , 216 )
103 PyEndOfInitLoopSwitch = []
104 PyEndOfInitLoopSwitch.append( 'from time import * ' )
105 PyEndOfInitLoopSwitch.append( 'def EndOfInitLoopSwitch(DoLoop,Index,Min,Max) : ' )
106 PyEndOfInitLoopSwitch.append( ' sleep(1) ' )
107 PyEndOfInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' )
108 EndOfInitLoopSwitch.SetPyFunction( 'EndOfInitLoopSwitch' , PyEndOfInitLoopSwitch )
109 IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
110 IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
111 IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
112 IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
113 IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
114 OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
115 OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
116 OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
117 OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
118 IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
119 IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
120 IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
121 IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
122 IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
123 OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
124 OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
125 OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
126 OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
127 OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
128 InitLoopSwitch.SetName( 'InitLoopSwitch' )
129 InitLoopSwitch.SetAuthor( '' )
130 InitLoopSwitch.SetComment( 'Compute Node' )
131 InitLoopSwitch.Coords( 10 , 157 )
133 # Creation of Switch Nodes
135 PySwitch.append( 'from time import * ' )
136 PySwitch.append( 'def Switch(a) : ' )
137 PySwitch.append( ' sleep(1) ' )
138 PySwitch.append( ' Branch = "Negative or null" ' )
139 PySwitch.append( ' if a <= 0 : ' )
140 PySwitch.append( ' return 0,0,a,Branch,1 ' )
141 PySwitch.append( ' if ( a & 1 ) == 0 : ' )
142 PySwitch.append( ' Branch = "Even" ' )
143 PySwitch.append( ' else : ' )
144 PySwitch.append( ' Branch = "Odd" ' )
145 PySwitch.append( ' return a & 1,1-(a&1),a,Branch,0 ' )
146 Switch,EndOfSwitch = GraphSwitchCheckBranch1_1.SNode( 'Switch' , PySwitch )
147 EndOfSwitch.SetName( 'EndOfSwitch' )
148 EndOfSwitch.SetAuthor( '' )
149 EndOfSwitch.SetComment( 'Compute Node' )
150 EndOfSwitch.Coords( 880 , 216 )
152 PyEndOfSwitch.append( 'from time import * ' )
153 PyEndOfSwitch.append( 'def EndOfSwitch(a,Branch) : ' )
154 PyEndOfSwitch.append( ' sleep(1) ' )
155 PyEndOfSwitch.append( ' return a ' )
156 EndOfSwitch.SetPyFunction( 'EndOfSwitch' , PyEndOfSwitch )
157 IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
158 IEndOfSwitchBranch = EndOfSwitch.InPort( 'Branch' , 'string' )
159 IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
160 OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
161 OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
162 Switch.SetName( 'Switch' )
163 Switch.SetAuthor( '' )
164 Switch.SetComment( 'Compute Node' )
165 Switch.Coords( 194 , 157 )
166 ISwitcha = Switch.InPort( 'a' , 'long' )
167 ISwitchGate = Switch.GetInPort( 'Gate' )
168 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
169 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
170 OSwitcha = Switch.OutPort( 'a' , 'int' )
171 OSwitchBranch = Switch.OutPort( 'Branch' , 'string' )
172 OSwitchdefault = Switch.OutPort( 'default' , 'boolean' )
173 OSwitchDefault = Switch.GetOutPort( 'Default' )
176 LIsOddaEndOfSwitcha = GraphSwitchCheckBranch1_1.Link( OIsOdda , IEndOfSwitcha )
178 LIsEvenaEndOfSwitcha = GraphSwitchCheckBranch1_1.Link( OIsEvena , IEndOfSwitcha )
180 LBranchNodeBranchEndOfSwitchBranch = GraphSwitchCheckBranch1_1.Link( OBranchNodeBranch , IEndOfSwitchBranch )
182 LInitLoopSwitchIndexSwitcha = GraphSwitchCheckBranch1_1.Link( OInitLoopSwitchIndex , ISwitcha )
184 LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchCheckBranch1_1.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
186 LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchCheckBranch1_1.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
188 LSwitchOddIsOddGate = GraphSwitchCheckBranch1_1.Link( OSwitchOdd , IIsOddGate )
189 LSwitchOddIsOddGate.AddCoord( 1 , 401 , 101 )
190 LSwitchOddIsOddGate.AddCoord( 2 , 401 , 188 )
192 LSwitchEvenIsEvenGate = GraphSwitchCheckBranch1_1.Link( OSwitchEven , IIsEvenGate )
193 LSwitchEvenIsEvenGate.AddCoord( 1 , 392 , 533 )
194 LSwitchEvenIsEvenGate.AddCoord( 2 , 392 , 208 )
196 LSwitchaIsOdda = GraphSwitchCheckBranch1_1.Link( OSwitcha , IIsOdda )
197 LSwitchaIsOdda.AddCoord( 1 , 382 , 78 )
198 LSwitchaIsOdda.AddCoord( 2 , 382 , 229 )
200 LSwitchaIsEvena = GraphSwitchCheckBranch1_1.Link( OSwitcha , IIsEvena )
201 LSwitchaIsEvena.AddCoord( 1 , 381 , 509 )
202 LSwitchaIsEvena.AddCoord( 2 , 381 , 229 )
204 LSwitchadefaulta = GraphSwitchCheckBranch1_1.Link( OSwitcha , Idefaulta )
205 LSwitchadefaulta.AddCoord( 1 , 382 , 377 )
206 LSwitchadefaulta.AddCoord( 2 , 382 , 228 )
208 LSwitchBranchBranchNodeBranch = GraphSwitchCheckBranch1_1.Link( OSwitchBranch , IBranchNodeBranch )
210 LSwitchdefaultdefaultGate = GraphSwitchCheckBranch1_1.Link( OSwitchdefault , IdefaultGate )
211 LSwitchdefaultdefaultGate.AddCoord( 1 , 410 , 403 )
212 LSwitchdefaultdefaultGate.AddCoord( 2 , 410 , 269 )
213 LSwitchdefaultdefaultGate.AddCoord( 3 , 410 , 268 )
215 LSwitchDefaultEndOfSwitchDefault = GraphSwitchCheckBranch1_1.Link( OSwitchDefault , IEndOfSwitchDefault )
217 LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchCheckBranch1_1.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
219 LdefaultaEndOfSwitcha = GraphSwitchCheckBranch1_1.Link( Odefaulta , IEndOfSwitcha )
222 IInitLoopSwitchIndex.Input( 0 )
223 IInitLoopSwitchMin.Input( -5 )
224 IInitLoopSwitchMax.Input( 10 )
226 # Output Ports of the graph
227 #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
228 #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
229 #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
230 return GraphSwitchCheckBranch1_1
233 GraphSwitchCheckBranch1_1 = DefGraphSwitchCheckBranch1_1()