8.6. File tom/BucketElement

class tom.BucketElement

inherits

State supers: State

instance tom.BucketElement

variables

public id next;

The next element in this bucket.

methods


void
  do Block block;

Apple the block to self and pass to next.


Any
  member All key
pre
  key != nil;

Return the value associated with the key, asking the next element if this element does not match.

The implementation by BucketElement considers itself to be both the key and the value.


Any
  member All key
   equal selector cmp
pre
  key != nil;

Like member, but using the selector cmp to have the objects compare themselves.


Any
  memq All key
pre
  key != nil;

Like member, but use reference equality instead of the equal method.


int
  addElement id elt;

Add the elt to this bucket, if it is not already present. Return the number by which this bucket's length has increased.


int
  addqElement id elt;

Add the elt to this bucket, if it is not already present. Return the number by which this bucket's length has increased.


(id, int) (replacement, decrease)
  remove id elt
post
  !decrease -> replacement == self;

Remove the elt from this bucket, if present. Return the number by which the length of this bucket has decreased, and the replacement remainder of the bucket list.


(id, int) (replacement, decrease)
  removeq id elt
post
  !decrease -> replacement == self;

Remove the elt from this bucket, if present. Return the number by which the length of this bucket has decreased, and the replacement remainder of the bucket list.


void
  resizing_feed HashTable ht;

For resizing a hashtable, feed this element and those following elements, to the hashtable using the hashtable's resizing_add.


void
  resizing_add id n;

While resizing a hashtable, accept a new next.


int
  rehash;

Rehash the key of the receiving element.


int
  rehashq;

Rehashq the key of the receiving element.


void
  encodeUsingCoder Encoder coder;

Undocumented.


void
  initWithCoder Decoder coder;

Undocumented.


(id, int)
  gc_mark_values;

Starting with this bucket element, remove those bucket elements of which the objects are gc_dead. Return the replacement for this element, and the number of bucket elements that were removed from this bucket list.