haorenhui
2023-10-30 6d6cc10d9e8e242661da7fd655dec155a09d676c
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Quintiq file version 2.0
#parent: #root
MethodOverride CreateIssues
{
  Description: 'Create `LibOpt_Issues` to highlight potential issues about values collected by this `LibOpt_StatisticLogEntry`.'
  TextBody:
  [*
    // Variables needed for Issues creation.
    issuetype := this.GetIssueType();
    
    if( this.CheckHasSpecificComponent() )
    {
      numbervector_logentrycounts := NumberVector::Construct( RealVector::Construct( this.ValuesAsRealVector() ) );
      
      booleanvector_logentrycounts_nonzero := numbervector_logentrycounts.GreaterThan( 0 );
      indexvector_logentrycounts_nonzero := booleanvector_logentrycounts_nonzero.AsIndexVector();
      
      if( indexvector_logentrycounts_nonzero.Size() > 0 )
      {
        iterations := selectsortedset( this, Run.Iteration, iteration,
                                       // FILTER
                                       true,
                                       // VALUE
                                       iteration.IterationNr()
                                     );
        
        traverse( indexvector_logentrycounts_nonzero.AsValues(), Elements, index )
        {
          iteration := iterations.Element( index );
          assert( iteration.IterationNr() = index + 1,
                  '`LibOpt_StatisticLogEntry::GenerateIssue`:',
                  'The "iteration" retrieved using the "index" of', index, 'has an `IterationNr` of', iteration.IterationNr(),
                  'while it is expected to be', index + 1
                );
          
          // Use the 'SnapshotOwning' of the relevant iteration to set the 'Snapshot' relation for the issue to be created.
          snapshotowningofiteration := iteration.SnapshotOwning(); // This is a workaround to link the issue to the iteration.
                                                                   // We can't set a procedural relation for a `LibOpt_Iteration`,
                                                                   // as it is a declaratively instantiated type.
          
          // Create an Issue and link it to the relevant Snapshot.
          LibOpt_Issue::Create( this,
                                snapshotowningofiteration,
                                issuetype,
                                this.Focus() + ', ' + Translations::LibOpt_IterationNr( iteration.IterationNr(), this.Run().TotalNrOfIterations() ),
                                this.GetSeverity( iteration ),
                                this.GetIssueDetails( numbervector_logentrycounts.Get( index ) )
                             );
        }
      }
    }
    else
    {
      // Create an Issue that isn't linked to a particular Snapshot.
      LibOpt_Issue::Create( this,
                            null( LibOpt_Snapshot ),
                            issuetype,
                            this.Focus(),
                            this.GetSeverity(),
                            this.GetIssueDetails( this.NrElements() )
                         );
    }
  *]
}