1/* keys can be any noun, values aren't constrained */
8 this.slots = new Array(32);
10Node.prototype = Object.create(Slot.prototype);
11Node.prototype.constructor = Node;
13Node.prototype.insert = function(key, val, lef, rem) {
17 rem &= ((1 << lef) - 1);
19 this.slots[inx] = ( undefined === this.slots[inx] )
20 ? new Single(key, val)
21 : this.slots[inx].insert(key, val, lef, rem);
25Node.prototype.get = function(key, lef, rem) {
29 rem &= ((1 << lef) - 1);
30 sot = this.slots[inx];
32 return ( undefined === sot ) ? undefined : sot.get(key, lef, rem);
38Bucket.prototype = Object.create(Slot.prototype);
39Bucket.prototype.constructor = Bucket;
41Bucket.prototype.insert = function(key, val, lef, rem) {
42 var s, a = this.singles;
44 for ( var i = 0; i < a.length; ++i ) {
46 if ( s.key.equals(key) ) {
51 a.push(new Single(key, val));
55Bucket.prototype.get = function(key, lef, rem) {
56 var s, a = this.singles;
58 for ( var i = 0; i < a.length; ++i ) {
60 if ( s.key.equals(key) ) {
68function Single(key, val) {
73Single.prototype = Object.create(Slot.prototype);
74Single.prototype.constructor = Single;
76Single.prototype.insert = function(key, val, lef, rem) {
77 if ( this.key.equals(key) ) {
82 var n, rom = this.key.mug() & ((1 << lef) - 1);
90 n.insert(this.key, this.val, lef, rom);
91 n.insert(key, val, lef, rem);
96Single.prototype.get = function(key, lef, rem) {
97 if ( this.key.equals(key) ) {
106 this.slots = new Array(64);
109NounMap.prototype.insert = function(key, val) {
112 var sot = this.slots;
113 if ( undefined === sot[inx] ) {
114 sot[inx] = new Single(key, val);
117 var rem = m & ((1 << 25) - 1);
118 sot[inx] = sot[inx].insert(key, val, 25, rem);
122NounMap.prototype.get = function(key) {
125 var sot = this.slots[inx];
126 if ( undefined === sot ) {
130 var rem = m & ((1 << 25) - 1);
131 return sot.get(key, 25, rem);
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list