Esempio n. 1
0
  /**
   * Returns the number of siblings of this node. A node is its own sibling (if it has no parent or
   * no siblings, this method returns <code>1</code>).
   *
   * @return the number of siblings of this node
   */
  public int getSiblingCount() {
    TreeNode myParent = getParent();

    if (myParent == null) {
      return 1;
    } else {
      return myParent.getChildCount();
    }
  }