Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / collections / Queue.js @ 10

History | View | Annotate | Download (1.07 KB)

1
/*
2
        Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3
        Available via Academic Free License >= 2.1 OR the modified BSD license.
4
        see: http://dojotoolkit.org/license for details
5
*/
6

    
7

    
8
if(!dojo._hasResource["dojox.collections.Queue"]){
9
dojo._hasResource["dojox.collections.Queue"]=true;
10
dojo.provide("dojox.collections.Queue");
11
dojo.require("dojox.collections._base");
12
dojox.collections.Queue=function(_1){
13
var q=[];
14
if(_1){
15
q=q.concat(_1);
16
}
17
this.count=q.length;
18
this.clear=function(){
19
q=[];
20
this.count=q.length;
21
};
22
this.clone=function(){
23
return new dojox.collections.Queue(q);
24
};
25
this.contains=function(o){
26
for(var i=0;i<q.length;i++){
27
if(q[i]==o){
28
return true;
29
}
30
}
31
return false;
32
};
33
this.copyTo=function(_2,i){
34
_2.splice(i,0,q);
35
};
36
this.dequeue=function(){
37
var r=q.shift();
38
this.count=q.length;
39
return r;
40
};
41
this.enqueue=function(o){
42
this.count=q.push(o);
43
};
44
this.forEach=function(fn,_3){
45
dojo.forEach(q,fn,_3);
46
};
47
this.getIterator=function(){
48
return new dojox.collections.Iterator(q);
49
};
50
this.peek=function(){
51
return q[0];
52
};
53
this.toArray=function(){
54
return [].concat(q);
55
};
56
};
57
}