Пример #1
0
 /**
  * Main program.
  *
  * @param array $args Command-line arguments.
  * @return integer Zero on succes; non-zero on failure.
  */
 public static function main($args)
 {
     printf("Demonstration program number 5.\n");
     $status = 0;
     GeneralTree::main($args);
     BinaryTree::main($args);
     NaryTree::main($args);
     BinarySearchTree::main($args);
     AVLTree::main($args);
     MWayTree::main($args);
     BTree::main($args);
     return $status;
 }
Пример #2
0
     * Compares this N-ary tree with the specified comparable object.
     * This method is not implemented.
     *
     * @param object IComparable $arg
     * The comparable object with which to compare this tree.
     */
    protected function compareTo(IComparable $arg)
    {
        throw new MethodNotImplementedException();
    }
    /**
     * Main program.
     *
     * @param array $args Command-line arguments.
     * @return integer Zero on success; non-zero on failure.
     */
    public static function main($args)
    {
        printf("NaryTree main program.\n");
        $status = 0;
        $nt = new NaryTree(3, box(1));
        $nt->attachSubtree(0, new NaryTree(3, box(2)));
        $nt->attachSubtree(1, new NaryTree(3, box(3)));
        $nt->attachSubtree(2, new NaryTree(3, box(4)));
        AbstractTree::test($nt);
        return $status;
    }
}
if (realpath($argv[0]) == realpath(__FILE__)) {
    exit(NaryTree::main(array_slice($argv, 1)));
}