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); }
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); } } }
@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()); }