lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Quintiq file version 2.0
#parent: #root
Method PollBreakpoints (LibOpt_Task task) as stream[Void]
{
  TextBody:
  [*
    result := null( stream[Void] );
    if( task.CanContinue() )
    {
      continue := this.CanContinueBreakpoint( task );
        
      // Create a dataset copy when the AE requests a copy by pressing the 'Create dataset copy' button in the 'Component positions' form.
      if( this.HasToCreateDatasetOnBreakpoint() ) 
      {
        LibOpt_DatasetCopyConditional::CopyDataset( task,
                                                    "Breakpoint " + task.ComponentPosition().Name(), 
                                                    false // We can only reach this if-block if PollBreakpoints is called reactively, so we can safely create a quick/reactive dataset copy here.                                                                     
                                                    );     
                                      
        this.HasToCreateDatasetOnBreakpoint( false );
      }
      
      if( continue )
      {
        result := emit( void );
      }
      else
      {
        if( this.BreakpointPollDuration() <= Duration::Zero() )
        {
          result := this->PollBreakpoints( task );
        }
        else
        {
          result := stream[Void]::Wait( this.BreakpointPollDuration() )
                    ->|this->PollBreakpoints( task );
        }
      }
      task.IsWaiting( not continue );
    }
    
    return result;
  *]
  InterfaceProperties { Accessibility: 'Module' }
}