无为清净楼资源网 Design By www.qnjia.com
修正hashtableobj.set("length","0") bug
可以设置key忽略大小写
可以clone hashtable对象
可以 使用obj.valueOf("key","defalutvalue") 设置默认值等等
欢迎修正bug
复制代码 代码如下:
<html>
<head>
<script type="text/javascript">
// Authors Birdshome, 麻袋@博客园 改版 phito,彭海涛
Object.prototype.Clone = function()
{
var objClone;
if ( this.constructor == Object ) objClone = new this.constructor();
else objClone = new this.constructor(this.valueOf());
for ( var key in this )
{
if ( objClone[key] != this[key] )
{
if ( typeof(this[key]) == 'object' )
{
objClone[key] = this[key].Clone();
}
else
{
objClone[key] = this[key];
}
}
}
objClone.toString = this.toString;
objClone.valueOf = this.valueOf;
return objClone;
}
function Hashtable() {
this.clear = hashtable_clear;
this.containsKey = hashtable_containsKey;
this.containsValue = hashtable_containsValue;
this.get = hashtable_get;
this.isEmpty = hashtable_isEmpty;
this.keys = hashtable_keys;
this.put = hashtable_put;
this.remove = hashtable_remove;
this.size = hashtable_size;
this.toString = hashtable_toString;
this.values = hashtable_values;
this.hashtable = new Object();
this.set = hashtable_set;
this.valueOf = hashtable_valueOf;
this.clone = hashtable_clone;
this.ignoreupperlower = true;
//是否忽略大小写
}
/*=======Private methods for internal use only========*/
function hashtable_clone(){
return this.Clone();
}
function hashtable_put(key, value) {
if (this.ignoreupperlower && typeof(key) == "string") {
key = key.toUpperCase();
}
if (key == null || value == null) {
throw "NullPointerException {" + key + "},{" + value + "}";
} else {
this.hashtable[key] = value;
}
}
function hashtable_set(key, value) {
if (this.ignoreupperlower && typeof(key) == "string") {
key = key.toUpperCase();
}
if (this.containsKey(key)) {
this.remove(key);
}
this.put(key, value);
}
function hashtable_get(key) {
if (this.ignoreupperlower && typeof(key) == "string") {
key = key.toUpperCase();
}
return this.hashtable[key];
}
function hashtable_valueOf(key, defvalue) {
var ret = this.get(key);
if (typeof(ret) == "undefined") {
return defvalue;
}
return ret;
}
function hashtable_remove(key) {
if (this.containsKey(key)) {
delete this.hashtable[key] ;
}
}
function hashtable_isEmpty() {
return (parseInt(this.size()) == 0) ? true: false;
}
function hashtable_size() {
var size = 0;
for (var i in this.hashtable) {
if(typeof(this.hashtable[i])=="function"){
continue;
}
if (this.hashtable[i] != null) {
size++;
}
}
return size;
}
function hashtable_toString() {
var result = "";
for (var i in this.hashtable) {
if(typeof(this.hashtable[i])=="function"){
continue;
}
if (this.hashtable[i] != null) {
result += "{" + i + ":" + this.hashtable[i] + "}\n";
}
}
return result;
}
function hashtable_clear() {
this.hashtable = new Object();
}
function hashtable_containsKey(key) {
if (this.ignoreupperlower && typeof(key) == "string") {
key = key.toUpperCase();
}
var exists = false;
for (var i in this.hashtable) {
if(typeof(this.hashtable[i])=="function"){
continue;
}
if (i == key && this.hashtable[i] != null) {
exists = true;
break;
}
}
return exists;
}
function hashtable_containsValue(value) {
var contains = false;
if (value != null) {
for (var i in this.hashtable) {
if(typeof(this.hashtable[i])=="function"){
continue;
}
if (this.hashtable[i] == value) {
contains = true;
break;
}
}
}
return contains;
}
function hashtable_values() {
var values = new Object();
for (var i in this.hashtable) {
if(typeof(this.hashtable[i])=="function"){
continue;
}
if (this.hashtable[i] != null) values.push(this.hashtable[i]);
}
return values;
}
function hashtable_keys() {
var keys = new Object();
for (var i in this.hashtable) {
if(typeof(this.hashtable[i])=="function"){
continue;
}
keys.push(i);
}
return keys;
}
function test() {
var ht = new Hashtable();
ht.put("3", "Jackson");
ht.put("2", "Tom");
ht.put("4", 3);
ht.set("length", 445555);
ht.set("ddd", "ddd");
ht.set("index", "ddd");
var et = ht.toString();
ht.ignoreupperlower = false;
//忽略大小写
ht.clear();
ht.put("3", "Jackson");
ht.put("2", "Tom");
ht.remove("2");
ht.put("4", 3);
ht.set("length", 5);
//如果用new Array的话该项会设置Array的长度
ht.set("index", "ddd");
ht.set("ddd", "ddd");
alert(et + "" + ht.toString() + "" + ht.size());
var cloneobj=ht.clone();
alert(cloneobj.toString());
}
</script>
</head>
<body onload="test()">
</body>
</html>
如果你想使用功能更好的hashtable和hashset请下载: http://xiazai.jb51.net/201012/yuanma/jshashtable.rar
可以设置key忽略大小写
可以clone hashtable对象
可以 使用obj.valueOf("key","defalutvalue") 设置默认值等等
欢迎修正bug
复制代码 代码如下:
<html>
<head>
<script type="text/javascript">
// Authors Birdshome, 麻袋@博客园 改版 phito,彭海涛
Object.prototype.Clone = function()
{
var objClone;
if ( this.constructor == Object ) objClone = new this.constructor();
else objClone = new this.constructor(this.valueOf());
for ( var key in this )
{
if ( objClone[key] != this[key] )
{
if ( typeof(this[key]) == 'object' )
{
objClone[key] = this[key].Clone();
}
else
{
objClone[key] = this[key];
}
}
}
objClone.toString = this.toString;
objClone.valueOf = this.valueOf;
return objClone;
}
function Hashtable() {
this.clear = hashtable_clear;
this.containsKey = hashtable_containsKey;
this.containsValue = hashtable_containsValue;
this.get = hashtable_get;
this.isEmpty = hashtable_isEmpty;
this.keys = hashtable_keys;
this.put = hashtable_put;
this.remove = hashtable_remove;
this.size = hashtable_size;
this.toString = hashtable_toString;
this.values = hashtable_values;
this.hashtable = new Object();
this.set = hashtable_set;
this.valueOf = hashtable_valueOf;
this.clone = hashtable_clone;
this.ignoreupperlower = true;
//是否忽略大小写
}
/*=======Private methods for internal use only========*/
function hashtable_clone(){
return this.Clone();
}
function hashtable_put(key, value) {
if (this.ignoreupperlower && typeof(key) == "string") {
key = key.toUpperCase();
}
if (key == null || value == null) {
throw "NullPointerException {" + key + "},{" + value + "}";
} else {
this.hashtable[key] = value;
}
}
function hashtable_set(key, value) {
if (this.ignoreupperlower && typeof(key) == "string") {
key = key.toUpperCase();
}
if (this.containsKey(key)) {
this.remove(key);
}
this.put(key, value);
}
function hashtable_get(key) {
if (this.ignoreupperlower && typeof(key) == "string") {
key = key.toUpperCase();
}
return this.hashtable[key];
}
function hashtable_valueOf(key, defvalue) {
var ret = this.get(key);
if (typeof(ret) == "undefined") {
return defvalue;
}
return ret;
}
function hashtable_remove(key) {
if (this.containsKey(key)) {
delete this.hashtable[key] ;
}
}
function hashtable_isEmpty() {
return (parseInt(this.size()) == 0) ? true: false;
}
function hashtable_size() {
var size = 0;
for (var i in this.hashtable) {
if(typeof(this.hashtable[i])=="function"){
continue;
}
if (this.hashtable[i] != null) {
size++;
}
}
return size;
}
function hashtable_toString() {
var result = "";
for (var i in this.hashtable) {
if(typeof(this.hashtable[i])=="function"){
continue;
}
if (this.hashtable[i] != null) {
result += "{" + i + ":" + this.hashtable[i] + "}\n";
}
}
return result;
}
function hashtable_clear() {
this.hashtable = new Object();
}
function hashtable_containsKey(key) {
if (this.ignoreupperlower && typeof(key) == "string") {
key = key.toUpperCase();
}
var exists = false;
for (var i in this.hashtable) {
if(typeof(this.hashtable[i])=="function"){
continue;
}
if (i == key && this.hashtable[i] != null) {
exists = true;
break;
}
}
return exists;
}
function hashtable_containsValue(value) {
var contains = false;
if (value != null) {
for (var i in this.hashtable) {
if(typeof(this.hashtable[i])=="function"){
continue;
}
if (this.hashtable[i] == value) {
contains = true;
break;
}
}
}
return contains;
}
function hashtable_values() {
var values = new Object();
for (var i in this.hashtable) {
if(typeof(this.hashtable[i])=="function"){
continue;
}
if (this.hashtable[i] != null) values.push(this.hashtable[i]);
}
return values;
}
function hashtable_keys() {
var keys = new Object();
for (var i in this.hashtable) {
if(typeof(this.hashtable[i])=="function"){
continue;
}
keys.push(i);
}
return keys;
}
function test() {
var ht = new Hashtable();
ht.put("3", "Jackson");
ht.put("2", "Tom");
ht.put("4", 3);
ht.set("length", 445555);
ht.set("ddd", "ddd");
ht.set("index", "ddd");
var et = ht.toString();
ht.ignoreupperlower = false;
//忽略大小写
ht.clear();
ht.put("3", "Jackson");
ht.put("2", "Tom");
ht.remove("2");
ht.put("4", 3);
ht.set("length", 5);
//如果用new Array的话该项会设置Array的长度
ht.set("index", "ddd");
ht.set("ddd", "ddd");
alert(et + "" + ht.toString() + "" + ht.size());
var cloneobj=ht.clone();
alert(cloneobj.toString());
}
</script>
</head>
<body onload="test()">
</body>
</html>
如果你想使用功能更好的hashtable和hashset请下载: http://xiazai.jb51.net/201012/yuanma/jshashtable.rar
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。
更新日志
2024年11月17日
2024年11月17日
- 中国武警男声合唱团《辉煌之声1天路》[DTS-WAV分轨]
- 紫薇《旧曲新韵》[320K/MP3][175.29MB]
- 紫薇《旧曲新韵》[FLAC/分轨][550.18MB]
- 周深《反深代词》[先听版][320K/MP3][72.71MB]
- 李佳薇.2024-会发光的【黑籁音乐】【FLAC分轨】
- 后弦.2012-很有爱【天浩盛世】【WAV+CUE】
- 林俊吉.2012-将你惜命命【美华】【WAV+CUE】
- 晓雅《分享》DTS-WAV
- 黑鸭子2008-飞歌[首版][WAV+CUE]
- 黄乙玲1989-水泼落地难收回[日本天龙版][WAV+CUE]
- 周深《反深代词》[先听版][FLAC/分轨][310.97MB]
- 姜育恒1984《什么时候·串起又散落》台湾复刻版[WAV+CUE][1G]
- 那英《如今》引进版[WAV+CUE][1G]
- 蔡幸娟.1991-真的让我爱你吗【飞碟】【WAV+CUE】
- 群星.2024-好团圆电视剧原声带【TME】【FLAC分轨】