Exemplo n.º 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 2.\n");
     $status = 0;
     StackAsArray::main($args);
     StackAsLinkedList::main($args);
     QueueAsArray::main($args);
     QueueAsLinkedList::main($args);
     DequeAsArray::main($args);
     DequeAsLinkedList::main($args);
     return $status;
 }
Exemplo n.º 2
0
    /**
     * Tail getter.
     *
     * @return object IOBject The object at the tail of this deque.
     */
    public function getTail()
    {
        if ($this->count == 0) {
            throw new ContainerEmptyException();
        }
        return $this->array[$this->tail];
    }
    //}>b
    /**
     * Main program.
     *
     * @param array $args Command-line arguments.
     * @return integer Zero on success; non-zero on failure.
     */
    public static function main($args)
    {
        printf("DequeAsArray main program.\n");
        $status = 0;
        $deque = new DequeAsArray(10);
        AbstractDeque::test($deque);
        return $status;
    }
}
if (realpath($argv[0]) == realpath(__FILE__)) {
    exit(DequeAsArray::main(array_slice($argv, 1)));
}