Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method CanBeExtended () declarative remote as Boolean 
 | 
{ 
 | 
  Description: 'This method checks if a combi can still be extended.' 
 | 
  TextBody: 
 | 
  [* 
 | 
    //Combis can be extended in the following cases: 
 | 
    // - The last element in the combit ends before the end of the starting subperiod 
 | 
    // - The end of the last element is later than the period its attached to and there is only 1 combi element which is a campaign 
 | 
     
 | 
    //The combi can no longer be extended if: 
 | 
    // - The combi is set to isCompleted --> this is needed so we can also create combis that are not consided done accordingf to the rules above 
 | 
    // - when it is a dead end no existing transition/campaign can follow the last element 
 | 
    // - when there are more combi elements in the combi than allowed according to the global parameter 
 | 
    maxextensionelements := this.OptCampaignUnitSubPeriod().OptCampaignUnit().OptCampaign().Macroplan().StrategyMacroPlan().MaxNrOfElemementsCampaignOptimizerCombi(); 
 | 
    value := not this.IsDeadEnd() 
 | 
             and not this.IsCompleteCombi() 
 | 
             and counter( this,  
 | 
                          OptCampaignCombiElement,  
 | 
                          ele,  
 | 
                          ele.OptCampaignUnitSubPeriod() = this.LastCombiElement().OptCampaignUnitSubPeriod() ) < maxextensionelements; 
 | 
     
 | 
    return value; 
 | 
  *] 
 | 
} 
 |