/**
  * Collapse the given fold if it's expanded and expand it if it's collapsed.
  *
  * <p><b>Note:</b> The hierarchy must be locked prior using of this method.
  *
  * @param f fold which state should be toggled.
  */
 public void toggle(Fold f) {
   if (f.isCollapsed()) {
     expand(f);
   } else { // expanded
     collapse(f);
   }
 }
 /**
  * Expand the given fold. <br>
  * Nothing is done if the fold is already expanded.
  *
  * <p><b>Note:</b> The hierarchy must be locked prior using of this method.
  *
  * @param f fold to be expanded.
  */
 public void expand(Fold f) {
   expand(Collections.singletonList(f));
 }