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:
- Public function Doquicksort (array:array):void
- {
- Process.blocklen = 20;
- Process.pauselen = 10;
- var process:quicksortprocess = new quicksortprocess (array);
- Process.addeventlistener (Process.complete, handlecomplete);
- Process.addeventlistener (process.progress, handleprogress);
- //пускайопрогрессесообщаетсякаждые10%
- Process.updatestep = 0.1;
- Process.activate ();
- }
- Private function Handleprogress (event:event):void
- {
- var process:quicksortprocess =
- Event.target as quicksortprocess;
- Trace ( int (process.progress * +) + "%");
- }
- Private function Handlecomplete (event:event):void
- {
- var process:quicksortprocess =
- Event.target as quicksortprocess;
- Trace (
- "Сравнений:" + process.comparsions +
- ", макс. Глубинарекурсии: "+ process.maxdepth
- );
- }
Copy to Google TranslateTranslation Results
Fast sequencing algorithm for process implementation