Ejemplo n.º 1
0
  /**
   * isDescendant
   *
   * @param path TODO
   * @returns boolean
   */
  public boolean isDescendant(TreePath path) {

    // Variables
    Object[] treepath;
    int index;
    int index2;

    // Get Descendant path
    treepath = path.getPath();

    // Locate Start Index
    index = 0;
    index2 = 0;
    while (treepath[index] != this.path[index2]) {
      index++;
    } // while

    // Verify Paths
    while (treepath[index] == this.path[index2]) {
      index++;
      index2++;
    } // while

    // Check for descendant
    if (index2 != this.path.length) {
      return false;
    } // if

    // Is Descendant
    return true;
  } // isDescendant()
Ejemplo n.º 2
0
  /**
   * Constructor TreePath
   *
   * @param path TODO
   * @param element TODO
   */
  protected TreePath(TreePath path, Object element) {

    // Variables
    Object[] treepath;

    // Get Tree Path
    treepath = path.getPath();

    // Create Tree Path
    this.path = new Object[treepath.length + 1];
    System.arraycopy(treepath, 0, this.path, 0, treepath.length);
    this.path[treepath.length] = element;
  } // TreePath()