Beispiel #1
0
 clear = function (id) {
   var index = 0, set = map, i, path = [], args = argsCache[id];
   while (index < (length - 1)) {
     i = indexOf.call(set[0], args[index]);
     if (i === -1) {
       return;
     }
     path.push(set, i);
     set = set[1][i];
     ++index;
   }
   i = indexOf.call(set[0], args[index]);
   if (i === -1) {
     return;
   }
   id = set[1][i];
   set[0].splice(i, 1);
   set[1].splice(i, 1);
   while (!set[0].length && path.length) {
     i = path.pop();
     set = path.pop();
     set[0].splice(i, 1);
     set[1].splice(i, 1);
   }
   delete argsCache[id];
 };
Beispiel #2
0
 set = function (args) {
   var index = 0, set = map, i, length = args.length;
   if (length === 0) {
     set[length] = ++count;
   } else {
     if (!set[length]) {
       set[length] = [[], []];
     }
     set = set[length];
     while (index < (length - 1)) {
       i = indexOf.call(set[0], args[index]);
       if (i === -1) {
         i = set[0].push(args[index]) - 1;
         set[1].push([[], []]);
       }
       set = set[1][i];
       ++index;
     }
     i = indexOf.call(set[0], args[index]);
     if (i === -1) {
       i = set[0].push(args[index]) - 1;
     }
     set[1][i] = ++count;
   }
   argsCache[count] = args;
   return count;
 };
Beispiel #3
0
 clear = function (id) {
   var index = indexOf.call(map2, id);
   if (index !== -1) {
     map1.splice(index, 1);
     map2.splice(index, 1);
   }
 };
Beispiel #4
0
 get = conf.get = function (args) {
   var index = 0, set = map, i;
   while (index < (length - 1)) {
     i = indexOf.call(set[0], args[index]);
     if (i === -1) {
       return null;
     }
     set = set[1][i];
     ++index;
   }
   i = indexOf.call(set[0], args[index]);
   if (i === -1) {
     return null;
   }
   return set[1][i] || null;
 };
Beispiel #5
0
 set = function (args) {
   var index = 0, set = map, i;
   while (index < (length - 1)) {
     i = indexOf.call(set[0], args[index]);
     if (i === -1) {
       i = set[0].push(args[index]) - 1;
       set[1].push([[], []]);
     }
     set = set[1][i];
     ++index;
   }
   i = indexOf.call(set[0], args[index]);
   if (i === -1) {
     i = set[0].push(args[index]) - 1;
   }
   set[1][i] = ++count;
   argsCache[count] = args;
   return count;
 };
Beispiel #6
0
 get = conf.get = function (args) {
   var index = 0, set = map, i, length = args.length;
   if (length === 0) {
     return set[length] || null;
   } else if ((set = set[length])) {
     while (index < (length - 1)) {
       i = indexOf.call(set[0], args[index]);
       if (i === -1) {
         return null;
       }
       set = set[1][i];
       ++index;
     }
     i = indexOf.call(set[0], args[index]);
     if (i === -1) {
       return null;
     }
     return set[1][i] || null;
   }
   return null;
 };
Beispiel #7
0
 get = conf.get = function (args) {
   var index = indexOf.call(map1, args[0]);
   return (index === -1) ? null : map2[index];
 };