class OntologyAlgorithm {

  public static Set<TermId> getDescendents(
    Ontology ontology, TermId parentTermId) {
    ImmutableSet.Builder<TermId> descset = new ImmutableSet.Builder<>();
    Deque<TermId> stack = new ArrayDeque<>();
    stack.push(parentTermId);
    while (!stack.isEmpty()) {
      TermId tid = stack.pop();
      descset.add(tid);
      Set<TermId> directChildrenSet = getChildTerms(ontology, tid, false);
      directChildrenSet.forEach(stack::push);
    }
    return descset.build();
  }

  private  OntologyAlgorithm();

}