Fast sequencing algorithm for process implementation

Source: Internet
Author: User

Reference: http://diomas.ru/2009/11/05/process/#cut1

  Distributed computing tasks when I find out when I write anything based on HTML template builder.xml file to do business with me, is huge and each recursive tree will inevitably lead to the super-restricted takeoff message execution script. Luckily, I saw someone flaser. I decided to iterate over the subsequent call frames of each tree node in RU. I'm going to be in a frame and then call multiple iterations, through the transformation work, and later setinterval through the timer. Anyway, I still копипаст code changes and little happiness. But it was supposed to be a routine horrible parser 10 times. I make all the necessary decisions, and individuals are still used for such tasks.
I write a class call that takes the method in the iterative cycle and needs to rest, the UI application can continue to interact with the user. Supposedly I should call this kind of thread (ender-lib), but I didn't think about myself, calling him process, Why not?. he:

Process.as

I want to solve this всякихprocessmanager first grade, there are no separate class interfaces and other garbage more. The entire general is in the static method of the functional most process. Now I need to do some parser is отнаследова and implemented in two ways: Process ( Iteration) and adsorption properties are progress.
"method to complete all work details, the context attribute classes required for the entire project, and so on. In addition to working effectively, lying in this method, he needs to return a Boolean value indicating whether the iteration data is up to date.
The sexual energy display progress the total amount of work done, can hold values up to 1.0 0.0. If the number of iterations is generally unknown, the value can remain 0.0 to return 1.0 when the process is finished. In addition, mark this attribute [флексов meta (event = ") before using the bindable framework meaning. Processprogress ")]
For example code is process quality ' Омquicksort sort:

Quicksortprocess.as

Here we use the recursive stack: where the folding coordinates подмассив start and end are processed. The () method compares the details of the current value to the pivot point so that all permutations are compared. at the same time, all data must be stored in an attribute iteration class: Daily подмассив boundaries (Partleftind and Partrightind), position (control points), and Pivotind points (cursorind comparison).
Using this process is simple:

  1. Public function Doquicksort (array:array):void
  2. {
  3. Process.blocklen = 20;
  4. Process.pauselen = 10;
  5. var process:quicksortprocess = new quicksortprocess (array);
  6. Process.addeventlistener (Process.complete, handlecomplete);
  7. Process.addeventlistener (process.progress, handleprogress);
  8. //пускайопрогрессесообщаетсякаждые10%
  9. Process.updatestep = 0.1;
  10. Process.activate ();
  11. }
  12. Private function Handleprogress (event:event):void
  13. {
  14. var process:quicksortprocess =
  15. Event.target as quicksortprocess;
  16. Trace ( int (process.progress * +) + "%");
  17. }
  18. Private function Handlecomplete (event:event):void
  19. {
  20. var process:quicksortprocess =
  21. Event.target as quicksortprocess;
  22. Trace (
  23. "Сравнений:" + process.comparsions +
  24. ", макс. Глубинарекурсии: "+ process.maxdepth
  25. );
  26. }

Copy to Google TranslateTranslation Results

Fast sequencing algorithm for process implementation

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.