QiFeng.ZWY.MagWeb/Content/admin/dist/js/dictMapHelper.js

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

function DictMapFunc (keyCompFunc) {  
    this._keys = new Array();  
    this._vals = new Array();  
  
    this._comp = function (k1, k2) {  
        return (k1==k2);  
    }  
    this.npos = -1; // DONOT change this  
  
    if (keyCompFunc != null)  
        this._comp = keyCompFunc;  
  
    this.insert = function (key, value) {  
        for (var i=0; i<this._keys.length; i++) {  
            if (this._comp(this._keys[i], key)) {  
                this._vals[i] = value;  
                return;  
            }        
        }  
        this._keys.push(key);  
        this._vals.push(value);          
    }  
  
    this.size = function () {  
        return this._keys.length;  
    }  
    
    this.find = function (key) {  
        for (var i=0; i<this._keys.length; i++) {  
            if (this._comp(this._keys[i], key)) {  
                return i;  
            }  
        }  
        return this.npos;  
    }  
  
    this.getKey = function (i) {  
        return this._keys[i];  
    }  
  
    this.getVal = function (i) {  
        return this._vals[i];  
    }
    
    this.setVal = function (i, val) {
        return this._vals[i]=val;
    }
    
    this.erase = function (key) {  
        var at = this.find(key);  
        if (at != this.npos) {  
            this._keys.splice(at, 1);  
            this._vals.splice(at, 1);        
            return true;  
        }  
        return false;  
    }  
  
    this.clear = function () {  
        this._keys.splice(0);  
后面还有 3 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。