免费测试继续进行
来源:互联网 发布:平板电脑绘画软件 编辑:程序博客网 时间:2024/05/07 05:00
function List() {
this.list = new Array();
}
List.prototype.add = function(e) {
this.list.push(e);
return true;
};
List.prototype.clear = function() {
this.list = new Array();
};
List.prototype.contains = function(e) {
return this.indexOf(e) >= 0;
};
List.prototype.isEmpty = function() {
return this.size() == 0;
};
List.prototype.size = function() {
return this.list.length;
};
List.prototype.toArray = function() {
return this.list;
};
List.prototype.remove = function(index) {
assert(index >=0 && index < this.size(), "param is error!");
var tmp = this.get(index);
this.list.splice(index, 1);
return tmp;
};
List.prototype.compareTo = function(obj) {
assert(obj != null && obj instanceof Collection, "param type is error!");
var index = 0, tmp = null;
while(index < this.size() && index < obj.size()) {
tmp = this.get(index) > obj.get(index) ? 1 : this.get(index) < obj.get(index) ? -1 : 0;
if(tmp != 0) {
return tmp;
}
index++;
}
return tmp >= this.size() && tmp >= obj.size() ? 0 : tmp >= this.size() ? -1 : 1;
};
List.prototype.equals = function(obj) {
return this.compareTo(obj) == 0;
};
List.prototype.insert = function(index, e) {
assert(index >= 0 && index < this.size(), "param is error!");
this.list.splice(index, 0, e);
};
List.prototype.get = function(index) {
assert(index >= 0 && index < this.size(), "param is error!");
return this.list[index];
};
List.prototype.indexOf = function(e, fromIndex) {
return this.list.indexOf(e, fromIndex);
};
List.prototype.lastIndexOf = function(e, fromIndex) {
return this.list.lastIndexOf(e, fromIndex)
};
List.prototype.set = function(index, e) {
assert(index >= 0 && index < this.size(), "param is error!");
this.list[index] = e;
};
List.prototype.iterator = function() {
return new Iterator(this);
};
List.prototype.listIterator = function() {
return new ListIterator(this);
};
function Iterator(list) {
assert(list instanceof List, "param type is error!");
this.list = list;
this.curIdx = -1;
}
Iterator.prototype.hasNext = function() {
return this.curIdx + 1 < this.list.size();
};
Iterator.prototype.next = function() {
return this.list.get(++this.curIdx);
};
Iterator.prototype.remove = function() {
this.list.remove(this.curIdx--);
};
function ListIterator(list) {
Iterator.call(this, list);
}
ListIterator.prototype = new Iterator();
ListIterator.prototype.add = function(e) {
this.list.insert(this.curIdx + 1, e);
};
ListIterator.prototype.hasPrevious = function() {
return this.curIdx - 1 >= 0;
};
ListIterator.prototype.nextIndex = function() {
return this.curIdx + 1;
};
ListIterator.prototype.previous = function() {
return this.list.get(--this.curIdx);
};
ListIterator.prototype.previousIndex = function() {
return this.curIdx - 1;
};
ListIterator.prototype.set = function(e) {
this.list.set(this.curIdx, e);
};
function Set() {
List.call(this);
}
Set.prototype = new List();
Set.prototype.add = function(e) {
if(this.contains(e)) {
return false;
}
return this.add(e);
};
function Queue() {
this.list = new List();
}
Queue.prototype.add = function(e) {
return this.list.add(e);
};
Queue.prototype.remove = function() {
return this.list.shift();
};
Queue.prototype.element = function() {
return this.list.get[0];
};
Queue.prototype.isEmpty = function() {
return this.list.isEmpty();
};
Queue.prototype.clear = function() {
this.list.clear();
};
function Stack() {
this.list = new List();
}
Stack.prototype.push = function(e) {
return this.list.add(e);
};
Stack.prototype.pop = function() {
return this.list.pop();
};
Stack.prototype.peek = function() {
return this.list.get(this.list.size() - 1);
};
Stack.prototype.isEmpty = function() {
return this.list.isEmpty();
};
Stack.prototype.clear = function() {
this.list.clear();
};
function Entry(key, value) {
this.key = key;
this.value = value;
}
function Map() {
this.list = new Set();
}
Map.prototype.clear = function() {
this.list.clear();
};
Map.prototype.containsKey = function(key) {
var tmp = this.keySet();
return tmp.indexOf(key) >= 0;
};
Map.prototype.containsValue = function(value) {
var tmp = this.values();
return tmp.indexOf(value) >= 0;
};
Map.prototype.entrySet = function() {
return this.list;
};
Map.prototype.equals = function(map) {
assert(map instanceof Map, "param type is error!");
return this.list.equals(map.list);
};
Map.prototype.get = function(key) {
var tmp = this.keySet();
var index = tmp.indexOf(key);
return this.list.get(index);
};
Map.prototype.isEmpty = function() {
return this.list.isEmpty();
};
Map.prototype.keySet = function() {
var ite = this.entrySet().iterator();
var tmp = new Set();
while(ite.hasNext()) {
tmp.add(ite.next().key);
}
return tmp;
};
Map.prototype.put = function(key, value) {
var tmp = this.keySet();
if(tmp.indexOf(key) >= 0) {
return false;
}
return this.list.add(new Entry(key, value));
};
Map.prototype.remvoe = function(key) {
var index = this.list.indexOf(key);
return index < 0 ? null : this.list.remove(index);
};
Map.prototype.size = function() {
return this.list.size();
};
Map.prototype.values = function() {
var ite = this.entrySet().iterator();
var tmp = new List();
while(ite.hasNext()) {
tmp.add(ite.next().value);
}
return tmp;
};
- 免费测试继续进行
- 呃,继续招免费测试,模拟Java的StringBuilder类
- 继续测试RSS
- 继续做好测试员
- 2 继续测试
- CuteFTP试用期后继续免费使用
- 继续测试,一如既往的稳定
- 英语听力免费测试站点
- BACnet测试工具免费
- 免费测试空间id666
- 继续对AGG svg_viewer进行改进
- 继续对dubbo源码进行maven builder
- 淘宝宣布继续免费 50亿打造大淘宝
- IBM Bluemix试用到期后绑定信用卡继续免费使用
- CTS如何继续上一次测试
- 免费浏览器兼容测试工具
- DISC 免费性格测试题
- http免费接口测试公布
- Hibernate在Spring配dataSource
- Oracle中常用的命令大全
- 什么是NSObject
- 如何用SQL注入攻击登陆界面
- 排序算法实现及复杂度分析(一)
- 免费测试继续进行
- apache反向代理实现内网多台主机绑定不同域名
- 变态的LR---- LoadRunner
- 新一代Java Web开发框架JSF
- oracle中读写LOB类型字段
- 仿Google的搜索下拉框
- 18位公民身份证号码的编排规则
- JAVA自学之路 [原创 - 尚学堂科技 - 马士兵老师]
- 小议网站建设