Summary of the invention
The purpose of this invention is to provide a kind of correctness that can guarantee concurrent unit in the process flow diagram, flow instance the legitimacy method of inspection according to the concurrent unit of work process flow figure of user's expectation true(-)running.
To achieve these goals, technical solution of the present invention is as follows:
Check the redirect between illegal outlet, illegal entry and each concurrent branch of concurrent unit by the dark searching algorithm of the elder generation that makes up utilization figure flexibly; Be specially: its data structure adopts forward, reverse two adjacency lists; Wherein: when the illegal outlet of check, use the forward adjacency list, when the check illegal entry, use reverse adjacency list, when the redirect of checking between concurrent branch, use two adjacency lists respectively, use the forward adjacency list during forward lookup, use reverse adjacency list during reverse search.
When illegal outlet of check and illegal entry, each node needs corresponding Search Flags, when the redirect of checking between concurrent branch, each node needs corresponding two Search Flags, and use forward sign is represented forward lookup and used reverse sign to represent reverse search.
The step of the illegal outlet of check is: a concurrent unit has only outlet of an inlet, concurrent start node is its inlet, concurrent end node is its outlet, carry out the dark search of elder generation from concurrent start node, to corresponding concurrent end node, when before arriving concurrent end node, just having arrived leaf node (not going out the limit) or having got back to concurrent start node, show that there is illegal outlet in concurrent unit; Be specially: 1) whole process flow diagram is created a forward adjacency list; 2) each concurrent start node V carries out following steps in the forward adjacency list:
A) the Search Flags f of each node correspondence in the forward adjacency list is changed to 0;
B) set out by concurrent start node V and call forward traversal substep and travel through.
Described forward traversal substep is: at first the Search Flags f of traversal start node V0 is made as 1; Judge then whether traversal start node V0 also has next adjacent node; If any next adjacent node, if the next adjacent node of traversal start node V0 is V2, again described next adjacent node V2 is made the following judgment:, continue to judge whether traversal start node V0 also has next adjacent node 1) if the next adjacent node V2 of traversal start node V0 is the concurrent end node V1 of concurrent start node V correspondence; 2), continue to judge whether traversal start node V0 also has next adjacent node if the Search Flags f of the next adjacent node V2 of traversal start node V0 is 1; 3) if the next adjacent node V2 of traversal start node V0 is concurrent start node V, there is illegal outlet then concurrent unit, prints traverse path, continues to judge whether traversal start node V0 also has next adjacent node; 4) if the next adjacent node V2 of traversal start node V0 is leaf node (not going out the limit), there is illegal outlet then concurrent unit, prints traverse path, continues to judge whether traversal start node V0 also has next adjacent node; 5) other situation recursive call forward traversal substep is then set out by the next adjacent node V2 of traversal start node V0 and to proceed traversal.
The step of check illegal entry is: a concurrent unit has only outlet of an inlet, concurrent start node is its inlet, concurrent end node is its outlet, carrying out reverse elder generation from concurrent end node searches for deeply, to arriving corresponding concurrent start node, if before arriving concurrent start node, just arrived root node (not going into the limit) or got back to concurrent end node, shown that then there is illegal entry in concurrent unit; Concrete steps are: at first whole process flow diagram is created a reverse adjacency list; Then each concurrent end node V1 in the reverse adjacency list is carried out following steps:
1) the Search Flags f of each node correspondence in the reverse adjacency list is changed to 0;
2) set out by concurrent end node V1 and call reverse traversal substep and travel through.
Described reverse traversal substep is: at first the Search Flags f of traversal start node V0 is made as 1; Judge again whether traversal start node V0 also has next adjacent node; If any words, if the next adjacent node of traversal start node V0 is V2, described next adjacent node V2 is made the following judgment:, continue then to judge whether traversal start node V0 also has next adjacent node 1) if the next adjacent node V2 of traversal start node V0 is the concurrent start node V of concurrent end node V1 correspondence; 2), continue then to judge whether traversal start node V0 also has next adjacent node if the Search Flags f of the next adjacent node V2 of traversal start node V0 is 1; 3) if the next adjacent node V2 of traversal start node V0 is concurrent end node V1 then there is illegal entry concurrent unit, print traverse path, continue then to judge whether traversal start node V0 also has next adjacent node; 4) if the next adjacent node V2 of traversal start node V0 is root node (not going into the limit), there is illegal entry then concurrent unit, prints traverse path, continues then to judge whether traversal start node V0 also has next adjacent node; 5) other situation reverse traversal substep of recursive call is then set out by the next adjacent node V2 of traversal start node V0 and to proceed traversal.
Check the step of redirect between concurrent branch to be: to carry out the forward traversal from concurrent start node, run into when having into the limit number greater than 1 node, carry out reverse traversal from this node, if can just can get back to concurrent start node without the node of the traversal of forward, have redirect between then concurrent branch; Its step: 1) whole process flow diagram is created a forward adjacency list, a reverse adjacency list; 2) each concurrent start node V in forward, the reverse adjacency list is carried out following steps:
1) forward lookup of each node correspondence in forward, reverse adjacency list sign f is made as 0;
2) set out by concurrent start node V and call forward traversal substep and carry out the forward traversal.
Described forward traversal substep is: at first the forward lookup sign f of traversal start node V0, reverse traversal sign f1 are made as 1; Judge then whether traversal start node V0 also has next adjacent node, if any words, if the next adjacent node of traversal start node V0 is V2, again to described next adjacent node V2 execution in step: 1) if next adjacent node V2 and concurrent start node V direct neighbor identify f1 to the reverse search of each node correspondence in the adjacency list and be made as 0; 2) if the reverse search of next adjacent node V2 sign f1 is 0, and next adjacent node V2 is not concurrent start node V, concurrent end node V1 that neither concurrent start node V correspondence, and next adjacent node V2 goes into the limit number greater than 1, is set out by next adjacent node V2 and calls reverse traversal substep and carry out reverse traversal; 3) next adjacent node V2 is made the following judgment:, then whether also have next adjacent node V2 to continue to carry out and judge traversal start node V0 if the next adjacent node V2 of a. is concurrent start node V; If b. next adjacent node V2 is the concurrent end node V1 of concurrent start node V correspondence, then whether also has next adjacent node V2 to continue to carry out and judge traversal start node V0; If the forward lookup of c. next adjacent node V2 sign f is 1, then whether also has next adjacent node V2 to continue to carry out and judge traversal start node V0; If d. next adjacent node V2 is leaf node (not going out the limit), then whether also has next adjacent node V2 to continue to carry out and judge traversal start node V0; E. other situation (not being four kinds of a~d) recursive call forward traversal substep is then set out by next adjacent node V2 and to proceed traversal.
Described reverse traversal substep is: the reverse search sign f1 that at first will travel through start node V0 is made as 1; Judge again whether traversal start node V0 also has next adjacent node, if any words, if the next adjacent node of traversal start node V0 is V3, again the reverse adjacent node V3 of this next one is judged:, then continue to judge next reverse adjacent node 1) if reverse adjacent node V3 is the concurrent end node V1 of concurrent start node V correspondence; 2), then continue to judge next reverse adjacent node if reverse adjacent node V3 is root node (not going into the limit); 3) if the reverse search of reverse adjacent node V3 sign f1 is 1, then continue to judge next reverse adjacent node; 4) if reverse adjacent node V3 is concurrent start node V, there is redirect between then concurrent branch, prints traverse path, continue to judge next reverse adjacent node again; 5) other situation reverse traversal substep of recursive call is then set out by reverse adjacent node V3 and to proceed reverse traversal.
The present invention has following advantage:
1. the present invention can check out the redirect between illegal outlet, illegal entry and each concurrent branch of concurrent unit by the dark searching algorithm of the elder generation that makes up utilization figure flexibly, realized legitimacy verification to concurrent unit, thereby guaranteed the correctness of concurrent unit in the process flow diagram, made the flow instance can be according to user's expectation true(-)running.
2. the present invention has guaranteed the true(-)running of flow instance to a great extent by when defining process flow diagram being carried out verification, has reduced the possibility of makeing mistakes.
3. the present invention carries out verification by after finishing at process flow diagram to its legitimacy, has removed from when mapping and has made all restrictions, makes the user more flexible when mapping, and is convenient to revise.
4. the present invention is by the verification to process flow diagram in when definition, removed to the correctness that guarantees flow process and carried out dry run, for the user has saved resource.
5. the inventive method is simple, and is reliable.
Embodiment
Below in conjunction with drawings and Examples the present invention is described in further detail.
Data structure of the present invention adopts adjacency list.Need two adjacency lists, the adjacency list of a forward, a reverse adjacency list.When checking illegal outlet, use the forward adjacency list, when the check illegal entry, use reverse adjacency list, when the redirect of checking between concurrent branch, use two adjacency lists respectively.When illegal outlet of check and illegal entry, each node needs corresponding Search Flags, when the redirect of checking between concurrent branch, each node needs corresponding two Search Flags, represents forward lookup (using the forward adjacency list) and reverse search (using reverse adjacency list) respectively.
The step of the illegal outlet of check: a concurrent unit has only outlet of an inlet, concurrent start node is its inlet, concurrent end node is its outlet, carry out the dark search of elder generation from concurrent start node like this, necessarily can arrive corresponding concurrent end node, if before arriving concurrent end node, just arrived leaf node (not going out the limit) or got back to concurrent start node, just show that there is illegal outlet in concurrent unit.
Step is as follows:
1. whole process flow diagram is created an adjacency list.
2. each concurrent start node V in the forward adjacency list is carried out following steps:
1) the Search Flags f of each node correspondence in the forward adjacency list is changed to 0;
2) set out by concurrent start node V and call forward traversal substep and travel through.
Wherein: as shown in Figure 1, described forward traversal substep is described below:
1. the Search Flags f of traversal start node V0 is made as 1;
2. judge whether traversal start node V0 also has next adjacent node; If any next adjacent node, the next adjacent node of establishing traversal start node V0 is V2, then this next one adjacent node V2 is made the following judgment:
1), continues to judge whether traversal start node V0 also has next adjacent node if the next adjacent node V2 of traversal start node V0 is the concurrent end node V1 of concurrent start node V correspondence;
2), continue to judge whether traversal start node V0 also has next adjacent node if the Search Flags f of the next adjacent node V2 of traversal start node V0 is 1;
3) if the next adjacent node V2 of traversal start node V0 is concurrent start node V, there is illegal outlet then concurrent unit, prints traverse path, continues to judge whether traversal start node V0 also has next adjacent node;
4) if the next adjacent node V2 of traversal start node V0 is leaf node (not going out the limit), there is illegal outlet then concurrent unit, prints traverse path, continues to judge whether traversal start node V0 also has next adjacent node;
5) other situation when four kinds of situations (be not above-mentioned) recursive call forward traversal substep is then set out by the next adjacent node V2 of traversal start node V0 and to proceed traversal.
The step of check illegal entry: a concurrent unit has only outlet of an inlet, concurrent start node is its inlet, concurrent end node is its outlet, carrying out reverse elder generation from concurrent end node like this searches for deeply, necessarily can arrive corresponding concurrent start node, if before arriving concurrent start node, just arrived root node (not going into the limit) or got back to concurrent end node, just shown that there is illegal entry in concurrent unit.
Step is as follows:
1. whole process flow diagram is created a reverse adjacency list;
2. each concurrent end node V1 in the adjacency list is carried out following steps:
1) the Search Flags f of each node correspondence in the adjacency list is changed to 0;
2) set out by concurrent end node V1 and call reverse traversal substep and travel through.
Wherein said reverse traversal substep is described below (referring to Fig. 2):
1. the Search Flags f of traversal start node V0 is made as 1.
2. judge whether traversal start node V0 also has next adjacent node, if any, the next adjacent node of establishing traversal start node V0 is V2, this next one adjacent node V2 is made the following judgment again:
1), continues then to judge whether traversal start node V0 also has next adjacent node if the next adjacent node V2 of traversal start node V0 is the concurrent start node V of concurrent end node V1 correspondence.
2), continue then to judge whether traversal start node V0 also has next adjacent node if the Search Flags f of the next adjacent node V2 of traversal start node V0 is 1.
3) if the next adjacent node V2 of traversal start node V0 is concurrent end node V1, there is illegal entry then concurrent unit, prints traverse path, continues then to judge whether traversal start node V0 also has next adjacent node.
4) if the next adjacent node V2 of traversal start node V0 is root node (not going into the limit), there is illegal entry then concurrent unit, prints traverse path, continues then to judge whether traversal start node V0 also has next adjacent node.
5) other situation (not being above-mentioned four kinds of situations) reverse traversal subalgorithm of recursive call is then set out by the next adjacent node V2 of traversal start node V0 and to be proceeded traversal.
Check the step of redirect between concurrent branch: owing to should not have redirect between each concurrent branch, so can not there be two disjoint paths in the arbitrary node in from concurrent start node to concurrent unit; The present invention carries out forward traversal from concurrent start node, and running into has into the limit number greater than 1 node, promptly carries out reverse traversal from this node, if can just can get back to concurrent spending node without the node of forward traversal, has redirect between then concurrent branch.
Step is as follows:
1. whole process flow diagram is created a forward adjacency list, a reverse adjacency list.
2. each concurrent start node V in the adjacency list is carried out following steps:
1) forward lookup of each node correspondence in adjacency list sign f is made as 0;
2) set out by concurrent start node V and call forward traversal substep and travel through.
As shown in Figure 3, forward traversal substep is described below:
1. the forward lookup sign f of traversal start node, reverse search sign f1 are made as 1.
2. judge whether V0 also has next adjacent node, if any, the next adjacent node of establishing V0 is V2, again this next one adjacent node V2 is carried out following steps:
1) if next adjacent node V2 and concurrent start node V direct neighbor (having a limit from concurrent start node V to next adjacent node V2) identify f1 to the reverse search of each node correspondence in the adjacency list and are made as 0;
2) if the reverse search of next adjacent node V2 sign f1 is 0, and next adjacent node V2 is not concurrent start node V, concurrent end node V1 that neither concurrent start node V correspondence, and next adjacent node V2 goes into the limit number greater than 1, is set out by next adjacent node V2 and calls reverse traversal substep and carry out reverse traversal;
3) next adjacent node V2 is made the following judgment:
If a. next adjacent node V2 is concurrent start node V, then whether also has next adjacent node to continue to carry out and judge traversal start node V0;
If b. next adjacent node V2 is the concurrent end node V1 of concurrent start node V correspondence, then whether also has next adjacent node V2 to continue to carry out and judge traversal start node V0;
If the forward lookup of c. next adjacent node V2 sign f is 1, then whether also has next adjacent node V2 to continue to carry out and judge traversal start node V0;
If d. next adjacent node V2 is leaf node (not going out the limit), then whether also has next adjacent node V2 to continue to carry out and judge traversal start node V0;
E. other situation (not being four kinds of a~d) recursive call forward traversal substep is then set out by next adjacent node V2 and to proceed traversal.
As shown in Figure 4, reverse traversal substep is described below:
1. the reverse search sign f1 that will travel through start node V0 is made as 1;
2. judge whether traversal start node V0 also has next adjacent node, if any, the next adjacent node of establishing traversal start node V0 is V3, the more reverse adjacent node V3 of this next one is carried out to judge:
1), then continues to judge next reverse adjacent node if reverse adjacent node V3 is the concurrent end node V1 of concurrent start node V correspondence;
2), then continue to judge next reverse adjacent node if reverse adjacent node V3 is root node (not going into the limit);
3) if the reverse search of reverse adjacent node V3 sign f1 is 1, then continue to judge next reverse adjacent node;
4) if reverse adjacent node V3 is concurrent start node V, there is redirect between then concurrent branch, prints traverse path, continue to judge next reverse adjacent node again;
5) other situation (not being 1)~4) content) the reverse traversal substep of recursive call is then set out by reverse adjacent node V3 and to proceed reverse traversal.
Illustrate legitimacy how to use this method to check concurrent unit below.
As shown in Figure 5, concurrent unit that illegal outlet arranged can directly arrive behavior node A3 outside the concurrent unit by the behavior node A2 in the concurrent unit.Adopt the present invention to check the method for the illegal outlet in concurrent unit, set out by concurrent start node V and to travel through, the order of traversal is V, A1, A2, A3, E successively, so just exist one to set out by concurrent start node V, concurrent end node V1 without its correspondence, can arrive the path of leaf node, illustrate that there is illegal outlet in this concurrent unit.
As shown in Figure 6, concurrent unit that illegal entry arranged can directly arrive behavior node A2 in the concurrent unit by the behavior node A3 outside the concurrent unit.Adopt the present invention to check the method for concurrent unit illegal entry, set out by concurrent end node V1 and to carry out reverse traversal, the order of traversal is V, A1, A2, A3, S successively, so just exist one to set out by concurrent end node V1, concurrent start node V without its correspondence, can arrive the inverse path of root node, illustrate that there is illegal entry in this concurrent unit.
As shown in Figure 7, exist the concurrent unit of redirect to have two paths that do not overlap fully can arrive behavior node A1 between a branch by concurrent start node.Adopt the present invention to check the method for redirect between concurrent cell branch, set out by concurrent start node V earlier and carry out the forward traversal, the order of traversal is V, A1, when arriving A1, find that it has two inlets, set out by A1 and to carry out reverse traversal, the order of traversal is A1, A2, V, like this from concurrent start node V, there are two paths that do not overlap fully to arrive behavior node A1, illustrate between this concurrent cell branch to have redirect.