Example #1
0
 public StarTreeIndexNode getMatchingNode(StarTreeIndexNode node, List<Integer> dimensions) {
   if (node == null || node.isLeaf()) {
     return node;
   }
   Integer childDimensionName = node.getChildDimensionName();
   Integer childDimensionValue = dimensions.get(childDimensionName);
   StarTreeIndexNode child = node.getChildren().get(childDimensionValue);
   return getMatchingNode(child, dimensions);
 }
Example #2
0
 /** Collects all the StarTree leaves that match the provided dimension values */
 private void findMatchingLeaves(
     StarTreeIndexNode node, List<Integer> values, Set<StarTreeIndexNode> leaves) {
   if (node.isLeaf()) {
     leaves.add(node);
   } else {
     Integer value = values.get(node.getChildDimensionName());
     findMatchingLeaves(node.getChildren().get(value), values, leaves);
     findMatchingLeaves(node.getChildren().get(StarTreeIndexNode.all()), values, leaves);
   }
 }
Example #3
0
  public static void printTree(StarTreeIndexNode node, int level) {
    for (int i = 0; i < level; i++) {
      System.out.print("  ");
    }
    System.out.println(node);

    if (!node.isLeaf()) {
      for (StarTreeIndexNode child : node.getChildren().values()) {
        printTree(child, level + 1);
      }
    }
  }