eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'TreeSet':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: TreeSet


Inheritance:

   Object
   |
   +--Collection
      |
      +--TreeSet

Package:
stx:libbasic2
Category:
Collections-Ordered-Trees
Version:
rev: 1.8 date: 2024/01/22 14:44:58
user: cg
file: TreeSet.st directory: libbasic2
module: stx stc-classLibrary: libbasic2
Author:
Avi Bryant

Description:


BTree and TSTree

A bunch of collection classes that are useful for building large indices of things.
It's especially geared towards people using OODBs like GOODS, but can be used it in the image too:
the BTree class is great for when you need to select numeric keys by range,
and TSTree makes a solid basis for full-text search.
TreeSet has an interesting optimized #intersection: that lets you compare two collections without
looking at every item of either.
I'm also going to be rolling some code in here from Benjamin Pollack specifically aimed at indexing
by date ranges, which lets you do quick queries of all the events that overlap with a specific week,
for instance.


[license:]
    Dual licensed under both SqueakL and MIT.
    This enables both base Squeak inclusion and 100% reuse.


Class protocol:

instance creation
o  keys: aBtreeKeys sortSelector: aSymbol

o  new
(comment from inherited method)
return an instance of myself without indexed variables

o  sortBy: aSymbol


Instance protocol:

initialize-release
o  initializeWithKeys: aBtreeKeys sortSelector: aSymbol
Modified (format): / 22-01-2024 / 15:36:49 / cg

plugs
o  keyForValue: anObject

o  value: anObject matches: otherObject

private
o  bucket: anArray includes: anObject

o  tree

public
o  add: anObject
Modified (format): / 22-01-2024 / 15:36:40 / cg

o  do: aBlock
(comment from inherited method)
evaluate the argument, aBlock for each element.
Return the receiver
(subclasses should care to also return the receiver,
in case do: is used in a chain of messages.)

o  includes: anObject
Modified (format): / 22-01-2024 / 15:36:43 / cg

o  intersect: aCollection
(comment from inherited method)
return a new set containing all elements of the receiver,
which are also contained in the argument collection.
For large collections you better use a Set for aCollection

o  remove: anObject
remove all occurrences of anObject
Warning:
This is inconsistent with the inherited collection>>remove:,
which only remove the first occurrence.
Should this be fixed?

o  sortSelector

testing
o  isFixedSize
return true if the receiver cannot grow



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sun, 16 Jun 2024 02:20:14 GMT