eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'TSTree':

Home

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

Class: TSTree


Inheritance:

   Object
   |
   +--Collection
      |
      +--KeyedCollection
         |
         +--TSTree
            |
            +--TSMultiTree

Package:
stx:libbasic2
Category:
Collections-Ordered-Trees
Version:
rev: 1.13 date: 2023/06/04 13:03:08
user: cg
file: TSTree.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. 

TSTree has similar properties as BTree for String  keys. 
So as well as keeping them sorted, you can do efficient lookups of all 
the keys with a given prefix.  One other neat trick TSTree can do is a certain 
amount of fuzzy matching (eg find all keys with an edit distance of 3 from 
'foo') which makes it especially useful for spell checking and similar 
applications.


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


Class protocol:

queries
o  treeNodeClass


Instance protocol:

accessing
o  at: aString ifAbsent: exceptionBlock
(comment from inherited method)
return the value stored under akey.
Return the value from evaluating exceptionBlock if not found

o  at: aString put: anObject
(comment from inherited method)
add the argument anObject under key, aKey to the receiver.
Return anObject (sigh).
WARNING: do not add elements while iterating over the receiver.
Iterate over a copy to do this.

o  removeKey: aString
(comment from inherited method)
remove key (and the value stored under that key) from the
receiver; raise an error if no such element is contained

o  removeKey: aString ifAbsent: errorBlock
(comment from inherited method)
remove key (and the value stored under that key) from the
receiver; return the value which was stored previously there.
If no such element is contained, return the value
from evaluating exceptionBlock

o  values
(comment from inherited method)
return a collection containing all values of the receiver.
This is to make value access to an OrderedDictionary compatible with any-Collection

enumerating
o  do: aBlock
(comment from inherited method)
evaluate aBlock for each value

searching
o  matchesForPrefix: aString

o  matchesForPrefix: aString do: aBlock

o  matchesForString: aString distance: aNumber

o  matchesForString: aString distance: aNumber do: aBlock

o  matchesForString: aString distance: aNumber limitNodes: maxNodes do: aBlock

testing
o  isFixedSize
return true if the receiver cannot grow



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 06:41:21 GMT