|
Class: TSTree
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
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.
queries
-
treeNodeClass
-
accessing
-
at: aString ifAbsent: exceptionBlock
-
(comment from inherited method)
return the value stored under akey.
Return the value from evaluating exceptionBlock if not found
-
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.
-
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
-
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
-
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
-
do: aBlock
-
(comment from inherited method)
evaluate aBlock for each value
searching
-
matchesForPrefix: aString
-
-
matchesForPrefix: aString do: aBlock
-
-
matchesForString: aString distance: aNumber
-
-
matchesForString: aString distance: aNumber do: aBlock
-
-
matchesForString: aString distance: aNumber limitNodes: maxNodes do: aBlock
-
testing
-
isFixedSize
-
return true if the receiver cannot grow
|