本文整理汇总了C#中Indexer类的典型用法代码示例。如果您正苦于以下问题:C# Indexer类的具体用法?C# Indexer怎么用?C# Indexer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Indexer类属于命名空间,在下文中一共展示了Indexer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Indexer_Index
public void Indexer_Index()
{
var indexsource = new FeedsDbContextIndexSource(new FeedsDbEntities(), 100);
var indexer = new Indexer<Document>(indexsource);
indexer.Index();
}
示例2: DfaState
internal DfaState()
{
Indexer<DfaState>.Add(this);
_trasition = new Indexer<DfaState>.Array(byte.MaxValue + 1);
_nfaStates = null;
}
示例3: CanReadIndiciesBack_SmallFile
public void CanReadIndiciesBack_SmallFile()
{
var pulse = new Subject<Unit>();
var scheduler = new TestScheduler();
using (var file = new TestFile())
{
file.Append(Enumerable.Range(1, 100).Select(i => $"This is line number {i.ToString("00000000")}").ToArray());
using (var indexer = new Indexer(file.Info.WatchFile(pulse).WithSegments(), scheduler: scheduler))
{
IndexCollection result = null;
using (indexer.Result.Subscribe(indicies => result = indicies))
{
pulse.Once();
var head = result.ReadLines(new ScrollRequest(10, 0));
var headText = head.Select(l => l.Text).ToArray();
var headExpected = Enumerable.Range(1, 10).Select(i => $"This is line number {i.ToString("00000000")}");
headText.ShouldAllBeEquivalentTo(headExpected);
var tail = result.ReadLines(new ScrollRequest(10));
var tailText = tail.Select(l => l.Text).ToArray();
var tailExpected = Enumerable.Range(91, 10).Select(i => $"This is line number {i.ToString("00000000")}").ToArray();
tailText.ShouldAllBeEquivalentTo(tailExpected);
var mid = result.ReadLines(new ScrollRequest(10, 20));
var midText = mid.Select(l => l.Text).ToArray();
var midExpected = Enumerable.Range(21, 10).Select(i => $"This is line number {i.ToString("00000000")}").ToArray();
midText.ShouldAllBeEquivalentTo(midExpected);
}
}
}
}
示例4: Start
public void Start()
{
_graphClient = CreateGraphClient();
_indexer = CreateIndexer();
_eventHandlerMapping = CreateEventHandlerMapping();
ConnectToEventstore();
}
示例5: IndexerTest
public void IndexerTest()
{
using (var indexer = new Indexer(this.Directory)) {
var guids = new List<Guid>();
guids.Add(IndexTest(indexer, TestDir + "Tika.rtf", "almonds"));
guids.Add(IndexTest(indexer, TestDir + "Tika.pdf", "almonds"));
guids.Add(IndexTest(indexer, TestDir + "Tika.docx", "almonds"));
guids.Add(IndexTest(indexer, TestDir + "Tika.odt", "almonds"));
guids.Add(IndexTest(indexer, TestDir + "Tika.pptx", "almonds"));
guids.Add(IndexTest(indexer, TestDir + "Tika.xlsx", "almonds"));
foreach (var guid in guids) {
indexer.Writer.DeleteDocuments(new Term("Id", guid.ToString()));
indexer.Refresh();
var docs = indexer.Searcher
.Search(new TermQuery(new Term(indexer.DocumentContentField, "almonds")), 1000)
#if LuceneV290
.scoreDocs
.Select(sd => indexer.Searcher.Doc(sd.doc))
#else
.ScoreDocs
.Select(sd => indexer.Searcher.Doc(sd.Doc))
#endif
.ToArray();
Assert.IsFalse(docs.Any(d => d.GetField("Id").AsString() == guid.ToString()));
}
}
}
示例6: Clamp1D
public void Clamp1D()
{
List<int> data = new List<int>() { 0, 1, 2, 3 };
Indexer<int> idx = new Indexer<int>(data, ClampMode.Clamp);
Assert.AreEqual(0, idx[-1]);
Assert.AreEqual(1, idx[1]);
Assert.AreEqual(3, idx[5]);
}
示例7: SetUp
public void SetUp()
{
_dictionary = new Dictionary<string, Guid>();
_guid = Guid.NewGuid();
_key = "some key";
_dictionary.Add(_key, _guid);
_indexer = new Indexer<string, Guid>(s => _dictionary[s], (s, g) => _guid = g);
}
示例8: Team
/// <summary>Initializes a new team</summary>
/// <remarks><see cref="Name"/> initializes according to <i>teamNumber</i>; <b>0</b> = "Imperial", <b>1</b> = "Rebel", other = "Team #"</remarks>
/// <param name="teamNumber">Team index being initialized. Corrects to <b>0-9</b> as required</param>
public Team(int teamNumber)
{
if (teamNumber <= 0) { _name = "Imperial"; _alliedWithTeam[0] = true; }
else if (teamNumber == 1) _name = "Rebel";
else _name = "Team " + (teamNumber > 8 ? 10 : teamNumber + 1);
for (int i = 0; i < 6; i++) _endOfMissionMessages[i] = "";
_eomMessageIndexer = new Indexer<string>(_endOfMissionMessages, 63);
}
示例9: For
public static IEnumerable<IRequestData> For(IRequestData data, string prefix)
{
var indexer = new Indexer(prefix);
while (data.HasChildRequest(indexer.Prefix))
{
yield return data.GetChildRequest(indexer.Prefix);
indexer.Increment();
}
}
示例10: Scanner
public Scanner(Settings settings)
{
indexer = new Indexer();
indexer.MinLength = settings.MinLength;
if (settings.UseStopWords)
{
TextReader rdr = new TextReader("stopwords.txt");
indexer.SetStopWords(rdr.GetText());
}
}
示例11: Repeat1D
public void Repeat1D()
{
List<int> data = new List<int>() { 0, 1, 2, 3 };
Indexer<int> idx = new Indexer<int>(data, ClampMode.Repeat);
Assert.AreEqual(3, idx[-1]);
Assert.AreEqual(2, idx[-2]);
Assert.AreEqual(1, idx[1]);
Assert.AreEqual(1, idx[5]);
Assert.AreEqual(0, idx[8]);
}
示例12: Main
public static int Main (string[] args)
{
Indexer indexer = new Indexer ();
foreach (string filename in args) {
Console.WriteLine ("\nparse: " + filename);
indexer.Parse (filename);
}
return 0;
}
示例13: VisitIndexer
public override Expression VisitIndexer(Indexer indexer)
{
ExpressionList ops = this.VisitExpressionList(indexer.Operands);
System.Diagnostics.Debug.Assert(ops != null, "VisitExpressionList must return non-null if passed non-null");
indexer.Operands = ops;
Expression obj = this.VisitExpression(indexer.Object);
System.Diagnostics.Debug.Assert(obj != null, "VisitExpression must return non-null if passed non-null");
indexer.Object = obj;
return indexer;
}
示例14: Wrap2D
public void Wrap2D()
{
List<int> data = new List<int>() {
00, 01, 02,
10, 11, 12,
20, 21, 22 };
Indexer<int> idx = new Indexer<int>(data, 3);
Assert.AreEqual(20, idx[-1, 0]);
Assert.AreEqual(2, idx[0, -1]);
Assert.AreEqual(0, idx[0, 0]);
Assert.AreEqual(12, idx[1, 2]);
Assert.AreEqual(20, idx[1, 3]);
Assert.AreEqual(10, idx[3, 3]);
}
示例15: IndexerTest
public void IndexerTest()
{
const int length = 5;
var list = Enumerable.Range(0, length).ToList();
var indexer = new Indexer<int>(()=>list.Count, (i)=>list[i], (i,v) => list[i] = v);
indexer.Count.Is(length);
for (int i = 0; i < indexer.Count; i++)
{
indexer[i].Is(i);
indexer[i] = i * i;
indexer[i].Is(i*i);
}
}