@routineless/nx-aws-cdk
Version:
Nx plugin for AWS CDK
50 lines (49 loc) • 1.95 kB
TypeScript
declare class TrieNode {
key: string;
children: Map<string, TrieNode>;
isEnd: boolean;
constructor(key: string);
}
/**
* Trie represents a Trie data structure. It provides basic Trie operations and simple pattern search.
*/
export declare class PatternTrie {
constructor(words?: string[], caseSensitive?: boolean);
protected _size: number;
get size(): number;
protected _caseSensitive: boolean;
get caseSensitive(): boolean;
protected _root: TrieNode;
get root(): TrieNode;
/**
* Add a word to the Trie structure.
* @param {string} word - The word to add.
* @returns {boolean} True if the word was successfully added.
*/
add(word: string): boolean;
/**
* Check if the Trie contains a given word.
* @param {string} word - The word to check for.
* @returns {boolean} True if the word is present in the Trie.
*/
has(word: string): boolean;
/**
*
* The `getAll` function returns an array of all words in a Trie data structure that start with a given prefix.
* @param {string} prefix - The `prefix` parameter is a string that represents the prefix that we want to search for in the
* trie. It is an optional parameter, so if no prefix is provided, it will default to an empty string.
* @param {number} max - The max count of words will be found
* @param isAllWhenEmptyPrefix - If true, when the prefix provided as '', returns all the words in the trie.
* @returns {string[]} an array of strings.
*/
getAll(prefix?: string, max?: number, isAllWhenEmptyPrefix?: boolean): string[];
/**
* Remove a word from the Trie structure.
* @param{string} word - The word to delete.
* @returns {boolean} True if the word was successfully removed.
*/
delete(word: string): boolean;
[Symbol.iterator](): IterableIterator<string>;
protected _caseProcess(str: string): string;
}
export {};