C# Класс CkanDotNet.Api.DataStructures.Trie

A collection Trie class that can be used to locate words by prefix Can also return a list of all words starting with the requested prefix. NOTE: the case insensitive Trie will always return lowercase words.
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
_isCaseSensitive bool
_rootNode TrieNode

Открытые методы

Метод Описание
Add ( String item ) : void

Add an additional word to the collection of words represented by the Trie

Contains ( String item ) : bool

Searches for a node that corresponds to the requires item. If such a node is found in the Trie - returns true.

GetCompletionList ( String prefix ) : List

Returns all words contained in the Trie that match the prefix

GetCompletionList ( String prefix, int completionSetCount ) : List

Returns the requested amount of words contained in the Trie that match the prefix. Note that there is no specific order for the returned words.

Trie ( ) : System

Trie Consructor

Trie ( bool isCaseSensitive ) : System

Trie Consructor

Защищенные методы

Метод Описание
AddRecursive ( TrieNode node, String item, int index ) : void

Performs the actual recursive insertion of the characters in the item into the Trie nodes

FindPrefixRecursive ( TrieNode node, string item ) : TrieNode

Performs the actual recursive lookup of the characters in the item

GetCompletionsRecursive ( TrieNode node, StringBuilder wordBuilder, int completionSetCount, List completions ) : void

Performs the actual lookup for the all words contained in the subtree.

Описание методов

Add() публичный Метод

Add an additional word to the collection of words represented by the Trie
public Add ( String item ) : void
item String
Результат void

AddRecursive() защищенный Метод

Performs the actual recursive insertion of the characters in the item into the Trie nodes
protected AddRecursive ( TrieNode node, String item, int index ) : void
node TrieNode
item String
index int
Результат void

Contains() публичный Метод

Searches for a node that corresponds to the requires item. If such a node is found in the Trie - returns true.
public Contains ( String item ) : bool
item String a string to search for in the Trie
Результат bool

FindPrefixRecursive() защищенный Метод

Performs the actual recursive lookup of the characters in the item
protected FindPrefixRecursive ( TrieNode node, string item ) : TrieNode
node TrieNode node to search for matches
item string string to be looked-up
Результат TrieNode

GetCompletionList() публичный Метод

Returns all words contained in the Trie that match the prefix
public GetCompletionList ( String prefix ) : List
prefix String
Результат List

GetCompletionList() публичный Метод

Returns the requested amount of words contained in the Trie that match the prefix. Note that there is no specific order for the returned words.
public GetCompletionList ( String prefix, int completionSetCount ) : List
prefix String
completionSetCount int maximum number of words to return
Результат List

GetCompletionsRecursive() защищенный Метод

Performs the actual lookup for the all words contained in the subtree.
protected GetCompletionsRecursive ( TrieNode node, StringBuilder wordBuilder, int completionSetCount, List completions ) : void
node TrieNode root node of a subtree to look for contained words
wordBuilder StringBuilder a StringBuilder to perform fast character appending
completionSetCount int maximum number of words to return
completions List A list to contain all the words that are found
Результат void

Trie() публичный Метод

Trie Consructor
public Trie ( ) : System
Результат System

Trie() публичный Метод

Trie Consructor
public Trie ( bool isCaseSensitive ) : System
isCaseSensitive bool true - if case sensitivity is required from the Trie
Результат System

Описание свойств

_isCaseSensitive защищенное свойство

protected bool _isCaseSensitive
Результат bool

_rootNode защищенное свойство

protected TrieNode,CkanDotNet.Api.DataStructures _rootNode
Результат TrieNode