test_class.declarator: features = {
          {1., 2., 3., 4.},
          {2., 3., 4., 1.},
          {3., 4., 1., 2.},
          {4., 1., 2., 3.}
      }
test_class.modifier: private
test_class.original_string: private double[][] features = {
          {1., 2., 3., 4.},
          {2., 3., 4., 1.},
          {3., 4., 1., 2.},
          {4., 1., 2., 3.}
      };
test_class.type: double[][]
test_class.var_name: features
test_class.declarator: labels = {1., 2., 3, 4.}
test_class.modifier: private
test_class.original_string: private double[] labels = {1., 2., 3, 4.};
test_class.type: double[]
test_class.var_name: labels
test_class.declarator: labelsInSortedOrder = {
          {1., 4., 3., 2.},
          {2., 1., 4., 3.},
          {3., 2., 1., 4.},
          {4., 3., 2., 1.}
      }
test_class.modifier: private
test_class.original_string: private double[][] labelsInSortedOrder = {
          {1., 4., 3., 2.},
          {2., 1., 4., 3.},
          {3., 2., 1., 4.},
          {4., 3., 2., 1.}
      };
test_class.type: double[][]
test_class.var_name: labelsInSortedOrder
test_class.declarator: featuresInSortedOrder = {
          {
              {1., 2., 3., 4.},
              {4., 1., 2., 3.},
              {3., 4., 1., 2.},
              {2., 3., 4., 1.},
          },
          {
              {2., 3., 4., 1.},
              {1., 2., 3., 4.},
              {4., 1., 2., 3.},
              {3., 4., 1., 2.},
          },
          {
              {3., 4., 1., 2.},
              {2., 3., 4., 1.},
              {1., 2., 3., 4.},
              {4., 1., 2., 3.},
          },
          {
              {4., 1., 2., 3.},
              {3., 4., 1., 2.},
              {2., 3., 4., 1.},
              {1., 2., 3., 4.},
          }
      }
test_class.modifier: private
test_class.original_string: private double[][][] featuresInSortedOrder = {
          {
              {1., 2., 3., 4.},
              {4., 1., 2., 3.},
              {3., 4., 1., 2.},
              {2., 3., 4., 1.},
          },
          {
              {2., 3., 4., 1.},
              {1., 2., 3., 4.},
              {4., 1., 2., 3.},
              {3., 4., 1., 2.},
          },
          {
              {3., 4., 1., 2.},
              {2., 3., 4., 1.},
              {1., 2., 3., 4.},
              {4., 1., 2., 3.},
          },
          {
              {4., 1., 2., 3.},
              {3., 4., 1., 2.},
              {2., 3., 4., 1.},
              {1., 2., 3., 4.},
          }
      };
test_class.type: double[][][]
test_class.var_name: featuresInSortedOrder
test_class.declarator: idx = new TreeDataIndex(features, labels)
test_class.modifier: private
test_class.original_string: private TreeDataIndex idx = new TreeDataIndex(features, labels);
test_class.type: TreeDataIndex
test_class.var_name: idx
test_class.file: modules/ml/src/test/java/org/apache/ignite/ml/tree/data/TreeDataIndexTest.java
test_class.identifier: TreeDataIndexTest
test_case.body: @Test
      public void filterTest() {
          TreeFilter filter1 = features -> features[0] > 2;
          TreeFilter filter2 = features -> features[1] > 2;
          TreeFilter filterAnd = filter1.and(features -> features[1] > 2);
  
          TreeDataIndex filtered1 = idx.filter(filter1);
          TreeDataIndex filtered2 = filtered1.filter(filter2);
          TreeDataIndex filtered3 = idx.filter(filterAnd);
  
          assertEquals(2, filtered1.rowsCount());
          assertEquals(4, filtered1.columnsCount());
          assertEquals(1, filtered2.rowsCount());
          assertEquals(4, filtered2.columnsCount());
          assertEquals(1, filtered3.rowsCount());
          assertEquals(4, filtered3.columnsCount());
  
          double[] obj1 = {3, 4, 1, 2};
          double[] obj2 = {4, 1, 2, 3};
          double[][] restObjs = new double[][] {obj1, obj2};
          int[][] restObjIndxInSortedOrderPerFeatures = new int[][] {
              {0, 1}, //feature 0
              {1, 0}, //feature 1
              {0, 1}, //feature 2
              {0, 1}, //feature 3
          };
  
          for (int featureId = 0; featureId < filtered1.columnsCount(); featureId++) {
              for (int k = 0; k < filtered1.rowsCount(); k++) {
                  int objId = restObjIndxInSortedOrderPerFeatures[featureId][k];
                  double[] obj = restObjs[objId];
                  assertArrayEquals(obj, filtered1.featuresInSortedOrder(k, featureId), 0.01);
              }
          }
  
          for (int featureId = 0; featureId < filtered2.columnsCount(); featureId++) {
              for (int k = 0; k < filtered2.rowsCount(); k++) {
                  assertArrayEquals(obj1, filtered2.featuresInSortedOrder(k, featureId), 0.01);
                  assertArrayEquals(obj1, filtered3.featuresInSortedOrder(k, featureId), 0.01);
              }
          }
      }
test_case.class_method_signature: TreeDataIndexTest.filterTest()
test_case.full_signature: @Test public void filterTest()
test_case.identifier: filterTest
test_case.invocations: and filter filter filter assertEquals rowsCount assertEquals columnsCount assertEquals rowsCount assertEquals columnsCount assertEquals rowsCount assertEquals columnsCount columnsCount rowsCount assertArrayEquals featuresInSortedOrder columnsCount rowsCount assertArrayEquals featuresInSortedOrder assertArrayEquals featuresInSortedOrder
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void filterTest()
focal_class.declarator: idx
focal_class.modifier: private final
focal_class.original_string: private final int[][] idx;
focal_class.type: int[][]
focal_class.var_name: idx
focal_class.declarator: features
focal_class.modifier: private final
focal_class.original_string: private final double[][] features;
focal_class.type: double[][]
focal_class.var_name: features
focal_class.declarator: labels
focal_class.modifier: private final
focal_class.original_string: private final double[] labels;
focal_class.type: double[]
focal_class.var_name: labels
focal_class.file: modules/ml/src/main/java/org/apache/ignite/ml/tree/data/TreeDataIndex.java
focal_class.identifier: TreeDataIndex
focal_class.class_method_signature: TreeDataIndex.TreeDataIndex(double[][] features, double[] labels)
focal_class.full_signature: public  TreeDataIndex(double[][] features, double[] labels)
focal_class.identifier: TreeDataIndex
focal_class.modifiers: public
focal_class.parameters: (double[][] features, double[] labels)
focal_class.signature:  TreeDataIndex(double[][] features, double[] labels)
focal_class.class_method_signature: TreeDataIndex.TreeDataIndex(int[][] idxProj, double[][] features, double[] labels)
focal_class.full_signature: private  TreeDataIndex(int[][] idxProj, double[][] features, double[] labels)
focal_class.identifier: TreeDataIndex
focal_class.modifiers: private
focal_class.parameters: (int[][] idxProj, double[][] features, double[] labels)
focal_class.signature:  TreeDataIndex(int[][] idxProj, double[][] features, double[] labels)
focal_class.class_method_signature: TreeDataIndex.labelInSortedOrder(int k, int featureId)
focal_class.full_signature: public double labelInSortedOrder(int k, int featureId)
focal_class.identifier: labelInSortedOrder
focal_class.modifiers: public
focal_class.parameters: (int k, int featureId)
focal_class.return: double
focal_class.signature: double labelInSortedOrder(int k, int featureId)
focal_class.class_method_signature: TreeDataIndex.featuresInSortedOrder(int k, int featureId)
focal_class.full_signature: public double[] featuresInSortedOrder(int k, int featureId)
focal_class.identifier: featuresInSortedOrder
focal_class.modifiers: public
focal_class.parameters: (int k, int featureId)
focal_class.return: double[]
focal_class.signature: double[] featuresInSortedOrder(int k, int featureId)
focal_class.class_method_signature: TreeDataIndex.featureInSortedOrder(int k, int featureId)
focal_class.full_signature: public double featureInSortedOrder(int k, int featureId)
focal_class.identifier: featureInSortedOrder
focal_class.modifiers: public
focal_class.parameters: (int k, int featureId)
focal_class.return: double
focal_class.signature: double featureInSortedOrder(int k, int featureId)
focal_class.class_method_signature: TreeDataIndex.filter(TreeFilter filter)
focal_class.full_signature: public TreeDataIndex filter(TreeFilter filter)
focal_class.identifier: filter
focal_class.modifiers: public
focal_class.parameters: (TreeFilter filter)
focal_class.return: TreeDataIndex
focal_class.signature: TreeDataIndex filter(TreeFilter filter)
focal_class.class_method_signature: TreeDataIndex.rowsCount()
focal_class.full_signature: public int rowsCount()
focal_class.identifier: rowsCount
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int rowsCount()
focal_class.class_method_signature: TreeDataIndex.columnsCount()
focal_class.full_signature: public int columnsCount()
focal_class.identifier: columnsCount
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int columnsCount()
focal_class.class_method_signature: TreeDataIndex.sortIndex(double[][] features, int col, int from, int to)
focal_class.full_signature: private void sortIndex(double[][] features, int col, int from, int to)
focal_class.identifier: sortIndex
focal_class.modifiers: private
focal_class.parameters: (double[][] features, int col, int from, int to)
focal_class.return: void
focal_class.signature: void sortIndex(double[][] features, int col, int from, int to)
focal_method.body: public TreeDataIndex filter(TreeFilter filter) {
          int projSize = 0;
          for (int i = 0; i < rowsCount(); i++) {
              if (filter.test(featuresInSortedOrder(i, 0)))
                  projSize++;
          }
  
          int[][] prj = new int[projSize][columnsCount()];
          for (int feature = 0; feature < columnsCount(); feature++) {
              int ptr = 0;
              for (int row = 0; row < rowsCount(); row++) {
                  if (filter.test(featuresInSortedOrder(row, feature)))
                      prj[ptr++][feature] = idx[row][feature];
              }
          }
  
          return new TreeDataIndex(prj, features, labels);
      }
focal_method.class_method_signature: TreeDataIndex.filter(TreeFilter filter)
focal_method.full_signature: public TreeDataIndex filter(TreeFilter filter)
focal_method.identifier: filter
focal_method.invocations: rowsCount test featuresInSortedOrder columnsCount columnsCount rowsCount test featuresInSortedOrder
focal_method.modifiers: public
focal_method.parameters: (TreeFilter filter)
focal_method.return: TreeDataIndex
focal_method.signature: TreeDataIndex filter(TreeFilter filter)