C# Класс ScrewTurn.Wiki.SearchEngine.Word

Represents a word in a document.
All instance and static members are thread-safe.
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
id uint
occurrences OccurrenceDictionary
text string

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

Метод Описание
AddOccurrence ( IDocument document, ushort firstCharIndex, ushort wordIndex, WordLocation location ) : void

Stores an occurrence.

Adding an occurrence is O(n), where n is the number of occurrences of the word already stored for the same document. If there were no occurrences previously stored, the operation is O(1).

BulkAddOccurrences ( IDocument document, SortedBasicWordInfoSet positions ) : void

Adds a bulk of occurrences of the word in a document, removing all the old positions, if any.

If positions is empty, the effect of the invocation of the method is equal to that of RemoveOccurrences with the same document. Bulk-adding the occurrences is O(1).

RemoveOccurrences ( IDocument document ) : List

Removes all the occurrences for a document.

Removing the occurrences for the document is O(1).

ToString ( ) : string

Gets a string representation of the current instance.

Word ( uint id, string text ) : System

Initializes a new instance of the Word class.

Word ( uint id, string text, OccurrenceDictionary occurrences ) : System

Initializes a new instance of the Word class.

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

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

Stores an occurrence.
Adding an occurrence is O(n), where n is the number of occurrences of the word already stored for the same document. If there were no occurrences previously stored, the operation is O(1).
If is null. If or are less than zero.
public AddOccurrence ( IDocument document, ushort firstCharIndex, ushort wordIndex, WordLocation location ) : void
document IDocument The document the occurrence is referred to.
firstCharIndex ushort The index of the first character of the word in the document.
wordIndex ushort The index of the word in the document.
location WordLocation The location of the word.
Результат void

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

Adds a bulk of occurrences of the word in a document, removing all the old positions, if any.
If positions is empty, the effect of the invocation of the method is equal to that of RemoveOccurrences with the same document. Bulk-adding the occurrences is O(1).
If or are null.
public BulkAddOccurrences ( IDocument document, SortedBasicWordInfoSet positions ) : void
document IDocument The document.
positions SortedBasicWordInfoSet The positions.
Результат void

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

Removes all the occurrences for a document.
Removing the occurrences for the document is O(1).
If is null.
public RemoveOccurrences ( IDocument document ) : List
document IDocument The document to remove the occurrences of.
Результат List

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

Gets a string representation of the current instance.
public ToString ( ) : string
Результат string

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

Initializes a new instance of the Word class.
If is null. If is empty.
public Word ( uint id, string text ) : System
id uint The word ID.
text string The text of the word (lowercase).
Результат System

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

Initializes a new instance of the Word class.
If or are null. If is empty.
public Word ( uint id, string text, OccurrenceDictionary occurrences ) : System
id uint The word ID.
text string The text of the word (lowercase).
occurrences OccurrenceDictionary The occurrences.
Результат System

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

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

The word unique ID.
protected uint id
Результат uint

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

The occurrences.
protected OccurrenceDictionary occurrences
Результат OccurrenceDictionary

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

The word text, lowercase.
protected string text
Результат string