refactoring
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 14 Aug 2022 05:55:03 +0000 (22:55 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 14 Aug 2022 05:55:03 +0000 (22:55 -0700)
src/language/stats/ctables.c

index 8f8d6c885f4d0ee5b3991d3d0a2833abc175ba16..5f7162fd2ad39134ce65c38130f1d231548cba1a 100644 (file)
@@ -4725,43 +4725,23 @@ ctables_prepare_table (struct ctables_table *t)
                     break;
 
                   case CTAT_ROW:
-                    if (a == PIVOT_AXIS_COLUMN && t->label_axis[PIVOT_AXIS_ROW] == PIVOT_AXIS_COLUMN)
-                      n_drop = 0;
-                    else if (a == PIVOT_AXIS_COLUMN && t->label_axis[PIVOT_AXIS_COLUMN] == PIVOT_AXIS_ROW)
-                      {
-                        drop_inner = true;
-                        n_drop = 0;
-                      }
-                    else if (a == PIVOT_AXIS_COLUMN && t->label_axis[PIVOT_AXIS_COLUMN] == PIVOT_AXIS_LAYER)
-                      {
-                        drop_inner = true;
-                        n_drop = 0;
-                      }
-                    else
-                      {
-                        n_drop = a == PIVOT_AXIS_COLUMN;
-                        if (a == PIVOT_AXIS_ROW && t->label_axis[PIVOT_AXIS_ROW] == PIVOT_AXIS_COLUMN)
-                          n_drop++;
-                      }
-                    break;
-
                   case CTAT_COL:
-                    if (a == PIVOT_AXIS_ROW && t->label_axis[PIVOT_AXIS_ROW] == PIVOT_AXIS_COLUMN)
+                    if (a == atb && t->label_axis[ata] == atb)
+                      n_drop = 0;
+                    else if (a == atb && t->label_axis[atb] == ata)
                       {
                         drop_inner = true;
                         n_drop = 0;
                       }
-                    else if (a == PIVOT_AXIS_ROW && t->label_axis[PIVOT_AXIS_COLUMN] == PIVOT_AXIS_ROW)
-                      n_drop = 0;
-                    else if (a == PIVOT_AXIS_ROW && t->label_axis[PIVOT_AXIS_ROW] == PIVOT_AXIS_LAYER)
+                    else if (a == atb && t->label_axis[atb] == PIVOT_AXIS_LAYER)
                       {
                         drop_inner = true;
                         n_drop = 0;
                       }
                     else
                       {
-                        n_drop = a == PIVOT_AXIS_ROW;
-                        if (a == PIVOT_AXIS_COLUMN && t->label_axis[PIVOT_AXIS_COLUMN] == PIVOT_AXIS_ROW)
+                        n_drop = a == atb;
+                        if (a == ata && t->label_axis[ata] == atb)
                           n_drop++;
                       }
                     break;