WF (next)

Source: Internet
Author: User

Composite statement component

Next, we need to divide opensesame into several small units.
Split the read from opensesame for the first time.
In opensesame, read is called.
The key here is how to notify the caller opensesame after the read is executed.
Solution: Use a bookmark in the Start/run method of read to pause the program. After the read is executed, the bookmarkmanager is notified, the Asynchronous Method continueat of the caller opensesame is activated, so that the caller is notified.

The second split divides the remaining opensesame cut into printkey and printgreeting
* Note: The Mgr of each activity belongs to itself and there is no connection between them.
To this end, establish the active collection class programstatementblock: programstatement. Pay attention to the combination of the run method and the continueat method, and use the iteration technology. the runprogram () method that indirectly calls programstatement. run (MGR)

Finally, make a small modification. Note that programstatementblock is only a Sequential stream like {}, and there are other control flows (if, switch, for, while, foreach)-collectively referred to as composite statement components, therefore, we established the compositeprogramstatement class and derived from programstatement. All the control flows, including programstatementblock, are derived from the compositeprogramstatement class.

Then, an ifelse activity, a while activity, and an interleave activity are created.
The interleave activity executes the statement components in parallel until all execution is completed.

To prevent the programstatement method from being called by the outside, the method is declared as protected internal, which can only be called indirectly by the bookmarkdoner.

* The done () method has only one bookmark in each activity and has no parameters. Otherwise, the done () method must be overloaded with the bookmarkname and payload parameters.

* Note: in order to unify the formats of all opensesame () methods, the START () method is used to replace the run () method, and all bookmarklocation variable names are unified into bookmarklocation, the original book code has been modified, but the style of the whole chapter is consistent.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.