Class Queue

Description

A generic queue of objects. It provides iterator functions next() and hasNext().

  • version: $Id: Queue.class.php,v 1.5 2007/09/04 20:25:54 adamfranco Exp $
  • license: GNU General Public License (GPL)
  • copyright: Copyright © 2005, Middlebury College

Located in /harmoni/core/utilities/Queue.class.php (line 14)


	
			
Variable Summary
integer $_nextPosition
array $_queue
boolean $_reversed
integer $_startPosition
Method Summary
Queue Queue ([boolean $reversed = false])
void add (object $object)
void clear ()
integer getSize ()
boolean hasNext ()
object Object next ()
boolean rewind ()
Variables
integer $_nextPosition (line 26)

The position in the array of the next element of the queue that will be returned when next() is called.

  • var: The position in the array of the next element of the queue that will be returned when next() is called.
array $_queue (line 20)

An array used to store the elements of the queue.

  • var: An array used to store the elements of the queue.
boolean $_reversed (line 43)

The order of extraction from the queue.

Indicates whether the order in which objects are extracted from the queue is FIFO ($_reversed = false) or FILO ($_reversed = true).

  • var: TRUE, if the queue is reversed.
integer $_startPosition (line 34)

The start position of the queue in the array. In a reversed queue, this would be the last element of the array. In a normal queue, this would equal zero.

  • var: The start position of the queue in the array.
Methods
Constructor Queue (line 52)

Constructor. Create a new Queue.

  • access: public
Queue Queue ([boolean $reversed = false])
  • boolean $reversed: The order of extraction from the queue.
add (line 79)

Add an object to the queue. The queue is automatically rewound at the end.

  • access: public
void add (object $object)
  • object $object: The object to add to the queue.
clear (line 64)

Clear the queue.

  • access: public
void clear ()
getSize (line 128)

Get the size of the queue.

  • return: The size of the queue
  • access: public
integer getSize ()
hasNext (line 119)
  • return: Whether there exists an object in the queue at the current position.
  • access: public
boolean hasNext ()
next (line 102)

Get the current element and increase the position by one.

  • return: at the current position in the queue and increase the position by one.
  • access: public
object Object next ()
rewind (line 137)

Rewind the queue if it is not reversed

  • return: True on sucess, false on failure (queue is reversed).
  • access: public
boolean rewind ()

Documentation generated on Wed, 19 Sep 2007 10:25:45 -0400 by phpDocumentor 1.3.0RC3