2 # Generated python file of Graph GraphSwitchCheckBranch1
6 # Graph creation of GraphSwitchCheckBranch1
7 def DefGraphSwitchCheckBranch1() :
8 GraphSwitchCheckBranch1 = Graph( 'GraphSwitchCheckBranch1' )
9 GraphSwitchCheckBranch1.SetName( 'GraphSwitchCheckBranch1' )
10 GraphSwitchCheckBranch1.SetAuthor( 'JR' )
11 GraphSwitchCheckBranch1.SetComment( 'Switch with two SwitchBranches, One NotSwitchBranch and the DefaultBranch' )
12 GraphSwitchCheckBranch1.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.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.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.INode( 'Print_1' , PyBranchNode )
56 BranchNode.SetName( 'BranchNode' )
57 BranchNode.SetAuthor( '' )
58 BranchNode.SetComment( 'Compute Node' )
59 BranchNode.Coords( 604 , 149 )
60 IBranchNodeBranch = BranchNode.InPort( 'Branch' , 'string' )
61 IBranchNodeGate = BranchNode.GetInPort( 'Gate' )
62 OBranchNodeBranch = BranchNode.OutPort( 'Branch' , 'string' )
63 OBranchNodeGate = BranchNode.GetOutPort( 'Gate' )
65 # Creation of Loop Nodes
67 PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' )
68 PyInitLoopSwitch.append( ' Index = Max ' )
69 PyInitLoopSwitch.append( ' return Index,Min,Max ' )
70 PyMoreInitLoopSwitch = []
71 PyMoreInitLoopSwitch.append( 'from time import * ' )
72 PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' )
73 PyMoreInitLoopSwitch.append( ' sleep(1) ' )
74 PyMoreInitLoopSwitch.append( ' if Index >= Min : ' )
75 PyMoreInitLoopSwitch.append( ' DoLoop = 1 ' )
76 PyMoreInitLoopSwitch.append( ' else : ' )
77 PyMoreInitLoopSwitch.append( ' DoLoop = 0 ' )
78 PyMoreInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' )
79 PyNextInitLoopSwitch = []
80 PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' )
81 PyNextInitLoopSwitch.append( ' Index = Index - 1 ' )
82 PyNextInitLoopSwitch.append( ' return Index,Min,Max ' )
83 InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchCheckBranch1.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
84 EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
85 EndOfInitLoopSwitch.SetAuthor( '' )
86 EndOfInitLoopSwitch.SetComment( 'Compute Node' )
87 EndOfInitLoopSwitch.Coords( 1074 , 194 )
88 PyEndOfInitLoopSwitch = []
89 PyEndOfInitLoopSwitch.append( 'from time import * ' )
90 PyEndOfInitLoopSwitch.append( 'def EndOfInitLoopSwitch(DoLoop,Index,Min,Max) : ' )
91 PyEndOfInitLoopSwitch.append( ' sleep(1) ' )
92 PyEndOfInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' )
93 EndOfInitLoopSwitch.SetPyFunction( 'EndOfInitLoopSwitch' , PyEndOfInitLoopSwitch )
94 IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
95 IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
96 IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
97 IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
98 IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
99 OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
100 OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
101 OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
102 OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
103 IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
104 IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
105 IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
106 IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
107 IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
108 OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
109 OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
110 OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
111 OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
112 OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
113 InitLoopSwitch.SetName( 'InitLoopSwitch' )
114 InitLoopSwitch.SetAuthor( '' )
115 InitLoopSwitch.SetComment( 'Compute Node' )
116 InitLoopSwitch.Coords( 10 , 157 )
118 # Creation of Switch Nodes
120 PySwitch.append( 'from time import * ' )
121 PySwitch.append( 'def Switch(a) : ' )
122 PySwitch.append( ' sleep(1) ' )
123 PySwitch.append( ' Branch = "Negative or null" ' )
124 PySwitch.append( ' if a <= 0 : ' )
125 PySwitch.append( ' return 0,0,a,Branch,1 ' )
126 PySwitch.append( ' if ( a & 1 ) == 0 : ' )
127 PySwitch.append( ' Branch = "Even" ' )
128 PySwitch.append( ' else : ' )
129 PySwitch.append( ' Branch = "Odd" ' )
130 PySwitch.append( ' return a & 1,1-(a&1),a,Branch,0 ' )
131 Switch,EndOfSwitch = GraphSwitchCheckBranch1.SNode( 'Switch' , PySwitch )
132 EndOfSwitch.SetName( 'EndOfSwitch' )
133 EndOfSwitch.SetAuthor( '' )
134 EndOfSwitch.SetComment( 'Compute Node' )
135 EndOfSwitch.Coords( 882 , 194 )
137 PyEndOfSwitch.append( 'from time import * ' )
138 PyEndOfSwitch.append( 'def EndOfSwitch(a,Branch) : ' )
139 PyEndOfSwitch.append( ' sleep(1) ' )
140 PyEndOfSwitch.append( ' return a ' )
141 EndOfSwitch.SetPyFunction( 'EndOfSwitch' , PyEndOfSwitch )
142 IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
143 IEndOfSwitchBranch = EndOfSwitch.InPort( 'Branch' , 'string' )
144 IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
145 OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
146 OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
147 Switch.SetName( 'Switch' )
148 Switch.SetAuthor( '' )
149 Switch.SetComment( 'Compute Node' )
150 Switch.Coords( 194 , 157 )
151 ISwitcha = Switch.InPort( 'a' , 'long' )
152 ISwitchGate = Switch.GetInPort( 'Gate' )
153 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
154 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
155 OSwitcha = Switch.OutPort( 'a' , 'int' )
156 OSwitchBranch = Switch.OutPort( 'Branch' , 'string' )
157 OSwitchdefault = Switch.OutPort( 'default' , 'boolean' )
158 OSwitchDefault = Switch.GetOutPort( 'Default' )
161 LIsOddaEndOfSwitcha = GraphSwitchCheckBranch1.Link( OIsOdda , IEndOfSwitcha )
163 LIsEvenaEndOfSwitcha = GraphSwitchCheckBranch1.Link( OIsEvena , IEndOfSwitcha )
165 LBranchNodeBranchEndOfSwitchBranch = GraphSwitchCheckBranch1.Link( OBranchNodeBranch , IEndOfSwitchBranch )
167 LInitLoopSwitchIndexSwitcha = GraphSwitchCheckBranch1.Link( OInitLoopSwitchIndex , ISwitcha )
169 LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchCheckBranch1.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
171 LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchCheckBranch1.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
173 LSwitchOddIsOddGate = GraphSwitchCheckBranch1.Link( OSwitchOdd , IIsOddGate )
174 LSwitchOddIsOddGate.AddCoord( 1 , 401 , 101 )
175 LSwitchOddIsOddGate.AddCoord( 2 , 401 , 188 )
177 LSwitchEvenIsEvenGate = GraphSwitchCheckBranch1.Link( OSwitchEven , IIsEvenGate )
178 LSwitchEvenIsEvenGate.AddCoord( 1 , 392 , 533 )
179 LSwitchEvenIsEvenGate.AddCoord( 2 , 392 , 208 )
181 LSwitchaIsOdda = GraphSwitchCheckBranch1.Link( OSwitcha , IIsOdda )
182 LSwitchaIsOdda.AddCoord( 1 , 382 , 78 )
183 LSwitchaIsOdda.AddCoord( 2 , 382 , 229 )
185 LSwitchaIsEvena = GraphSwitchCheckBranch1.Link( OSwitcha , IIsEvena )
186 LSwitchaIsEvena.AddCoord( 1 , 381 , 509 )
187 LSwitchaIsEvena.AddCoord( 2 , 381 , 229 )
189 LSwitchBranchBranchNodeBranch = GraphSwitchCheckBranch1.Link( OSwitchBranch , IBranchNodeBranch )
191 LSwitchdefaultEndOfSwitchDefault = GraphSwitchCheckBranch1.Link( OSwitchdefault , IEndOfSwitchDefault )
193 LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchCheckBranch1.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
196 IInitLoopSwitchIndex.Input( 0 )
197 IInitLoopSwitchMin.Input( -5 )
198 IInitLoopSwitchMax.Input( 10 )
200 # Output Ports of the graph
201 #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
202 #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
203 #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
204 return GraphSwitchCheckBranch1
207 GraphSwitchCheckBranch1 = DefGraphSwitchCheckBranch1()