Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- /-> B -\
- begin -> A -< >-> D -> E ->end
- \-> C -/
- depenendencies | dependents
- ----------------|-------------
- [E] : [end]
- [D] : [E]
- [B, C] : [D]
- [A] : [B, C]
- [begin] : [A]
- */
- auto expand(node n)
- {
- if(n == begin)
- {
- return n;
- }
- else if(is_linear_to(n))
- {
- return expand(only_dependency(n)).then(n);
- }
- else if(is_join)
- {
- return when_all(expand_fork(dependencies(n)...)).then(n);
- }
- }
- auto expand_fork(nodes... ns)
- {
- return expand(fork_origin_of(ns...)).then_in_parallel(ns...);
- }
- // begin...
- expand(end)
- // is_linear_to(end)? true
- expand(E).then(end)
- // is_linear_to(E)? true
- expand(D).then(E).then(end)
- // is_join_to(D)? true
- when_all(expand_fork(B, C)).then(D).then(E)).then(end)
- // expand_fork(B, C)
- when_all(expand(A).then_in_parallel(B, C)).then(D).then(E)).then(end)
- // is_linear_to(A)? true
- when_all(expand(begin).then(A).then_in_parallel(B, C)).then(D).then(E)).then(end)
- // is_begin? true
- when_all(begin.then(A).then_in_parallel(B, C)).then(D).then(E)).then(end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement