Quintiq file version 2.0 
 | 
#parent: #root 
 | 
MethodOverride GetLeafDescendants () as owning Entitys 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    descendantEntities := construct( Entitys ); 
 | 
     
 | 
    // Filter out system (WIP) entities 
 | 
    traverse( this, ChildEntity, c, not c.GetIsSystem() ) 
 | 
    { 
 | 
      // Only add if child is leaf 
 | 
      if( c.ChildEntity( relsize ) = 0 ) 
 | 
      { 
 | 
        descendantEntities.Add( c ); 
 | 
      } 
 | 
       
 | 
      // Recursive add leaf descendants 
 | 
      cc := c.GetLeafDescendants(); 
 | 
      if( cc.Size() > 0 ) 
 | 
      { 
 | 
        descendantEntities := descendantEntities.Merge( cc );  
 | 
      } 
 | 
    } 
 | 
     
 | 
    return &descendantEntities; 
 | 
  *] 
 | 
} 
 |