Sorry, here it is the code:


<?php

/* Trying to use queues in PHP, let
 * see if that works.
 */

class ArrayQueue {

var $theArray = array();
var $currentSize;
var $front;
var $back;
var $DEFAULT_CAPACITY = 10;

function increment($x) {
  if(++$x == $theArray.length)
    $x = 0;
  return $x;
}

function ArrayQueue() {
  $theArray = ($DEFAULT_CAPACITY);
  ArrayQueue::makeEmpty();
}

function isEmpty() {
  return $currentSize = 0;
}

function enqueue($Obj) {
  if($currentSize == $theArray.length)
    ArrayQueue::doubleQueue();
  $back = ArrayQueue::increment($back);
  $theArray[$back] = $Obj;
  $currentSize++;
}

function makeEmpty() {
  $currentSize = 0;
  $front = 0;
  $back = -1;
}

function objReturn() {
 return $front;
}
}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to