陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
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
Quintiq file version 2.0
#parent: #root
MethodOverride Progress () declarative remote as Real
{
  TextBody:
  [*
    value := 1.0;
    
    zero_duration := Duration::Zero();
    if( this.MaxIterations() > 0.0
        and this.MaxDurationLocal() > zero_duration
        and this.MaxDurationGlobal() > zero_duration )
    {
      run := this.Iterator().Run();
      time := guard( run.LastSnapshot().TimeStamp(), 
                     ifexpr( run.StartedOn().IsFinite(), run.StartedOn(), run.CreatedOn() ) );
      
      iterations      := max( this, Iterator.Task.TaskContext.astype( LibOpt_TaskContextIterator ), context, context.NrOfIterations() / this.MaxIterations() );
      local_duration  := max( this, Iterator.Task.SnapshotComponent, context, ( time - context.TimeStamp() ) / this.MaxDurationLocal() );
      global_duration := ( time - this.Iterator().Run().StartedOn() ) / this.MaxDurationGlobal();
      
      value := maxvalue( 0.0,
                         maxvalue( iterations,
                                   maxvalue( local_duration, global_duration ) ) );
    }
    
    return value;
  *]
}