/** * 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; }
$result = $this->getKey()->compare($obj->getKey()); if ($result == 0) { $result = $this->getLeft()->compare($obj->getLeft()); } if ($result == 0) { $result = $this->getRight()->compare($obj->getRight()); } return $result; } } //}>e /** * Main program. * * @param array $args Command-line arguments. * @return integer Zero on success; non-zero on failure. */ public static function main($args) { printf("BinaryTree main program.\n"); $status = 0; $bt = new BinaryTree(box(4)); $bt->attachLeft(new BinaryTree(box(2))); $bt->attachRight(new BinaryTree(box(6))); AbstractTree::test($bt); return $status; } } if (realpath($argv[0]) == realpath(__FILE__)) { exit(BinaryTree::main(array_slice($argv, 1))); }