我有一个供应商工具,用于以纯文本格式输出命令。我希望以某种方式将其格式化为嵌套数组,但我无法理解其中的逻辑。
每行的格式为:NESTING_LEVEL JOBNAME IN APPL APPLICATION (TYPE) MESSAGE
每个节点还需要具有JOBNAME
,APPLICATION
和MESSAGE
这三个值
示例1:列出作业J3的所有前任。
PREDECESSORS FOR JOB J3 IN APPL AA.8
1 J2 IN APPL AA.8 (EXTERNAL) HOME JOB FOUND
2 J2 IN APPL AC.1 (HOME) IS HELD
1 J3 IN APPL AA.7 (ANCESTOR) WAITING FOR ANCESTOR
2 J2 IN APPL AA.7 (EXTERNAL) HOME JOB FOUND
3 J2 IN APPL AC.1 (HOME) (DUPLICATE) IS HELD
2 J3 IN APPL AA.6 (ANCESTOR) WAITING FOR ANCESTOR
3 J2 IN APPL AA.6 (EXTERNAL) HOME JOB FOUND
4 J2 IN APPL AC.1 (HOME) (DUPLICATE) IS HELD
3 J3 IN APPL AA.5 (ANCESTOR) NOT STARTED
4 J2 IN APPL AA.5 (EXTERNAL) HOME JOB FOUND
5 J2 IN APPL AC.1 (HOME) (DUPLICATE) IS HELD
2 J3 IN APPL AA.5 (ANCESTOR) (DUPLICATE) NOT STARTED
1 J3 IN APPL AA.6 (ANCESTOR) (DUPLICATE) WAITING FOR ANCESTOR
1 J3 IN APPL AA.5 (ANCESTOR) (DUPLICATE) NOT STARTED
8 PREDECESSORS FOUND IN 5 APPLICATIONS
END OF PREDECESSORS
示例2:列出Job J2的所有后继者
SUCCESSORS FOR JOB J2 IN APPL AC.1
1 J2 IN APPL AA.8 (EXTERNAL) HOME JOB FOUND
2 J3 IN APPL AA.8 WAITING FOR ANCESTOR
1 J2 IN APPL AA.7 (EXTERNAL) HOME JOB FOUND
2 J3 IN APPL AA.7 WAITING FOR ANCESTOR
3 J3 IN APPL AA.8 (DUPLICATE) WAITING FOR ANCESTOR
1 J2 IN APPL AA.6 (EXTERNAL) HOME JOB FOUND
2 J3 IN APPL AA.6 WAITING FOR ANCESTOR
3 J3 IN APPL AA.8 (DUPLICATE) WAITING FOR ANCESTOR
3 J3 IN APPL AA.7 (DUPLICATE) WAITING FOR ANCESTOR
1 J2 IN APPL AA.5 (EXTERNAL) HOME JOB FOUND
2 J3 IN APPL AA.5 NOT STARTED
3 J3 IN APPL AA.8 (DUPLICATE) WAITING FOR ANCESTOR
3 J3 IN APPL AA.7 (DUPLICATE) WAITING FOR ANCESTOR
3 J3 IN APPL AA.6 (DUPLICATE) WAITING FOR ANCESTOR
1 J4 IN APPL AC.1 NOT STARTED
2 J4 IN APPL AA.8 (EXTERNAL) HOME JOB FOUND
3 J5 IN APPL AA.8 WAITING FOR ANCESTOR
2 J4 IN APPL AA.7 (EXTERNAL) HOME JOB FOUND
3 J5 IN APPL AA.7 WAITING FOR ANCESTOR
4 J5 IN APPL AA.8 (DUPLICATE) WAITING FOR ANCESTOR
2 J4 IN APPL AA.6 (EXTERNAL) HOME JOB FOUND
3 J5 IN APPL AA.6 WAITING FOR ANCESTOR
4 J5 IN APPL AA.8 (DUPLICATE) WAITING FOR ANCESTOR
4 J5 IN APPL AA.7 (DUPLICATE) WAITING FOR ANCESTOR
2 J4 IN APPL AA.5 (EXTERNAL) HOME JOB FOUND
3 J5 IN APPL AA.5 NOT STARTED
4 J5 IN APPL AA.8 (DUPLICATE) WAITING FOR ANCESTOR
4 J5 IN APPL AA.7 (DUPLICATE) WAITING FOR ANCESTOR
4 J5 IN APPL AA.6 (DUPLICATE) WAITING FOR ANCESTOR
2 J3 IN APPL AC.1 NOT STARTED
18 SUCCESSORS FOUND IN 5 APPLICATIONS
END OF SUCCESSORS
我该怎么做?