Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod CompareLexicographical ( 
 | 
  Numbers tuple1, 
 | 
  Numbers tuple2 
 | 
) const declarative remote as Number 
 | 
{ 
 | 
  Description: 'Compare between 2 tuples on whether tuple1 > tuple2' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // Compare between 2 tuples on whether tuple1 > tuple2 
 | 
    // Set the value to the number that represents equality 
 | 
    value := Util::Compare_Equal(); 
 | 
     
 | 
    // Check if both tuple1 & tuple2 has any elements in it 
 | 
    if( tuple1.Size() > 0 and tuple2.Size() > 0 ) 
 | 
    { 
 | 
      tupledefaultvalue := 0; 
 | 
      undecided := true; 
 | 
      maxSize := maxvalue( tuple1.Size(), tuple2.Size() ); 
 | 
     
 | 
      // Loop as long as the index is within the max number of elements in either tuples 
 | 
      // and the result remains undecided 
 | 
      for( i := 0; i < maxSize and undecided; i++ ) 
 | 
      { 
 | 
        // Get the element in the tuples 
 | 
        v1 := ifexpr( tuple1.Size() > i, tuple1.Element( i ), tupledefaultvalue ); 
 | 
        v2 := ifexpr( tuple2.Size() > i, tuple2.Element( i ), tupledefaultvalue ); 
 | 
     
 | 
        // Check if tuple1 has element larger/less than the element in tuple2 at the same index 
 | 
        if( v2 < v1 ) 
 | 
        { 
 | 
          value := Util::Compare_Bigger(); 
 | 
          undecided := false; 
 | 
        } 
 | 
        else if( v2 > v1 ) 
 | 
        { 
 | 
          value := Util::Compare_Smaller() 
 | 
          undecided := false;       
 | 
        } 
 | 
      } 
 | 
    } 
 | 
     
 | 
    return value; 
 | 
  *] 
 | 
} 
 |