flymis/WebRoot/dojojs/src/collections/ArrayList.js
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*
Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
modified BSD license. For more information on Dojo licensing, see:
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.collections.ArrayList");
dojo.require("dojo.collections.Collections");
dojo.collections.ArrayList=function(/* array? */arr){
// summary
// Returns a new object of type dojo.collections.ArrayList
var items=[];
if(arr) items=items.concat(arr);
this.count=items.length;
this.add=function(/* object */obj){
// summary
// Add an element to the collection.
items.push(obj);
this.count=items.length;
};
this.addRange=function(/* array */a){
// summary
// Add a range of objects to the ArrayList
if(a.getIterator){
var e=a.getIterator();
while(!e.atEnd()){
this.add(e.get());
}
this.count=items.length;
}else{
for(var i=0; i<a.length; i++){
items.push(a[i]);
}
this.count=items.length;
}
};
this.clear=function(){
// summary
// Clear all elements out of the collection, and reset the count.
items.splice(0, items.length);
this.count=0;
};
this.clone=function(){
// summary
// Clone the array list
return new dojo.collections.ArrayList(items); // dojo.collections.ArrayList
};
this.contains=function(/* object */obj){
// summary
// Check to see if the passed object is a member in the ArrayList
for(var i=0; i < items.length; i++){
if(items[i] == obj) {
return true; // bool
}
}
后面还有 86 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。