using System;
using System.Collections.Generic;
using System.Text;
namespace ScrewTurn.Wiki.SearchEngine {
///
/// Contains arguments for the IndexChanged event of the interface.
///
public class IndexChangedEventArgs : EventArgs {
private IDocument document;
private IndexChangeType change;
private DumpedChange changeData;
private object state;
private IndexStorerResult result = null;
///
/// Initializes a new instance of the class.
///
/// The affected document.
/// The change performed.
/// The dumped change data.
/// A state object that is passed to the IndexStorer SaveDate/DeleteData function.
/// If is not and or are null.
public IndexChangedEventArgs(IDocument document, IndexChangeType change, DumpedChange changeData, object state) {
if(change != IndexChangeType.IndexCleared) {
if(document == null) throw new ArgumentNullException("document");
if(changeData == null) throw new ArgumentNullException("changeData");
}
this.document = document;
this.change = change;
this.changeData = changeData;
this.state = state;
}
///
/// Initializes a new instance of the class.
///
/// The affected document.
/// The change performed.
/// The dumped change data.
/// A state object that is passed to the IndexStorer SaveDate/DeleteData function.
/// The storer result, if any.
/// If is not and or are null.
public IndexChangedEventArgs(IDocument document, IndexChangeType change, DumpedChange changeData, object state, IndexStorerResult result)
: this(document, change, changeData, state) {
this.result = result;
}
///
/// Gets the affected document.
///
public IDocument Document {
get { return document; }
}
///
/// Gets the change performed.
///
public IndexChangeType Change {
get { return change; }
}
///
/// Gets the dumped change data.
///
public DumpedChange ChangeData {
get { return changeData; }
}
///
/// Gets the state object that is passed to the IndexStorer SaveDate/DeleteData function.
///
public object State {
get { return state; }
}
///
/// Gets or sets the index storer result, if any.
///
public IndexStorerResult Result {
get { return result; }
set { result = value; }
}
}
///
/// Lists valid index changes.
///
public enum IndexChangeType {
///
/// A document is added.
///
DocumentAdded,
///
/// A document is removed.
///
DocumentRemoved,
///
/// The index is cleared.
///
IndexCleared
}
}