yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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
65
66
Quintiq file version 2.0
#parent: #root
Method FindOrCreateScopeShared (String type, LibOpt_Group group) as LibOpt_ScopeShared
{
  Description:
  [*
    Get the `LibOpt_ScopeShared` that is only linked to this `LibOpt_ScopeThin` and no others.
    
    If it does not exist, create it.
  *]
  TextBody:
  [*
    result := null( LibOpt_ScopeShared );
    
    group_vector := null( NumberVector, owning );
    if( isnull( group ) )
    {
      group_vector := NumberVector::Construct( 0 );
    }
    else
    {
      group_vector := NumberVector::Construct( this.ID() + 1 );
      group_vector.Set( this.ID(), group.ID() );
    }
    group_vector_bv := group_vector.AsBinaryValue();
    if( this.Index() = 0 )
    {
      result := LibOpt_ScopeShared32::FindSet32( this.Mask(), type, group_vector_bv );
      
      if( isnull( result ) )
      {
        result := this.ScopeSharedOwned( relnew,
                                         LibOpt_ScopeShared32,
                                         Set := this.Mask(),
                                         Type := type,
                                         GroupVector := group_vector_bv
                                         );
      
        LibOpt_ScopeSharedOnScope::Create( this, group, result );
      }
    }
    else
    {
      vector := NumberVector::Construct( this.Index() + 1 );
      vector.Set( this.Index(), this.Mask() )
      vector_bv := vector.AsBinaryValue();
      result := LibOpt_ScopeSharedVector::FindSetVector( vector_bv, type, group_vector_bv );
      
      if( isnull( result ) )
      {
        result := this.ScopeSharedOwned( relnew,
                                         LibOpt_ScopeSharedVector,
                                         Set := vector_bv,
                                         Type := type,
                                         GroupVector := group_vector_bv
                                         );
      
        LibOpt_ScopeSharedOnScope::Create( this, group, result );
      }
    }
    
    
    return result;
  *]
  InterfaceProperties { Accessibility: 'Module' }
}