Ejemplo n.º 1
0
  public long recalculateChildCount() {
    // Reset the child count
    childCount = 0;

    if (hasChildren()) {
      for (TreeFacetField childNode : hierarchy) {
        childCount += childNode.recalculateChildCount();
      }
    }

    return getTotal();
  }
Ejemplo n.º 2
0
  private SortedSet<TreeFacetField> cloneHierarchy(SortedSet<TreeFacetField> orig) {
    SortedSet<TreeFacetField> cloned = null;

    if (orig != null) {
      cloned = new TreeSet<>(orig.comparator());

      for (TreeFacetField tff : orig) {
        cloned.add(tff.clone());
      }
    }

    return cloned;
  }
Ejemplo n.º 3
0
  @Override
  public int compareTo(TreeFacetField o) {
    int ret = 0;

    if (o == null) {
      ret = 1;
    } else {
      ret = (int) (getTotal() - o.getTotal());
      if (ret == 0) {
        // If the totals are the same, compare the count as well.
        ret = (int) (count - o.count);
        if (ret == 0) {
          // If the counts are also the same, compare the ID as well, to double-check
          // whether they're actually the same entry
          ret = getValue().compareTo(o.getValue());
        }
      }
    }

    return ret;
  }