示例#1
0
 /// <summary>
 /// Function that gets the combined rows from the two data groups.
 /// </summary>
 /// <param name="data1">First data group to get the rows from</param>
 /// <param name="data2">Second data group to get the rows from</param>
 /// <returns>Returns the combined rows from the two data groups</returns>
 private static int[] GetNewRows(QMCGroupData data1, QMCGroupData data2)
 {
     if (data1.NumberOfRows() > 1 && data2.NumberOfRows() > 1)
     {
         int[] combined = new int[data1.NumberOfRows() + data2.NumberOfRows()];
         Array.Copy(data1.Rows, combined, data1.NumberOfRows());
         Array.Copy(data2.Rows, 0, combined, data1.NumberOfRows(), data2.NumberOfRows());
         return(combined);
     }
     else
     {
         return(new int[2] {
             data1.OriginRow, data2.OriginRow
         });
     }
 }
示例#2
0
 /// <summary>
 /// Function that evaluates whether two data groups can be compared.
 /// </summary>
 /// <param name="data1">First data group to compare</param>
 /// <param name="data2">Second data group to compare</param>
 /// <returns>Returns the index of the difference between the groups.</returns>
 private static bool AreGroupsComparable(QMCGroupData data1, QMCGroupData data2)
 {
     /*
      * Check if the number of rows which the data was produced is bigger than 1.
      * For example if we produced the data by simplifying the values from 1st row and 3rd row we are having
      * number of rows equal to 2 - 1,3.
      *
      */
     if (data1.NumberOfRows() > 1 && data2.NumberOfRows() > 1)
     {
         /*
          * If the values of the two data groups are produced by simpplifying more than one row
          * the two data groups are comparable only if
          * the substraction of the last row and the first row in the pair of rows that produced the values of the first group is equal to the one of the second group.
          * Ex: data group with values 00*1 produced by simplifying rows 1,3,5,7
          * and data group with values 01*1 produced by simplifying rows 9,11,13,15
          * 7-1 is equal to 6 and so is 15-9, also the substraction of the Origin Rows which is 9-1 is 8 which is
          * number produced by multiplying 2 by itself 3 times.
          * Taking in mind these tow conditions, this means the two groups are comparable.
          *
          *                                       IMPORTANT
          * This is only the case when we have produced the values of the variables in the table group
          * are columns with 0/1 grouped as multiples of power of 2 using the number of variables in descending order
          *
          */
         return(data1.GetAbsoluteRowComparableIndex() == data2.GetAbsoluteRowComparableIndex() &&
                IsNumberPowerOf2(data2.OriginRow - data1.OriginRow));
     }
     else
     {
         return(IsNumberPowerOf2(data2.OriginRow - data1.OriginRow));
     }
 }