陈清红
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
30
31
Quintiq file version 2.0
#parent: #root
Method DeleteWhenFlagged (Boolean isdatasetconstructed)
{
  Description:
  [*
    If the `LibOpt_SnapshotReplannableCopyDataset.HasExecutedDoFinalizeDatasetCopyDelete` attribute is `true` for a snapshot, then we know that we have executed the `LibOpt_DatasetCopyConditional::DoFinalizeDatasetCopyDelete` method for that snapshot.
    When `LibOpt_DatasetCopyConditional::DoFinalizeDatasetCopyDelete` has been executed for a snapshot, then we do not need the `this` object anymore for that snapshot.
    Therefore, if the `this` object is flagged for deletion and if `LibOpt_SnapshotReplannableCopyDataset.HasExecutedDoFinalizeDatasetCopyDelete` is `true` for all snapshots that have been created by the `this` object (so all snapshots in the `this.SnapshotReplannableCopyDataset` relation), 
    then we can safely delete `this`.
  *]
  TextBody:
  [*
    // evr3 Jun-19-2020 (created)
    if( this.IsFlaggedForDeletion() 
        // We can safely delete all 'LibOpt_DatasetCopyConditional' objects in a newly constructed dataset, 
        // because there won't be any reactive calls that might require a 'LibOpt_DatasetCopyConditional' object in a new dataset. 
        and ( isdatasetconstructed 
              or forall( this, 
                         SnapshotReplannableCopyDataset,
                         snapshot,
                         snapshot.HasExecutedDoFinalizeDatasetCopyDelete() 
                         )
              )
        )
    {
      this.Delete();
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}