/* vim: ts=2 sw=2 expandtab
 * BEGIN FLOCK GPL
 *
 * Copyright Flock Inc. 2005-2009
 * http://flock.com
 *
 * This file may be used under the terms of the
 * GNU General Public License Version 2 or later (the "GPL"),
 * http://www.gnu.org/licenses/gpl.html
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * END FLOCK GPL
 */
 
#ifndef flockPriorityQueue___h___
#define flockPriorityQueue___h___

#include "flockIPriorityQueue.h"
#include "nsCOMPtr.h"
#include "nsIArray.h"
#include "nsIEnumerator.h"


class flockPriorityQueue : public flockIPriorityQueue
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_FLOCKIPRIORITYQUEUE

  flockPriorityQueue();
	PRBool HasMoreElements();
	
private:
  ~flockPriorityQueue();
  void up(PRUint32 childIndex);
  void down(PRUint32 parentIndex);
  int compare(nsISupports *left, nsISupports *right);

protected:
	nsCOMPtr<nsIMutableArray> mDataArray;
};

class flockPQEnumerator : public flockIPQEnumerator
{
public:
	NS_DECL_FLOCKIPQENUMERATOR
	
	flockPQEnumerator();
private:
	~flockPQEnumerator();
	
	nsCOMPtr<flockPriorityQueue> mFlockPriorityQueue;
protected:
};

nsresult NS_COM FLOCK_NewPriorityQueue(flockIPriorityQueue **aResult);

#endif // flockPriorityQueue__h__
