2 # Generated python file of Graph GraphSwitchCheck
6 # Graph creation of GraphSwitchCheck
7 def DefGraphSwitchCheck() :
8 GraphSwitchCheck = Graph( 'GraphSwitchCheck' )
9 GraphSwitchCheck.SetName( 'GraphSwitchCheck' )
10 GraphSwitchCheck.SetAuthor( 'JR' )
11 GraphSwitchCheck.SetComment( '' )
12 GraphSwitchCheck.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 = GraphSwitchCheck.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 = GraphSwitchCheck.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 PyPrintOdd.append( 'from time import * ' )
51 PyPrintOdd.append( 'def Print(a,Branch) : ' )
52 PyPrintOdd.append( ' print "Print ",a,Branch ' )
53 PyPrintOdd.append( ' sleep(1) ' )
54 PyPrintOdd.append( ' return Branch ' )
55 PrintOdd = GraphSwitchCheck.INode( 'Print' , PyPrintOdd )
56 PrintOdd.SetName( 'PrintOdd' )
57 PrintOdd.SetAuthor( '' )
58 PrintOdd.SetComment( 'Compute Node' )
59 PrintOdd.Coords( 415 , 130 )
60 IPrintOdda = PrintOdd.InPort( 'a' , 'long' )
61 IPrintOddBranch = PrintOdd.InPort( 'Branch' , 'string' )
62 IPrintOddGate = PrintOdd.GetInPort( 'Gate' )
63 OPrintOddBranch = PrintOdd.OutPort( 'Branch' , 'string' )
64 OPrintOddGate = PrintOdd.GetOutPort( 'Gate' )
67 PyPrintEven.append( 'from time import * ' )
68 PyPrintEven.append( 'def Print_1(a,Branch) : ' )
69 PyPrintEven.append( ' print "Print ",a,Branch ' )
70 PyPrintEven.append( ' sleep(1) ' )
71 PyPrintEven.append( ' return Branch ' )
72 PrintEven = GraphSwitchCheck.INode( 'Print_1' , PyPrintEven )
73 PrintEven.SetName( 'PrintEven' )
74 PrintEven.SetAuthor( '' )
75 PrintEven.SetComment( 'Compute Node' )
76 PrintEven.Coords( 423 , 289 )
77 IPrintEvena = PrintEven.InPort( 'a' , 'long' )
78 IPrintEvenBranch = PrintEven.InPort( 'Branch' , 'string' )
79 IPrintEvenGate = PrintEven.GetInPort( 'Gate' )
80 OPrintEvenBranch = PrintEven.OutPort( 'Branch' , 'string' )
81 OPrintEvenGate = PrintEven.GetOutPort( 'Gate' )
84 PyEmptyNode.append( 'from time import * ' )
85 PyEmptyNode.append( 'def EmptyNode(a,Branch) : ' )
86 PyEmptyNode.append( ' sleep(1) ' )
87 PyEmptyNode.append( ' return a,Branch ' )
88 EmptyNode = GraphSwitchCheck.INode( 'EmptyNode' , PyEmptyNode )
89 EmptyNode.SetName( 'EmptyNode' )
90 EmptyNode.SetAuthor( '' )
91 EmptyNode.SetComment( 'Compute Node' )
92 EmptyNode.Coords( 652 , 110 )
93 IEmptyNodea = EmptyNode.InPort( 'a' , 'long' )
94 IEmptyNodeBranch = EmptyNode.InPort( 'Branch' , 'string' )
95 IEmptyNodeGate = EmptyNode.GetInPort( 'Gate' )
96 OEmptyNodea = EmptyNode.OutPort( 'a' , 'long' )
97 OEmptyNodeBranch = EmptyNode.OutPort( 'Branch' , 'string' )
98 OEmptyNodeGate = EmptyNode.GetOutPort( 'Gate' )
100 # Creation of Loop Nodes
101 PyInitLoopSwitch = []
102 PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' )
103 PyInitLoopSwitch.append( ' Index = Max ' )
104 PyInitLoopSwitch.append( ' return Index,Min,Max ' )
105 PyMoreInitLoopSwitch = []
106 PyMoreInitLoopSwitch.append( 'from time import * ' )
107 PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' )
108 PyMoreInitLoopSwitch.append( ' sleep(1) ' )
109 PyMoreInitLoopSwitch.append( ' if Index >= Min : ' )
110 PyMoreInitLoopSwitch.append( ' DoLoop = 1 ' )
111 PyMoreInitLoopSwitch.append( ' else : ' )
112 PyMoreInitLoopSwitch.append( ' DoLoop = 0 ' )
113 PyMoreInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' )
114 PyNextInitLoopSwitch = []
115 PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' )
116 PyNextInitLoopSwitch.append( ' Index = Index - 1 ' )
117 PyNextInitLoopSwitch.append( ' return Index,Min,Max ' )
118 InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchCheck.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
119 EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
120 EndOfInitLoopSwitch.SetAuthor( '' )
121 EndOfInitLoopSwitch.SetComment( 'Compute Node' )
122 EndOfInitLoopSwitch.Coords( 1074 , 194 )
123 PyEndOfInitLoopSwitch = []
124 PyEndOfInitLoopSwitch.append( 'from time import * ' )
125 PyEndOfInitLoopSwitch.append( 'def EndOfInitLoopSwitch(DoLoop,Index,Min,Max) : ' )
126 PyEndOfInitLoopSwitch.append( ' sleep(1) ' )
127 PyEndOfInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' )
128 EndOfInitLoopSwitch.SetPyFunction( 'EndOfInitLoopSwitch' , PyEndOfInitLoopSwitch )
129 IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
130 IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
131 IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
132 IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
133 IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
134 OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
135 OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
136 OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
137 OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
138 IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
139 IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
140 IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
141 IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
142 IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
143 OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
144 OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
145 OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
146 OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
147 OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
148 InitLoopSwitch.SetName( 'InitLoopSwitch' )
149 InitLoopSwitch.SetAuthor( '' )
150 InitLoopSwitch.SetComment( 'Compute Node' )
151 InitLoopSwitch.Coords( 10 , 129 )
153 # Creation of Switch Nodes
155 PySwitch.append( 'from time import * ' )
156 PySwitch.append( 'def Switch(a) : ' )
157 PySwitch.append( ' sleep(1) ' )
158 PySwitch.append( ' Branch = "Negative or null" ' )
159 PySwitch.append( ' if a <= 0 : ' )
160 PySwitch.append( ' return 0,0,a,Branch,1 ' )
161 PySwitch.append( ' if ( a & 1 ) == 0 : ' )
162 PySwitch.append( ' Branch = "Even" ' )
163 PySwitch.append( ' else : ' )
164 PySwitch.append( ' Branch = "Odd" ' )
165 PySwitch.append( ' return a & 1,1-(a&1),a,Branch,0 ' )
166 Switch,EndOfSwitch = GraphSwitchCheck.SNode( 'Switch' , PySwitch )
167 EndOfSwitch.SetName( 'EndOfSwitch' )
168 EndOfSwitch.SetAuthor( '' )
169 EndOfSwitch.SetComment( 'Compute Node' )
170 EndOfSwitch.Coords( 882 , 194 )
172 PyEndOfSwitch.append( 'from time import * ' )
173 PyEndOfSwitch.append( 'def EndOfSwitch(a,Branch) : ' )
174 PyEndOfSwitch.append( ' sleep(1) ' )
175 PyEndOfSwitch.append( ' return a ' )
176 EndOfSwitch.SetPyFunction( 'EndOfSwitch' , PyEndOfSwitch )
177 IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
178 IEndOfSwitchBranch = EndOfSwitch.InPort( 'Branch' , 'string' )
179 IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
180 OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
181 OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
182 Switch.SetName( 'Switch' )
183 Switch.SetAuthor( '' )
184 Switch.SetComment( 'Compute Node' )
185 Switch.Coords( 195 , 129 )
186 ISwitcha = Switch.InPort( 'a' , 'long' )
187 ISwitchGate = Switch.GetInPort( 'Gate' )
188 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
189 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
190 OSwitcha = Switch.OutPort( 'a' , 'int' )
191 OSwitchBranch = Switch.OutPort( 'Branch' , 'string' )
192 OSwitchdefault = Switch.OutPort( 'default' , 'boolean' )
193 OSwitchDefault = Switch.GetOutPort( 'Default' )
196 LIsOddaEmptyNodea = GraphSwitchCheck.Link( OIsOdda , IEmptyNodea )
197 LIsOddaEmptyNodea.AddCoord( 1 , 646 , 78 )
199 LIsEvenaEndOfSwitcha = GraphSwitchCheck.Link( OIsEvena , IEndOfSwitcha )
201 LPrintOddBranchEmptyNodeBranch = GraphSwitchCheck.Link( OPrintOddBranch , IEmptyNodeBranch )
203 LPrintEvenBranchEndOfSwitchBranch = GraphSwitchCheck.Link( OPrintEvenBranch , IEndOfSwitchBranch )
205 LEmptyNodeaEndOfSwitcha = GraphSwitchCheck.Link( OEmptyNodea , IEndOfSwitcha )
207 LEmptyNodeBranchEndOfSwitchBranch = GraphSwitchCheck.Link( OEmptyNodeBranch , IEndOfSwitchBranch )
209 LInitLoopSwitchIndexSwitcha = GraphSwitchCheck.Link( OInitLoopSwitchIndex , ISwitcha )
211 LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchCheck.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
213 LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchCheck.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
215 LSwitchOddIsOddGate = GraphSwitchCheck.Link( OSwitchOdd , IIsOddGate )
216 LSwitchOddIsOddGate.AddCoord( 1 , 401 , 101 )
217 LSwitchOddIsOddGate.AddCoord( 2 , 401 , 160 )
219 LSwitchOddPrintOddGate = GraphSwitchCheck.Link( OSwitchOdd , IPrintOddGate )
220 LSwitchOddPrintOddGate.AddCoord( 1 , 401 , 245 )
221 LSwitchOddPrintOddGate.AddCoord( 2 , 401 , 159 )
223 LSwitchEvenIsEvenGate = GraphSwitchCheck.Link( OSwitchEven , IIsEvenGate )
224 LSwitchEvenIsEvenGate.AddCoord( 1 , 392 , 533 )
225 LSwitchEvenIsEvenGate.AddCoord( 2 , 392 , 182 )
227 LSwitchEvenPrintEvenGate = GraphSwitchCheck.Link( OSwitchEven , IPrintEvenGate )
228 LSwitchEvenPrintEvenGate.AddCoord( 1 , 392 , 403 )
229 LSwitchEvenPrintEvenGate.AddCoord( 2 , 392 , 181 )
231 LSwitchaIsOdda = GraphSwitchCheck.Link( OSwitcha , IIsOdda )
232 LSwitchaIsOdda.AddCoord( 1 , 382 , 78 )
233 LSwitchaIsOdda.AddCoord( 2 , 382 , 199 )
235 LSwitchaIsEvena = GraphSwitchCheck.Link( OSwitcha , IIsEvena )
236 LSwitchaIsEvena.AddCoord( 1 , 381 , 509 )
237 LSwitchaIsEvena.AddCoord( 2 , 382 , 200 )
239 LSwitchaPrintOdda = GraphSwitchCheck.Link( OSwitcha , IPrintOdda )
241 LSwitchaPrintEvena = GraphSwitchCheck.Link( OSwitcha , IPrintEvena )
242 LSwitchaPrintEvena.AddCoord( 1 , 381 , 361 )
243 LSwitchaPrintEvena.AddCoord( 2 , 382 , 200 )
245 LSwitchBranchPrintOddBranch = GraphSwitchCheck.Link( OSwitchBranch , IPrintOddBranch )
247 LSwitchBranchPrintEvenBranch = GraphSwitchCheck.Link( OSwitchBranch , IPrintEvenBranch )
248 LSwitchBranchPrintEvenBranch.AddCoord( 1 , 369 , 381 )
249 LSwitchBranchPrintEvenBranch.AddCoord( 2 , 369 , 219 )
251 LSwitchDefaultEndOfSwitchDefault = GraphSwitchCheck.Link( OSwitchDefault , IEndOfSwitchDefault )
253 LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchCheck.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
256 IInitLoopSwitchIndex.Input( 0 )
257 IInitLoopSwitchMin.Input( -5 )
258 IInitLoopSwitchMax.Input( 10 )
260 # Output Ports of the graph
261 #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
262 #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
263 #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
264 #OSwitchdefault = Switch.GetOutPort( 'default' )
265 return GraphSwitchCheck
268 GraphSwitchCheck = DefGraphSwitchCheck()