-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPseudo_NewConvertToPAD.java
More file actions
40 lines (33 loc) · 1.25 KB
/
Pseudo_NewConvertToPAD.java
File metadata and controls
40 lines (33 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
firstCode = first code from codeAlgorithm;
fatherBlock = new BlockContainer;
convertToPAD(firstCode, fatherBlock);
function convertToPAD(currCode, BlockContainer fatherBlock)
if (currCode == null)
return;
currElem = currCode.getElement();
if (currElem == null)
return;
if (currElem type is "Process")
element = new Sequence;
element.setText(currElem.getText());
add element to fatherBlock;
if (currElem type is "Selection")
element = new Selection;
element.setText(currElem.getText());
foreach currCode children thats not convergence
nextFlow = child.getElement();
subBlock = new BlockContainer;
set subBlock as yes or no child of element;
convertToPAD(nextFlow.getNodeCode(), subBlock);
add element to fatherBlock;
if (currElem type is "DoWhile" OR "While")
element = new While or DoWhile;
element.setText(currElem.getText());
subContainer = new BlockContainer;
childCode = the only child of currCode;
set subContainer as element child
add element to fatherBlock;
convertToPAD(childCode, subContainer);
/* Go to next code from the same layer */
currCode = currCode next sibling;
convertToPAD(currCode, fatherBlock);