陈清红
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
32
33
34
35
36
37
Quintiq file version 2.0
#parent: #root
Method GetLeafTypes (
  internal[Type] root,
  internal[Type] excludetype
) as structured[internal[Type]] id:Method_LibOpt_DialogConditionalTypes_GetLeafTypes
{
  #keys: '[143908.0.758167613]'
  Body:
  [*
    // Get all leaf types of the 'root' type. 
    // A type is a leaf type of some root type if the leaf type is non-abstract and if the type is an (indirect) subtype of the root type. 
    // The 'excludetype' type (and all subclasses of that type) are excluded from the set of leaf types.  
    
    leafs := construct( structured[internal[Type]] );
    
    // The LibOpt_Breakpoint type and all LibOpt_DatasetCopyConditionalNotSelectable subtypes (e.g. LibOpt_DatasetCopyUnconditional) are excluded because of this if-statement.
    if( root <> excludetype )
    {
      // recursion end: roottype is a leaf.
      if( root.Specializations( relsize ) = 0 )
      {
        leafs.Add( root );
      }
      else
      {
        // recursive calls: the root's leafs are the union of its childrens' leafs:
        traverse( root, Specializations, child )
        {
          leafs := leafs.Union( this.GetLeafTypes( child, excludetype ) );
        }
      }
    }
    return & leafs;
  *]
  ReturnsOwning: true
}