mftsccs-node 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1148 -11
- package/dist/bundle.js +1 -1
- package/dist/types/Api/Create/CreateTheCharacter.d.ts +42 -0
- package/dist/types/Api/Create/CreateTheConceptApi.d.ts +50 -0
- package/dist/types/Api/Create/CreateTheConnectionApi.d.ts +51 -0
- package/dist/types/Api/Create/CreateTheTextData.d.ts +56 -0
- package/dist/types/Api/Delete/DeleteConceptInBackend.d.ts +43 -0
- package/dist/types/Api/DeleteConnectionApiBulk.d.ts +55 -0
- package/dist/types/Api/DeleteTheConcept.d.ts +64 -0
- package/dist/types/Api/DeleteTheConnection.d.ts +76 -0
- package/dist/types/Api/GetAiData.d.ts +36 -0
- package/dist/types/Api/GetAllConcepts.d.ts +42 -0
- package/dist/types/Api/GetAllConceptsByType.d.ts +45 -0
- package/dist/types/Api/GetAllConnections.d.ts +48 -0
- package/dist/types/Api/GetAllConnectionsOfComposition.d.ts +79 -0
- package/dist/types/Api/GetAllConnectionsOfCompositionBulk.d.ts +90 -0
- package/dist/types/Api/GetAllLinkerConnectionsFromTheConcept.d.ts +52 -0
- package/dist/types/Api/GetAllLinkerConnectionsToTheConcept.d.ts +61 -0
- package/dist/types/Api/GetAllPrefetchConnections.d.ts +51 -0
- package/dist/types/Api/GetCharacterDataByCharacter.d.ts +31 -0
- package/dist/types/Api/GetCompositionConnectionsBetweenTwoConcepts.d.ts +39 -0
- package/dist/types/Api/GetConcept.d.ts +47 -0
- package/dist/types/Api/GetConceptBulk.d.ts +68 -0
- package/dist/types/Api/GetConceptByCharacterAndType.d.ts +75 -0
- package/dist/types/Api/GetConceptByCharacterValue.d.ts +47 -0
- package/dist/types/Api/GetConnection.d.ts +49 -0
- package/dist/types/Api/GetConnectionBulk.d.ts +46 -0
- package/dist/types/Api/GetConnectionOfTheConcept.d.ts +50 -0
- package/dist/types/Api/GetConnectionToTheConcept.d.ts +56 -0
- package/dist/types/Api/GetReservedConnectionIds.d.ts +36 -0
- package/dist/types/Api/GetReservedIds.d.ts +37 -0
- package/dist/types/Api/Login.d.ts +38 -0
- package/dist/types/Api/MakeTheNameInBackend.d.ts +39 -0
- package/dist/types/Api/MakeTheTypeConceptApi.d.ts +40 -0
- package/dist/types/Api/RecursiveSearch.d.ts +43 -0
- package/dist/types/Api/Search/FreeschemaQueryApi.d.ts +46 -0
- package/dist/types/Api/Search/Search.d.ts +67 -0
- package/dist/types/Api/Search/SearchInternalApi.d.ts +69 -0
- package/dist/types/Api/Search/SearchLinkMultipleApi.d.ts +90 -0
- package/dist/types/Api/Search/SearchWithLinker.d.ts +97 -0
- package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryApi.d.ts +39 -0
- package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryDirect.d.ts +47 -0
- package/dist/types/Api/Session/CreateSession.d.ts +45 -0
- package/dist/types/Api/Session/CreateSessionVisit.d.ts +43 -0
- package/dist/types/Api/Signin.d.ts +48 -0
- package/dist/types/Api/Signup.d.ts +44 -0
- package/dist/types/Api/View/ViewInternalDataApi.d.ts +50 -0
- package/dist/types/Constants/ApiConstants.d.ts +226 -0
- package/dist/types/Constants/FormatConstants.d.ts +81 -0
- package/dist/types/DataStructures/BaseUrl.d.ts +210 -0
- package/dist/types/DataStructures/BinaryCharacterTree.d.ts +211 -0
- package/dist/types/DataStructures/BinaryTree.d.ts +139 -0
- package/dist/types/DataStructures/BinaryTypeTree.d.ts +196 -0
- package/dist/types/DataStructures/CharacterRepository.d.ts +109 -0
- package/dist/types/DataStructures/Composition/Composition.d.ts +103 -0
- package/dist/types/DataStructures/Composition/CompositionBinaryTree.d.ts +104 -0
- package/dist/types/DataStructures/Composition/CompositionNode.d.ts +202 -0
- package/dist/types/DataStructures/Concept.d.ts +110 -0
- package/dist/types/DataStructures/ConceptData.d.ts +292 -0
- package/dist/types/DataStructures/ConceptsToDraw.d.ts +168 -0
- package/dist/types/DataStructures/Connection.d.ts +76 -0
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionBinaryTree.d.ts +115 -0
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionNode.d.ts +169 -0
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionTypeTree.d.ts +82 -0
- package/dist/types/DataStructures/ConnectionData.d.ts +191 -0
- package/dist/types/DataStructures/Count/CountInfo.d.ts +73 -0
- package/dist/types/DataStructures/FilterSearch.d.ts +84 -0
- package/dist/types/DataStructures/IdentifierFlags.d.ts +34 -0
- package/dist/types/DataStructures/Local/LConcept.d.ts +105 -0
- package/dist/types/DataStructures/Local/LConnection.d.ts +83 -0
- package/dist/types/DataStructures/Local/LNode.d.ts +190 -0
- package/dist/types/DataStructures/Local/LocalBinaryCharacterTree.d.ts +133 -0
- package/dist/types/DataStructures/Local/LocalBinaryTree.d.ts +135 -0
- package/dist/types/DataStructures/Local/LocalBinaryTypeTree.d.ts +147 -0
- package/dist/types/DataStructures/Local/LocalConceptData.d.ts +100 -0
- package/dist/types/DataStructures/Local/LocalConnectionData.d.ts +109 -0
- package/dist/types/DataStructures/Local/LocalSyncData.d.ts +89 -0
- package/dist/types/DataStructures/PatcherStructure.d.ts +86 -0
- package/dist/types/DataStructures/ReferentInfo.d.ts +68 -0
- package/dist/types/DataStructures/ReservedIds.d.ts +101 -0
- package/dist/types/DataStructures/Responses/ErrorResponse.d.ts +184 -22
- package/dist/types/DataStructures/Responses/StandardResponses.d.ts +65 -0
- package/dist/types/DataStructures/Returner.d.ts +59 -0
- package/dist/types/DataStructures/Search/FreeschemaQuery.d.ts +165 -0
- package/dist/types/DataStructures/Search/SearchStructure.d.ts +69 -0
- package/dist/types/DataStructures/SearchQuery.d.ts +130 -0
- package/dist/types/DataStructures/Security/TokenStorage.d.ts +48 -0
- package/dist/types/DataStructures/Session/SessionData.d.ts +118 -0
- package/dist/types/DataStructures/SettingData.d.ts +32 -0
- package/dist/types/DataStructures/Settings.d.ts +27 -0
- package/dist/types/DataStructures/SigninModel.d.ts +50 -0
- package/dist/types/DataStructures/SignupModel.d.ts +50 -0
- package/dist/types/DataStructures/SyncData.d.ts +206 -0
- package/dist/types/DataStructures/TheCharacter.d.ts +87 -0
- package/dist/types/DataStructures/TheTexts.d.ts +92 -0
- package/dist/types/DataStructures/Transaction/Transaction.d.ts +294 -4
- package/dist/types/DataStructures/User/UserBinaryTree.d.ts +117 -0
- package/dist/types/DataStructures/User/UserNode.d.ts +130 -0
- package/dist/types/Database/GetConceptFromIndexDb.d.ts +9 -0
- package/dist/types/Database/NoIndexDb.d.ts +169 -0
- package/dist/types/Database/indexdblocal.d.ts +42 -0
- package/dist/types/Database/indexeddb.d.ts +43 -0
- package/dist/types/Drawing/ConceptDraw.d.ts +28 -0
- package/dist/types/Drawing/ConceptEvents.d.ts +46 -0
- package/dist/types/Helpers/CheckIfExists.d.ts +159 -0
- package/dist/types/Helpers/RemoveFromArray.d.ts +66 -0
- package/dist/types/Helpers/UniqueInsert.d.ts +28 -0
- package/dist/types/Services/CheckForConnectionDeletion.d.ts +190 -0
- package/dist/types/Services/Common/DecodeCountInfo.d.ts +54 -0
- package/dist/types/Services/Common/ErrorPosting.d.ts +49 -0
- package/dist/types/Services/Common/RegexFunction.d.ts +28 -0
- package/dist/types/Services/Composition/BuildComposition.d.ts +37 -0
- package/dist/types/Services/Composition/CompositionCache.d.ts +89 -0
- package/dist/types/Services/Composition/CreateCompositionCache.d.ts +43 -0
- package/dist/types/Services/Conversion/ConvertConcepts.d.ts +83 -0
- package/dist/types/Services/CreateBinaryTreeFromData.d.ts +38 -0
- package/dist/types/Services/CreateCharacterBinaryTreeFromData.d.ts +42 -0
- package/dist/types/Services/CreateConnectionBetweenTwoConcepts.d.ts +206 -0
- package/dist/types/Services/CreateDefaultConcept.d.ts +114 -0
- package/dist/types/Services/CreateTheComposition.d.ts +101 -0
- package/dist/types/Services/CreateTheConcept.d.ts +179 -0
- package/dist/types/Services/CreateTheConnection.d.ts +59 -0
- package/dist/types/Services/CreateTheConnectionGeneral.d.ts +127 -0
- package/dist/types/Services/CreateTypeTreeFromData.d.ts +43 -0
- package/dist/types/Services/Delete/DeleteConnectionByType.d.ts +52 -5
- package/dist/types/Services/Delete/GetAllConnectionByType.d.ts +57 -9
- package/dist/types/Services/DeleteConcept.d.ts +136 -0
- package/dist/types/Services/DeleteConnection.d.ts +194 -0
- package/dist/types/Services/FindConeceptsFromConnection.d.ts +179 -0
- package/dist/types/Services/FindConnectionsOfCompositionBulkInMemory.d.ts +157 -0
- package/dist/types/Services/GenerateHexNumber.d.ts +64 -0
- package/dist/types/Services/GetComposition.d.ts +331 -0
- package/dist/types/Services/GetCompositionBulk.d.ts +251 -3
- package/dist/types/Services/GetCompositionList.d.ts +130 -0
- package/dist/types/Services/GetConceptByCharacter.d.ts +84 -0
- package/dist/types/Services/GetConnections.d.ts +72 -0
- package/dist/types/Services/GetDataFromIndexDb.d.ts +79 -0
- package/dist/types/Services/GetLink.d.ts +104 -0
- package/dist/types/Services/GetLinkerConnectionFromConcept.d.ts +99 -0
- package/dist/types/Services/GetMaximumConnectionSyncTime.d.ts +57 -0
- package/dist/types/Services/GetRelation.d.ts +162 -0
- package/dist/types/Services/GetTheConcept.d.ts +71 -0
- package/dist/types/Services/GetTheReferent.d.ts +74 -0
- package/dist/types/Services/InitializeSystem.d.ts +119 -0
- package/dist/types/Services/Local/CreateDefaultLConcept.d.ts +48 -0
- package/dist/types/Services/Local/CreateLocalBinaryTreeFromData.d.ts +49 -0
- package/dist/types/Services/Local/CreateLocalBinaryTypeTreeFromData.d.ts +54 -0
- package/dist/types/Services/Local/CreateLocalCharacterBinaryTree.d.ts +60 -0
- package/dist/types/Services/Local/CreateTheCompositionLocal.d.ts +70 -0
- package/dist/types/Services/Local/CreateTheConceptLocal.d.ts +58 -0
- package/dist/types/Services/Local/CreateTheConnectionLocal.d.ts +56 -0
- package/dist/types/Services/Local/GetCompositionListLocal.d.ts +103 -0
- package/dist/types/Services/Local/GetCompositionLocal.d.ts +96 -0
- package/dist/types/Services/Local/GetConceptByCharacterLocal.d.ts +57 -0
- package/dist/types/Services/Local/MakeTheConceptLocal.d.ts +71 -0
- package/dist/types/Services/Local/MakeTheInstanceConceptLocal.d.ts +89 -0
- package/dist/types/Services/Local/MakeTheTypeLocal.d.ts +71 -0
- package/dist/types/Services/Local/UpdateCompositionLocal.d.ts +101 -0
- package/dist/types/Services/MakeTheCharacter.d.ts +74 -0
- package/dist/types/Services/MakeTheCharacterData.d.ts +65 -0
- package/dist/types/Services/MakeTheInstanceConcept.d.ts +75 -0
- package/dist/types/Services/MakeTheName.d.ts +81 -0
- package/dist/types/Services/MakeTheTimestamp.d.ts +68 -0
- package/dist/types/Services/MakeTheTypeConcept.d.ts +68 -0
- package/dist/types/Services/Mqtt/publishMessage.d.ts +27 -0
- package/dist/types/Services/Mqtt/subscribeMessage.d.ts +23 -0
- package/dist/types/Services/PatchComposition.d.ts +105 -0
- package/dist/types/Services/Search/DataIdFormat.d.ts +96 -24
- package/dist/types/Services/Search/FormatData.d.ts +92 -17
- package/dist/types/Services/Search/JustIdFormat.d.ts +91 -16
- package/dist/types/Services/Search/SearchLinkInternal.d.ts +28 -0
- package/dist/types/Services/Search/SearchLinkMultiple.d.ts +58 -0
- package/dist/types/Services/Search/SearchWithTypeAndLinker.d.ts +92 -24
- package/dist/types/Services/Search/orderingConnections.d.ts +34 -0
- package/dist/types/Services/SplitStrings.d.ts +50 -0
- package/dist/types/Services/UpdateComposition.d.ts +123 -0
- package/dist/types/Services/User/UserTranslation.d.ts +102 -0
- package/dist/types/Services/View/ViewInternalData.d.ts +32 -0
- package/dist/types/WrapperFunctions/SchemaQueryObservable.d.ts +140 -5
- package/dist/types/app.d.ts +72 -1
- package/package.json +1 -1
- package/dist/main.bundle.js +0 -2
- package/dist/main.bundle.js.LICENSE.txt +0 -1
- package/dist/serviceWorker.bundle.js +0 -2
- package/dist/serviceWorker.bundle.js.LICENSE.txt +0 -1
- package/dist/types/AccessTracker/accessTracker.d.ts +0 -67
- package/dist/types/Anomaly/anomaly.d.ts +0 -103
- package/dist/types/Api/Create/CreateTheGhostConceptApi.d.ts +0 -3
- package/dist/types/Api/Create/CreateTheGhostConnectionApi.d.ts +0 -2
- package/dist/types/Api/Delete/DeleteUserInBackend.d.ts +0 -1
- package/dist/types/Api/DeleteConnectionBulkApi.d.ts +0 -1
- package/dist/types/Api/GetConnections/GetConnectionsByTypeApi.d.ts +0 -3
- package/dist/types/Api/Images/GetImages.d.ts +0 -1
- package/dist/types/Api/Local/GetLocalConceptByCharacterValue.d.ts +0 -2
- package/dist/types/Api/Prototype/CreatePrototype.d.ts +0 -2
- package/dist/types/Api/Prototype/Selector.d.ts +0 -15
- package/dist/types/Api/Search/SearchWithTypeAndLinker.d.ts +0 -2
- package/dist/types/Api/SearchConcept/GetTypeConceptByBulk.d.ts +0 -2
- package/dist/types/Api/Translate/TranslateLocalToReal.d.ts +0 -2
- package/dist/types/Constants/AccessConstants.d.ts +0 -3
- package/dist/types/Constants/ckeditorCSS.d.ts +0 -1
- package/dist/types/Constants/general.const.d.ts +0 -6
- package/dist/types/Constants/page.const.d.ts +0 -5
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionOfNode.d.ts +0 -10
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionOfTheTree.d.ts +0 -24
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionTypeNode.d.ts +0 -10
- package/dist/types/DataStructures/ConnectionBinaryTree/NodePrimitive.d.ts +0 -15
- package/dist/types/DataStructures/ConnectionByType/GetConnectionByType.d.ts +0 -4
- package/dist/types/DataStructures/Local/LocalGhostIdTree.d.ts +0 -11
- package/dist/types/DataStructures/Local/LocalId.d.ts +0 -19
- package/dist/types/DataStructures/Prototype/Prototype.d.ts +0 -19
- package/dist/types/DataStructures/Prototype/PrototypeOption.d.ts +0 -4
- package/dist/types/DataStructures/Prototype/QuerySelector.d.ts +0 -4
- package/dist/types/DataStructures/TypeLibrary.d.ts +0 -19
- package/dist/types/DataStructures/TypeNode.d.ts +0 -18
- package/dist/types/DataStructures/WidgetCache/WidgetCache.d.ts +0 -10
- package/dist/types/DataStructures/WidgetCache/WidgetDetails.d.ts +0 -9
- package/dist/types/DataStructures/WidgetCache/WidgetNode.d.ts +0 -18
- package/dist/types/Database/IndexUpdate.d.ts +0 -47
- package/dist/types/Middleware/ApplicationMonitor.d.ts +0 -14
- package/dist/types/Middleware/ErrorHandling.d.ts +0 -0
- package/dist/types/Middleware/logger.service.d.ts +0 -144
- package/dist/types/ServiceWorker/actions/connectionActions.d.ts +0 -2
- package/dist/types/ServiceWorker/actions/createActions.d.ts +0 -2
- package/dist/types/ServiceWorker/actions/deleteActions.d.ts +0 -2
- package/dist/types/ServiceWorker/actions/getActions.d.ts +0 -2
- package/dist/types/ServiceWorker/actions/index.d.ts +0 -15
- package/dist/types/ServiceWorker/actions/searchActions.d.ts +0 -2
- package/dist/types/ServiceWorker/actions/syncActions.d.ts +0 -2
- package/dist/types/ServiceWorker/actions/updateActions.d.ts +0 -2
- package/dist/types/ServiceWorker/index.d.ts +0 -11
- package/dist/types/Services/AccessControl/AccessControl.d.ts +0 -218
- package/dist/types/Services/Common/DelayFunction.d.ts +0 -7
- package/dist/types/Services/Common/MergeArrays.d.ts +0 -7
- package/dist/types/Services/Common/RemoveAllChild.d.ts +0 -1
- package/dist/types/Services/CreateConnection/CreateConnectionEntity.d.ts +0 -2
- package/dist/types/Services/DeleteConnectionByType.d.ts +0 -22
- package/dist/types/Services/GetConnectionBetweenTwoConceptsLinker.d.ts +0 -11
- package/dist/types/Services/Local/ConvertFromLConceptToConcept.d.ts +0 -2
- package/dist/types/Services/Local/ConvertFromLConnectionToConnection.d.ts +0 -2
- package/dist/types/Services/Local/CreateConnectionBetweenTwoConceptsLocal.d.ts +0 -3
- package/dist/types/Services/Local/DeleteConceptLocal.d.ts +0 -1
- package/dist/types/Services/Local/GetConnectionOfTheConceptLocal.d.ts +0 -2
- package/dist/types/Services/Local/GetRelationLocal.d.ts +0 -1
- package/dist/types/Services/Local/GetTheConceptLocal.d.ts +0 -9
- package/dist/types/Services/Logs/LogEvent.d.ts +0 -1
- package/dist/types/Services/Mail.d.ts +0 -18
- package/dist/types/Services/Transaction/LocalTransaction.d.ts +0 -45
- package/dist/types/Services/Upload.d.ts +0 -33
- package/dist/types/Services/User/UserFromLocalStorage.d.ts +0 -6
- package/dist/types/Services/assets/GetImageService.d.ts +0 -14
- package/dist/types/Services/automated/automated-concept-connection.d.ts +0 -7
- package/dist/types/Services/cacheService.d.ts +0 -1
- package/dist/types/Validator/constant.d.ts +0 -3
- package/dist/types/Validator/interface.d.ts +0 -19
- package/dist/types/Validator/utils.d.ts +0 -7
- package/dist/types/Validator/validator.d.ts +0 -37
- package/dist/types/Visualize/ConceptCircle.d.ts +0 -35
- package/dist/types/Visualize/ConceptCircleList.d.ts +0 -9
- package/dist/types/Visualize/ConnectionLine.d.ts +0 -21
- package/dist/types/Visualize/ConnectionLineList.d.ts +0 -6
- package/dist/types/Visualize/drawExistingConcepts.d.ts +0 -8
- package/dist/types/Visualize/helper.d.ts +0 -15
- package/dist/types/Visualize/index.d.ts +0 -0
- package/dist/types/Widgets/BaseObserver.d.ts +0 -22
- package/dist/types/Widgets/BaseWidget.d.ts +0 -24
- package/dist/types/Widgets/BuilderSpeceficFunctions.d.ts +0 -2
- package/dist/types/Widgets/BuilderStatefulWidget.d.ts +0 -42
- package/dist/types/Widgets/CacheWidget.service.d.ts +0 -17
- package/dist/types/Widgets/NormalizeStyles.service.d.ts +0 -1
- package/dist/types/Widgets/RenderPage.service.d.ts +0 -12
- package/dist/types/Widgets/RenderWidgetLibrary.service.d.ts +0 -14
- package/dist/types/Widgets/RenderWidgetService.d.ts +0 -50
- package/dist/types/Widgets/StatefulWidget.d.ts +0 -102
- package/dist/types/Widgets/WidgetBuild.d.ts +0 -4
- package/dist/types/Widgets/WidgetTree.d.ts +0 -29
- package/dist/types/Widgets/mainView.class.d.ts +0 -6
- package/dist/types/WrapperFunctions/DepenedencyObserver.d.ts +0 -73
- package/dist/types/WrapperFunctions/GetCompositionListObservable.d.ts +0 -19
- package/dist/types/WrapperFunctions/GetCompositionObservable.d.ts +0 -13
- package/dist/types/WrapperFunctions/GetLinkListObservable.d.ts +0 -28
- package/dist/types/WrapperFunctions/GetLinkObservable.d.ts +0 -32
- package/dist/types/WrapperFunctions/RecursiveSearchObservable.d.ts +0 -37
- package/dist/types/WrapperFunctions/SearchLinkMultipleAllObservable.d.ts +0 -15
- package/dist/types/prototype/getPrototype.service.d.ts +0 -2
- package/dist/types/prototype/prototype.service.d.ts +0 -25
- package/dist/types/service-worker.d.ts +0 -1
|
@@ -1,16 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview BinaryCharacterTree module providing self-balancing AVL tree for concept storage by character value.
|
|
3
|
+
* This module implements an AVL tree structure for efficient concept retrieval using string-based keys
|
|
4
|
+
* with support for variant nodes (multiple concepts with the same character value).
|
|
5
|
+
* @module DataStructures/BinaryCharacterTree
|
|
6
|
+
*/
|
|
1
7
|
import { Concept } from "../DataStructures/Concept";
|
|
2
8
|
import { Node } from "./Node";
|
|
9
|
+
/**
|
|
10
|
+
* Self-balancing AVL binary tree for storing and retrieving concepts by their character value.
|
|
11
|
+
* Supports multiple concepts with the same character value through variant nodes.
|
|
12
|
+
* Provides O(log n) time complexity for insertions, deletions, and lookups.
|
|
13
|
+
*
|
|
14
|
+
* @class BinaryCharacterTree
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // Add a concept to the tree
|
|
18
|
+
* BinaryCharacterTree.addConceptToTree(myConcept);
|
|
19
|
+
*
|
|
20
|
+
* // Retrieve a concept by character value
|
|
21
|
+
* const node = BinaryCharacterTree.getNodeFromTree("Apple");
|
|
22
|
+
* if (node) {
|
|
23
|
+
* console.log("Found:", node.value.id);
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* // Get concept by character and type
|
|
27
|
+
* const specificNode = await BinaryCharacterTree.getCharacterAndTypeFromTree("Apple", 5);
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* This class uses static methods and maintains a single root node for the entire tree.
|
|
32
|
+
* When multiple concepts share the same character value, they are stored as variants.
|
|
33
|
+
*/
|
|
3
34
|
export declare class BinaryCharacterTree {
|
|
35
|
+
/** Root node of the character-based binary tree, null if tree is empty */
|
|
4
36
|
static characterRoot: Node | null;
|
|
37
|
+
/**
|
|
38
|
+
* Waits for the character data loading flag to be set before proceeding.
|
|
39
|
+
* Used for synchronization when loading initial data.
|
|
40
|
+
*
|
|
41
|
+
* @returns {Promise<string>} Resolves with "done" when data is loaded, rejects with "not" after 25 seconds
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* try {
|
|
46
|
+
* await BinaryCharacterTree.waitForDataToLoad();
|
|
47
|
+
* console.log("Character data loaded");
|
|
48
|
+
* } catch (error) {
|
|
49
|
+
* console.log("Character data load timeout");
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* Uses IdentifierFlags.isCharacterLoaded to determine when data is ready.
|
|
55
|
+
* Times out after 25 seconds to prevent infinite waiting.
|
|
56
|
+
*/
|
|
5
57
|
static waitForDataToLoad(): Promise<unknown>;
|
|
58
|
+
/**
|
|
59
|
+
* Recursively checks if the character data loaded flag is set.
|
|
60
|
+
* Internal helper method for waitForDataToLoad.
|
|
61
|
+
*
|
|
62
|
+
* @param {any} resolve - Promise resolve function
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* Checks IdentifierFlags.isCharacterLoaded every 1000ms until it's true.
|
|
66
|
+
* This is an internal method used by waitForDataToLoad.
|
|
67
|
+
*/
|
|
6
68
|
static checkFlag(resolve: any): any;
|
|
69
|
+
/**
|
|
70
|
+
* Adds a node to the character-based binary tree, maintaining AVL balance.
|
|
71
|
+
* Supports adding variant nodes for concepts with the same character value.
|
|
72
|
+
*
|
|
73
|
+
* @param {Node} node - The node to add to the tree
|
|
74
|
+
* @returns {Promise<Node>} The new root node after insertion and balancing
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const node = new Node("Apple", myConcept, null, null);
|
|
79
|
+
* await BinaryCharacterTree.addNodeToTree(node);
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @remarks
|
|
83
|
+
* If the tree is empty, the node becomes the root.
|
|
84
|
+
* If a node with the same character value exists, the new concept is added as a variant.
|
|
85
|
+
*/
|
|
7
86
|
static addNodeToTree(node: Node): Promise<Node | null>;
|
|
87
|
+
/**
|
|
88
|
+
* Removes a specific concept from a character node by character value and concept ID.
|
|
89
|
+
*
|
|
90
|
+
* @param {string} character - The character value to search for
|
|
91
|
+
* @param {number} id - The concept ID to remove
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* await BinaryCharacterTree.removeNodeByCharacter("Apple", 123);
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @remarks
|
|
99
|
+
* If multiple concepts share the same character value, only the one with matching ID is removed.
|
|
100
|
+
* Does nothing if the tree is empty.
|
|
101
|
+
*/
|
|
8
102
|
static removeNodeByCharacter(character: string, id: number): Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* Counts the total number of nodes in the character tree.
|
|
105
|
+
*
|
|
106
|
+
* @returns {number} The total count of nodes in the tree
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* const nodeCount = BinaryCharacterTree.countNumberOfNodes();
|
|
111
|
+
* console.log(`Tree contains ${nodeCount} character nodes`);
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @remarks
|
|
115
|
+
* Recursively traverses the entire tree to count nodes.
|
|
116
|
+
* Returns 0 if the tree is empty.
|
|
117
|
+
*/
|
|
9
118
|
static countNumberOfNodes(): number;
|
|
119
|
+
/**
|
|
120
|
+
* Convenience method to add a concept to the character tree.
|
|
121
|
+
*
|
|
122
|
+
* @param {Concept} concept - The concept to add to the tree
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* BinaryCharacterTree.addConceptToTree(myConcept);
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
* @remarks
|
|
130
|
+
* Only adds concepts with non-empty character values.
|
|
131
|
+
* Creates a node with the concept's character value as the key.
|
|
132
|
+
*/
|
|
10
133
|
static addConceptToTree(concept: Concept): void;
|
|
134
|
+
/**
|
|
135
|
+
* Retrieves a node from the tree by its character value.
|
|
136
|
+
*
|
|
137
|
+
* @param {string} value - The character value to search for
|
|
138
|
+
* @returns {Node | null} The node if found, null otherwise
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* const node = BinaryCharacterTree.getNodeFromTree("Apple");
|
|
143
|
+
* if (node) {
|
|
144
|
+
* const concept = node.value as Concept;
|
|
145
|
+
* console.log(concept.id);
|
|
146
|
+
* }
|
|
147
|
+
* ```
|
|
148
|
+
*
|
|
149
|
+
* @remarks
|
|
150
|
+
* Uses binary search for O(log n) time complexity.
|
|
151
|
+
* Returns the main node; access variants through node.variants property.
|
|
152
|
+
*/
|
|
11
153
|
static getNodeFromTree(value: string): Node | null;
|
|
154
|
+
/**
|
|
155
|
+
* Retrieves a node from the tree by its character value (updated version).
|
|
156
|
+
* Currently identical to getNodeFromTree.
|
|
157
|
+
*
|
|
158
|
+
* @param {string} value - The character value to search for
|
|
159
|
+
* @returns {Node | null} The node if found, null otherwise
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* const node = BinaryCharacterTree.getNodeFromTreeUpdated("Apple");
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
166
|
+
* @remarks
|
|
167
|
+
* This method may be deprecated or merged with getNodeFromTree in future versions.
|
|
168
|
+
*/
|
|
12
169
|
static getNodeFromTreeUpdated(value: string): Node | null;
|
|
170
|
+
/**
|
|
171
|
+
* Retrieves a node matching both character value and type ID.
|
|
172
|
+
* Searches through variants to find the specific type match.
|
|
173
|
+
*
|
|
174
|
+
* @param {string} value - The character value to search for
|
|
175
|
+
* @param {number} typeId - The type ID to filter by
|
|
176
|
+
* @returns {Promise<Node | null>} The node matching both criteria, null if not found
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* const node = await BinaryCharacterTree.getCharacterAndTypeFromTree("Apple", 5);
|
|
181
|
+
* if (node) {
|
|
182
|
+
* console.log("Found Apple of type 5");
|
|
183
|
+
* }
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* @remarks
|
|
187
|
+
* First finds the character node, then searches through variants for matching type.
|
|
188
|
+
* Returns null if no match is found.
|
|
189
|
+
*/
|
|
13
190
|
static getCharacterAndTypeFromTree(value: string, typeId: number): Promise<Node | null>;
|
|
191
|
+
/**
|
|
192
|
+
* Retrieves a node matching both character value and category ID.
|
|
193
|
+
* Searches through variants to find the specific category match.
|
|
194
|
+
*
|
|
195
|
+
* @param {string} value - The character value to search for
|
|
196
|
+
* @param {number} categoryId - The category ID to filter by
|
|
197
|
+
* @returns {Promise<Node | null>} The node matching both criteria, null if not found
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```typescript
|
|
201
|
+
* const node = await BinaryCharacterTree.getCharacterAndCategoryFromTree("Apple", 3);
|
|
202
|
+
* if (node) {
|
|
203
|
+
* console.log("Found Apple in category 3");
|
|
204
|
+
* }
|
|
205
|
+
* ```
|
|
206
|
+
*
|
|
207
|
+
* @remarks
|
|
208
|
+
* First finds the character node, then searches through variants for matching category.
|
|
209
|
+
* Returns null if no match is found.
|
|
210
|
+
*/
|
|
14
211
|
static getCharacterAndCategoryFromTree(value: string, categoryId: number): Promise<Node | null>;
|
|
212
|
+
/**
|
|
213
|
+
* Removes a concept from the character tree by its ID.
|
|
214
|
+
*
|
|
215
|
+
* @param {number} id - The concept ID to remove
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```typescript
|
|
219
|
+
* BinaryCharacterTree.removeConceptCharacter(123);
|
|
220
|
+
* ```
|
|
221
|
+
*
|
|
222
|
+
* @remarks
|
|
223
|
+
* After removal, the tree is automatically rebalanced to maintain AVL properties.
|
|
224
|
+
* Does nothing if the tree is empty.
|
|
225
|
+
*/
|
|
15
226
|
static removeConceptCharacter(id: number): void;
|
|
16
227
|
}
|
|
@@ -1,12 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview BinaryTree module providing self-balancing AVL tree for concept storage by ID.
|
|
3
|
+
* This module implements an AVL (Adelson-Velsky and Landis) tree structure for efficient
|
|
4
|
+
* concept retrieval with O(log n) time complexity.
|
|
5
|
+
* @module DataStructures/BinaryTree
|
|
6
|
+
*/
|
|
1
7
|
import { Concept } from "../DataStructures/Concept";
|
|
2
8
|
import { Node } from "./Node";
|
|
9
|
+
/**
|
|
10
|
+
* Self-balancing AVL binary tree for storing and retrieving concepts by their numeric ID.
|
|
11
|
+
* Provides O(log n) time complexity for insertions, deletions, and lookups.
|
|
12
|
+
*
|
|
13
|
+
* @class BinaryTree
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* // Add a concept to the tree
|
|
17
|
+
* BinaryTree.addConceptToTree(myConcept);
|
|
18
|
+
*
|
|
19
|
+
* // Retrieve a concept by ID
|
|
20
|
+
* const node = await BinaryTree.getNodeFromTree(123);
|
|
21
|
+
* if (node) {
|
|
22
|
+
* console.log("Found:", node.value.characterValue);
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* // Count all nodes
|
|
26
|
+
* const count = BinaryTree.countNumberOfNodes();
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* This class uses static methods and maintains a single root node for the entire tree.
|
|
31
|
+
* The tree automatically balances itself using AVL rotations to maintain optimal search performance.
|
|
32
|
+
*/
|
|
3
33
|
export declare class BinaryTree {
|
|
34
|
+
/** Root node of the binary tree, null if tree is empty */
|
|
4
35
|
static root: Node | null;
|
|
36
|
+
/**
|
|
37
|
+
* Adds a node to the binary tree, maintaining AVL balance.
|
|
38
|
+
*
|
|
39
|
+
* @param {Node} node - The node to add to the tree
|
|
40
|
+
* @returns {Node} The new root node after insertion and balancing
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const node = new Node(123, myConcept, null, null);
|
|
45
|
+
* BinaryTree.addNodeToTree(node);
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* If the tree is empty, the node becomes the root.
|
|
50
|
+
* Otherwise, the node is inserted and the tree is automatically balanced.
|
|
51
|
+
*/
|
|
5
52
|
static addNodeToTree(node: Node): Node | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Waits for the data loading flag to be set before proceeding.
|
|
55
|
+
* Used for synchronization when loading initial data.
|
|
56
|
+
*
|
|
57
|
+
* @returns {Promise<string>} Resolves with "done" when data is loaded, rejects with "not" after 25 seconds
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* try {
|
|
62
|
+
* await BinaryTree.waitForDataToLoad();
|
|
63
|
+
* console.log("Data loaded successfully");
|
|
64
|
+
* } catch (error) {
|
|
65
|
+
* console.log("Data load timeout");
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* Uses IdentifierFlags.isDataLoaded to determine when data is ready.
|
|
71
|
+
* Times out after 25 seconds to prevent infinite waiting.
|
|
72
|
+
*/
|
|
6
73
|
static waitForDataToLoad(): Promise<unknown>;
|
|
74
|
+
/**
|
|
75
|
+
* Recursively checks if the data loaded flag is set.
|
|
76
|
+
* Internal helper method for waitForDataToLoad.
|
|
77
|
+
*
|
|
78
|
+
* @param {any} resolve - Promise resolve function
|
|
79
|
+
*
|
|
80
|
+
* @remarks
|
|
81
|
+
* Checks IdentifierFlags.isDataLoaded every 1000ms until it's true.
|
|
82
|
+
* This is an internal method used by waitForDataToLoad.
|
|
83
|
+
*/
|
|
7
84
|
static checkFlag(resolve: any): any;
|
|
85
|
+
/**
|
|
86
|
+
* Convenience method to add a concept to both the ID tree and character tree.
|
|
87
|
+
*
|
|
88
|
+
* @param {Concept} concept - The concept to add to the tree
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* BinaryTree.addConceptToTree(myConcept);
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* @remarks
|
|
96
|
+
* Creates a node with the concept's ID as the key and adds it to this tree.
|
|
97
|
+
* Also creates a node with the concept's character value and adds it to BinaryCharacterTree.
|
|
98
|
+
*/
|
|
8
99
|
static addConceptToTree(concept: Concept): void;
|
|
100
|
+
/**
|
|
101
|
+
* Retrieves a node from the tree by its ID.
|
|
102
|
+
*
|
|
103
|
+
* @param {number} id - The concept ID to search for
|
|
104
|
+
* @returns {Promise<Node | null>} The node if found, null otherwise
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const node = await BinaryTree.getNodeFromTree(123);
|
|
109
|
+
* if (node) {
|
|
110
|
+
* const concept = node.value as Concept;
|
|
111
|
+
* console.log(concept.characterValue);
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* @remarks
|
|
116
|
+
* Uses binary search for O(log n) time complexity.
|
|
117
|
+
* Returns null if the tree is empty or the node is not found.
|
|
118
|
+
*/
|
|
9
119
|
static getNodeFromTree(id: number): Promise<Node | null>;
|
|
120
|
+
/**
|
|
121
|
+
* Removes a node from the tree by its ID.
|
|
122
|
+
*
|
|
123
|
+
* @param {number} id - The concept ID to remove
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* await BinaryTree.removeNodeFromTree(123);
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* @remarks
|
|
131
|
+
* After removal, the tree is automatically rebalanced to maintain AVL properties.
|
|
132
|
+
* Does nothing if the tree is empty.
|
|
133
|
+
*/
|
|
10
134
|
static removeNodeFromTree(id: number): Promise<void>;
|
|
135
|
+
/**
|
|
136
|
+
* Counts the total number of nodes in the tree.
|
|
137
|
+
*
|
|
138
|
+
* @returns {number} The total count of nodes in the tree
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* const nodeCount = BinaryTree.countNumberOfNodes();
|
|
143
|
+
* console.log(`Tree contains ${nodeCount} concepts`);
|
|
144
|
+
* ```
|
|
145
|
+
*
|
|
146
|
+
* @remarks
|
|
147
|
+
* Recursively traverses the entire tree to count nodes.
|
|
148
|
+
* Returns 0 if the tree is empty.
|
|
149
|
+
*/
|
|
11
150
|
static countNumberOfNodes(): number;
|
|
12
151
|
}
|
|
@@ -1,15 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview BinaryTypeTree module providing self-balancing AVL tree for concept storage by type ID.
|
|
3
|
+
* This module implements an AVL tree structure for efficient concept retrieval by type
|
|
4
|
+
* with support for variant nodes (multiple concepts of the same type).
|
|
5
|
+
* @module DataStructures/BinaryTypeTree
|
|
6
|
+
*/
|
|
1
7
|
import { Concept } from "../DataStructures/Concept";
|
|
2
8
|
import { Node } from "./Node";
|
|
9
|
+
/**
|
|
10
|
+
* Self-balancing AVL binary tree for storing and retrieving concepts by their type ID.
|
|
11
|
+
* Supports multiple concepts with the same type through variant nodes.
|
|
12
|
+
* Provides O(log n) time complexity for insertions, deletions, and lookups.
|
|
13
|
+
*
|
|
14
|
+
* @class BinaryTypeTree
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // Add a concept to the type tree
|
|
18
|
+
* BinaryTypeTree.addConceptToTree(myConcept);
|
|
19
|
+
*
|
|
20
|
+
* // Get all concepts of a specific type
|
|
21
|
+
* const concepts = BinaryTypeTree.getTypeVariantsFromTree(5);
|
|
22
|
+
* console.log(`Found ${concepts.length} concepts of type 5`);
|
|
23
|
+
*
|
|
24
|
+
* // Get concepts by type and user
|
|
25
|
+
* const userConcepts = await BinaryTypeTree.getTypeVariantsFromTreeWithUserId(5, 1);
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* This class uses static methods and maintains a single root node for the entire tree.
|
|
30
|
+
* Multiple concepts with the same type ID are stored as variants for efficient batch retrieval.
|
|
31
|
+
*/
|
|
3
32
|
export declare class BinaryTypeTree {
|
|
33
|
+
/** Root node of the type-based binary tree, null if tree is empty */
|
|
4
34
|
static typeRoot: Node | null;
|
|
35
|
+
/**
|
|
36
|
+
* Adds a node to the type-based binary tree, maintaining AVL balance.
|
|
37
|
+
* Supports adding variant nodes for concepts with the same type ID.
|
|
38
|
+
*
|
|
39
|
+
* @param {Node} node - The node to add to the tree
|
|
40
|
+
* @returns {Promise<Node>} The new root node after insertion and balancing
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const node = new Node(5, myConcept, null, null);
|
|
45
|
+
* await BinaryTypeTree.addNodeToTree(node);
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* If the tree is empty, the node becomes the root.
|
|
50
|
+
* If a node with the same type ID exists, the new concept is added as a variant.
|
|
51
|
+
*/
|
|
5
52
|
static addNodeToTree(node: Node): Promise<Node | null>;
|
|
53
|
+
/**
|
|
54
|
+
* Convenience method to add a concept to the type tree.
|
|
55
|
+
*
|
|
56
|
+
* @param {Concept} concept - The concept to add to the tree
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* BinaryTypeTree.addConceptToTree(myConcept);
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @remarks
|
|
64
|
+
* Only adds concepts with valid type IDs (typeId != 0).
|
|
65
|
+
* Creates a node with the concept's type ID as the key.
|
|
66
|
+
*/
|
|
6
67
|
static addConceptToTree(concept: Concept): void;
|
|
68
|
+
/**
|
|
69
|
+
* Removes a specific concept from a type node by type ID and concept ID.
|
|
70
|
+
*
|
|
71
|
+
* @param {number} typeId - The type ID to search for
|
|
72
|
+
* @param {number} id - The concept ID to remove
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* BinaryTypeTree.removeTypeConcept(5, 123);
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @remarks
|
|
80
|
+
* If multiple concepts share the same type ID, only the one with matching concept ID is removed.
|
|
81
|
+
* Does nothing if the tree is empty.
|
|
82
|
+
*/
|
|
7
83
|
static removeTypeConcept(typeId: number, id: number): void;
|
|
84
|
+
/**
|
|
85
|
+
* Retrieves a node from the tree by its type ID.
|
|
86
|
+
*
|
|
87
|
+
* @param {number} id - The type ID to search for
|
|
88
|
+
* @returns {Node | null} The node if found, null otherwise
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const node = BinaryTypeTree.getNodeFromTree(5);
|
|
93
|
+
* if (node) {
|
|
94
|
+
* console.log("Found type node with", node.variants.length, "variants");
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @remarks
|
|
99
|
+
* Uses binary search for O(log n) time complexity.
|
|
100
|
+
* Returns the main node; access all concepts of this type through node.value and node.variants.
|
|
101
|
+
*/
|
|
8
102
|
static getNodeFromTree(id: number): Node | null;
|
|
103
|
+
/**
|
|
104
|
+
* Retrieves all concepts of a specific type ID as an array.
|
|
105
|
+
* Includes both the main concept and all variants.
|
|
106
|
+
*
|
|
107
|
+
* @param {number} typeId - The type ID to search for
|
|
108
|
+
* @returns {Concept[]} Array of all concepts with the specified type ID
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* const concepts = BinaryTypeTree.getTypeVariantsFromTree(5);
|
|
113
|
+
* concepts.forEach(concept => {
|
|
114
|
+
* console.log(concept.characterValue);
|
|
115
|
+
* });
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* @remarks
|
|
119
|
+
* Returns an empty array if no concepts of the type are found.
|
|
120
|
+
* Useful for batch operations on all concepts of a type.
|
|
121
|
+
*/
|
|
9
122
|
static getTypeVariantsFromTree(typeId: number): Concept[] | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* Waits for the type data loading flag to be set before proceeding.
|
|
125
|
+
* Used for synchronization when loading initial data.
|
|
126
|
+
*
|
|
127
|
+
* @returns {Promise<string>} Resolves with "done" when data is loaded, rejects with "not" after 25 seconds
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```typescript
|
|
131
|
+
* try {
|
|
132
|
+
* await BinaryTypeTree.waitForDataToLoad();
|
|
133
|
+
* console.log("Type data loaded");
|
|
134
|
+
* } catch (error) {
|
|
135
|
+
* console.log("Type data load timeout");
|
|
136
|
+
* }
|
|
137
|
+
* ```
|
|
138
|
+
*
|
|
139
|
+
* @remarks
|
|
140
|
+
* Uses IdentifierFlags.isTypeLoaded to determine when data is ready.
|
|
141
|
+
* Times out after 25 seconds to prevent infinite waiting.
|
|
142
|
+
*/
|
|
10
143
|
static waitForDataToLoad(): Promise<unknown>;
|
|
144
|
+
/**
|
|
145
|
+
* Recursively checks if the type data loaded flag is set.
|
|
146
|
+
* Internal helper method for waitForDataToLoad.
|
|
147
|
+
*
|
|
148
|
+
* @param {any} resolve - Promise resolve function
|
|
149
|
+
*
|
|
150
|
+
* @remarks
|
|
151
|
+
* Checks IdentifierFlags.isTypeLoaded every 1000ms until it's true.
|
|
152
|
+
* This is an internal method used by waitForDataToLoad.
|
|
153
|
+
*/
|
|
11
154
|
static checkFlag(resolve: any): any;
|
|
155
|
+
/**
|
|
156
|
+
* Retrieves all concepts of a specific type ID filtered by user ID.
|
|
157
|
+
* Includes both the main concept and all variants belonging to the specified user.
|
|
158
|
+
*
|
|
159
|
+
* @param {number} typeId - The type ID to search for
|
|
160
|
+
* @param {number} userId - The user ID to filter by
|
|
161
|
+
* @returns {Promise<Concept[]>} Array of concepts matching both type and user
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```typescript
|
|
165
|
+
* const userConcepts = await BinaryTypeTree.getTypeVariantsFromTreeWithUserId(5, 1);
|
|
166
|
+
* console.log(`User 1 has ${userConcepts.length} concepts of type 5`);
|
|
167
|
+
* ```
|
|
168
|
+
*
|
|
169
|
+
* @remarks
|
|
170
|
+
* Returns an empty array if no matching concepts are found.
|
|
171
|
+
* Automatically deduplicates concepts with the same ID.
|
|
172
|
+
*/
|
|
12
173
|
static getTypeVariantsFromTreeWithUserId(typeId: number, userId: number): Promise<Concept[]>;
|
|
174
|
+
/**
|
|
175
|
+
* Retrieves a concept matching both type ID and character value.
|
|
176
|
+
* Searches through all concepts of the type for a matching character value.
|
|
177
|
+
*
|
|
178
|
+
* @param {string} characterValue - The character value to search for
|
|
179
|
+
* @param {number} typeId - The type ID to filter by
|
|
180
|
+
* @returns {Promise<Concept>} The concept matching both criteria, or a default concept if not found
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```typescript
|
|
184
|
+
* const concept = await BinaryTypeTree.getTypeVariantsWithCharacterValue("Apple", 5);
|
|
185
|
+
* if (concept.id !== 0) {
|
|
186
|
+
* console.log("Found Apple of type 5");
|
|
187
|
+
* }
|
|
188
|
+
* ```
|
|
189
|
+
*
|
|
190
|
+
* @remarks
|
|
191
|
+
* Returns a default concept (id = 0) if no match is found.
|
|
192
|
+
* More efficient than searching by character first when type is known.
|
|
193
|
+
*/
|
|
13
194
|
static getTypeVariantsWithCharacterValue(characterValue: string, typeId: number): Promise<Concept>;
|
|
195
|
+
/**
|
|
196
|
+
* Counts the total number of nodes in the type tree.
|
|
197
|
+
*
|
|
198
|
+
* @returns {number} The total count of nodes in the tree
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```typescript
|
|
202
|
+
* const nodeCount = BinaryTypeTree.countNumberOfNodes();
|
|
203
|
+
* console.log(`Tree contains ${nodeCount} type nodes`);
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* @remarks
|
|
207
|
+
* Recursively traverses the entire tree to count nodes.
|
|
208
|
+
* Returns 0 if the tree is empty.
|
|
209
|
+
*/
|
|
14
210
|
static countNumberOfNodes(): number;
|
|
15
211
|
}
|