예제 #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);
 }
예제 #2
0
 /** Returns the dimension IDs, in order of tree level, to this node. */
 public List<Integer> getPathDimensions() {
   StarTreeIndexNode current = this;
   List<Integer> dimensions = new LinkedList<Integer>();
   while (current != null && current.getParent() != null) {
     dimensions.add(0, current.getDimensionName());
     current = current.getParent();
   }
   return dimensions;
 }
예제 #3
0
 /** Returns the dimension values, in order of tree level, to this node. */
 public Map<Integer, Integer> getPathValues() {
   StarTreeIndexNode current = this;
   Map<Integer, Integer> values = new HashMap<Integer, Integer>();
   while (current != null && current.getParent() != null) {
     values.put(current.getDimensionName(), current.getDimensionValue());
     current = current.getParent();
   }
   return values;
 }
예제 #4
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);
      }
    }
  }
예제 #5
0
 @Override
 public boolean equals(Object o) {
   if (!(o instanceof StarTreeIndexNode)) {
     return false;
   }
   StarTreeIndexNode n = (StarTreeIndexNode) o;
   return Objects.equal(nodeId, n.getNodeId())
       && Objects.equal(level, n.getLevel())
       && Objects.equal(dimensionName, n.getDimensionName())
       && Objects.equal(dimensionValue, n.getDimensionValue())
       && Objects.equal(childDimensionName, n.getChildDimensionName())
       && Objects.equal(children, n.getChildren())
       && Objects.equal(startDocumentId, n.getStartDocumentId())
       && Objects.equal(documentCount, n.getDocumentCount());
 }