using System;
using System.Collections.Generic;
using System.Text;
namespace ScrewTurn.Wiki.SearchEngine {
///
/// Contains a word mapping data, structured for easy dumping on disk or database.
///
/// The class is not thread-safe.
public class DumpedWordMapping {
///
/// The word unique ID.
///
protected uint wordId;
///
/// The document unique ID.
///
protected uint documentId;
///
/// The index of the character of the word.
///
protected ushort firstCharIndex;
///
/// The index of the word in the original document.
///
protected ushort wordIndex;
///
/// The location identifier.
///
protected byte location;
///
/// Initializes a new instance of the class.
///
/// The word unique ID.
/// The document unique ID.
/// The index of the first character the word.
/// The index of the word in the original index.
/// The location identifier.
public DumpedWordMapping(uint wordId, uint documentId, ushort firstCharIndex, ushort wordIndex, byte location) {
this.wordId = wordId;
this.documentId = documentId;
this.firstCharIndex = firstCharIndex;
this.wordIndex = wordIndex;
this.location = location;
}
///
/// Initializes a new instance of the class.
///
/// The word unique ID.
/// The document unique ID.
/// The .
/// If is null.
public DumpedWordMapping(uint wordId, uint documentId, BasicWordInfo info) {
if(info == null) throw new ArgumentNullException("info");
this.wordId = wordId;
this.documentId = documentId;
this.firstCharIndex = info.FirstCharIndex;
this.wordIndex = info.WordIndex;
this.location = info.Location.Location;
}
///
/// Gets or sets the word unique ID.
///
public uint WordID {
get { return wordId; }
set { wordId = value; }
}
///
/// Gets the document unique ID.
///
public uint DocumentID {
get { return documentId; }
}
///
/// Gets the index of the first character of the word.
///
public ushort FirstCharIndex {
get { return firstCharIndex; }
}
///
/// Gets the index of the word in the original document.
///
public ushort WordIndex {
get { return wordIndex; }
}
///
/// Gets the location identifier.
///
public byte Location {
get { return location; }
}
}
}