private double predictUsingCurtailment(Example example, ExtendedTree node) {
    double dPrediction = 0;

    if (node.isLeaf()) {
      dPrediction = predictAsLeaf(example, node);
    } else {
      boolean bEdgeConditionFound = false;
      Iterator<Edge> childIterator = node.childIterator();
      while ((childIterator.hasNext()) && (bEdgeConditionFound == false)) {
        Edge edge = childIterator.next();
        SplitCondition condition = edge.getCondition();
        if (condition.test(example)) {
          bEdgeConditionFound = true;
          ExtendedTree childTree = (ExtendedTree) edge.getChild();
          if (childTree.getTotalExamples() >= dCurtailmentThreshold)
            dPrediction = (predictUsingCurtailment(example, childTree));
          else dPrediction = predictAsLeaf(example, node);
        }
      }

      if (bEdgeConditionFound == false) {
        dPrediction = predictAsLeaf(example, node);
      }
    }

    return dPrediction;
  }
  private double predictAsLeaf(Example example, ExtendedTree node) {
    double dPrediction = 0;
    Iterator<String> s = node.getCounterMap().keySet().iterator();
    int[] counts = new int[getLabel().getMapping().size()];
    int sum = 0;
    while (s.hasNext()) {
      String className = s.next();
      int count = node.getCount(className);
      int index = getLabel().getMapping().getIndex(className);
      counts[index] = count;
      sum += count;
    }
    for (int i = 0; i < counts.length; i++) {
      example.setConfidence(
          getLabel().getMapping().mapIndex(i), smoothedConfidence(counts[i], sum));
    }

    dPrediction = getLabel().getMapping().getIndex(node.getLabel());

    return dPrediction;
  }