C# Class ScrewTurn.Wiki.SearchEngine.Word

Represents a word in a document.
All instance and static members are thread-safe.
显示文件 Open project: mono/ScrewTurnWiki Class Usage Examples

Protected Properties

Property Type Description
id uint
occurrences OccurrenceDictionary
text string

Public Methods

Method Description
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.

Method Details

AddOccurrence() public method

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.
return void

BulkAddOccurrences() public method

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.
return void

RemoveOccurrences() public method

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.
return List

ToString() public method

Gets a string representation of the current instance.
public ToString ( ) : string
return string

Word() public method

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).
return System

Word() public method

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.
return System

Property Details

id protected_oe property

The word unique ID.
protected uint id
return uint

occurrences protected_oe property

The occurrences.
protected OccurrenceDictionary occurrences
return OccurrenceDictionary

text protected_oe property

The word text, lowercase.
protected string text
return string