1 if(!dojo._hasResource["dojox.collections.Queue"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2 dojo._hasResource["dojox.collections.Queue"] = true;
3 dojo.provide("dojox.collections.Queue");
4 dojo.require("dojox.collections._base");
6 dojox.collections.Queue=function(/* array? */arr){
8 // return an object of type dojox.collections.Queue
14 this.clear=function(){
16 // clears the internal collection
20 this.clone=function(){
22 // creates a new Queue based on this one
23 return new dojox.collections.Queue(q); // dojox.collections.Queue
25 this.contains=function(/* object */ o){
27 // Check to see if the passed object is an element in this queue
28 for(var i=0; i<q.length; i++){
35 this.copyTo=function(/* array */ arr, /* int */ i){
37 // Copy the contents of this queue into the passed array at index i.
40 this.dequeue=function(){
42 // shift the first element off the queue and return it
47 this.enqueue=function(/* object */ o){
49 // put the passed object at the end of the queue
52 this.forEach=function(/* function */ fn, /* object? */ scope){
54 // functional iterator, following the mozilla spec.
55 dojo.forEach(q, fn, scope);
57 this.getIterator=function(){
59 // get an Iterator based on this queue.
60 return new dojox.collections.Iterator(q); // dojox.collections.Iterator
64 // get the next element in the queue without altering the queue.
67 this.toArray=function(){
69 // return an array based on the internal array of the queue.