From 2eda731c5f01f71ba16fe7adee3c303983825e6b Mon Sep 17 00:00:00 2001 From: n8allan <3095770+n8allan@users.noreply.github.com> Date: Mon, 26 Feb 2024 09:56:30 -0700 Subject: [PATCH] Fixed bug with inverted on result for insert. --- docs/classes/BTree.html | 58 +++++++++++++++++--------------- docs/classes/KeyBound.html | 4 +-- docs/classes/KeyRange.html | 4 +-- docs/classes/Path.html | 4 +-- docs/classes/PathBranch.html | 4 +-- docs/index.html | 2 +- docs/variables/NodeCapacity.html | 2 +- package.json | 2 +- src/b-tree.ts | 9 +++-- test/b-tree.branching.test.ts | 4 +-- test/b-tree.dict.test.ts | 2 +- test/b-tree.one-leaf.test.ts | 2 +- 12 files changed, 51 insertions(+), 46 deletions(-) diff --git a/docs/classes/BTree.html b/docs/classes/BTree.html index bd9321b..b355d28 100644 --- a/docs/classes/BTree.html +++ b/docs/classes/BTree.html @@ -2,7 +2,7 @@ Allows for efficient storage and retrieval of data in a sorted manner.
Optional
keyFromEntry: ((entry) => TKey) = ...a function to extract the key from an entry. The default assumes the key is the entry itself.
Optional
compare: ((a, b) => 0 | 1 | -1) = ...a comparison function for keys. The default uses < and > operators.
-Private
_rootPrivate
Readonly
comparea comparison function for keys. The default uses < and > operators.
+Private
_rootPrivate
Readonly
comparea comparison function for keys. The default uses < and > operators.
Private
Readonly
keya function to extract the key from an entry. The default assumes the key is the entry itself.
+Private
Readonly
keya function to extract the key from an entry. The default assumes the key is the entry itself.
Private
branchProtected
comparePrivate
branchProtected
compareInvokes user-provided comperator to compare two keys. Inner-loop code, so this doesn't do backflips to iron out ES's idiosyncrasies (undefined quirks, infinity, nulls, etc.), but does ensure deterministic comparison. If you want to eak out more performance at the risk of corruption, you can override this method and omit the consistency check.
-Attempts to find the given key +
Private
firstPrivate
firstPrivate
getPrivate
getPrivate
getPrivate
indexPrivate
indexPrivate
getPrivate
getPrivate
getPrivate
indexPrivate
indexPrivate
insertPrivate
leafInserts or updates depending on the existence of the given key, using callbacks to generate the new value.
-path to new entry and whether an update or insert attempted. +
path to the new (on = true) or conflicting (on = false) row.
+Private
insertPrivate
leafInserts or updates depending on the existence of the given key, using callbacks to generate the new value.
+path to new entry and whether an update or insert attempted. If getUpdated callback returns a row that is already present, the resulting path will not be on.
-Private
movePrivate
movePrivate
rebalancePrivate
rebalanceUpdates the entry at the given path to the given value. Deletes and inserts if the key changes.
+Private
movePrivate
movePrivate
rebalancePrivate
rebalanceUpdates the entry at the given path to the given value. Deletes and inserts if the key changes.
path to resulting entry and whether it was an update (as opposed to an insert). * on = true if update/insert succeeded. * wasUpdate = true if updated; false if inserted. @@ -83,7 +85,7 @@ * on = false if update/insert failed. * wasUpdate = true, given path is not on an entry * else newEntry's new key already present; returned path is "near" existing entry
-Private
updateGenerated using TypeDoc
The type of keys used for indexing the entries. This might be an element of TEntry, or TEntry itself.