本文整理汇总了C#中Indexer类的典型用法代码示例。如果您正苦于以下问题:C# Indexer类的具体用法?C# Indexer怎么用?C# Indexer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Indexer类属于命名空间,在下文中一共展示了Indexer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Indexer_Index
public void Indexer_Index()
{
var indexsource = new FeedsDbContextIndexSource(new FeedsDbEntities(), 100);
var indexer = new Indexer<Document>(indexsource);
indexer.Index();
}
开发者ID:benmcevoy,项目名称:Rss,代码行数:7,代码来源:UnitTest1.cs
示例2: DfaState
internal DfaState()
{
Indexer<DfaState>.Add(this);
_trasition = new Indexer<DfaState>.Array(byte.MaxValue + 1);
_nfaStates = null;
}
开发者ID:five-x,项目名称:siprevo,代码行数:7,代码来源:DfaState.cs
示例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);
}
}
}
}
开发者ID:ItsJustSean,项目名称:TailBlazer,代码行数:35,代码来源:IndexerFixture.cs
示例4: Start
public void Start()
{
_graphClient = CreateGraphClient();
_indexer = CreateIndexer();
_eventHandlerMapping = CreateEventHandlerMapping();
ConnectToEventstore();
}
开发者ID:jrgcubano,项目名称:CQRSShop,代码行数:7,代码来源:IndexingServie.cs
示例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()));
}
}
}
开发者ID:xpohama,项目名称:Luceneria,代码行数:31,代码来源:LuceneTest.cs
示例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]);
}
开发者ID:ddebowczyk,项目名称:CoreSociety,代码行数:8,代码来源:IndexerTests.cs
示例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);
}
开发者ID:joshuaflanagan,项目名称:fubumvc,代码行数:8,代码来源:IndexerTester.cs
示例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);
}
开发者ID:MikeG621,项目名称:Platform,代码行数:11,代码来源:Team.cs
示例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();
}
}
开发者ID:marcusswope,项目名称:Hit-That-Line,代码行数:10,代码来源:EnumerateFlatRequestData.cs
示例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());
}
}
开发者ID:trustmaster,项目名称:WordFreqAnalyzer,代码行数:10,代码来源:Scanner.cs
示例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]);
}
开发者ID:ddebowczyk,项目名称:CoreSociety,代码行数:10,代码来源:IndexerTests.cs
示例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;
}
开发者ID:emtees,项目名称:old-code,代码行数:11,代码来源:App.cs
示例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;
}
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:11,代码来源:EmptyVisitor.cs
示例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]);
}
开发者ID:ddebowczyk,项目名称:CoreSociety,代码行数:14,代码来源:IndexerTests.cs
示例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);
}
}
开发者ID:manbou404,项目名称:CSharpLab,代码行数:14,代码来源:IndexerTests.cs
示例16: FlightGroup
/// <summary>Initializes a new FlightGroup</summary>
/// <remarks>All <see cref="Orders"/> set to <b>100%</b> <see cref="BaseFlightGroup.BaseOrder.Throttle"/>, <see cref="Goals"/> are all set to <b>NONE</b>, SP1 <b>Enabled</b>, <see cref="Unknowns"/> are <b>0/false</b></remarks>
public FlightGroup()
{
_stringLength = 0x14;
for (int i = 0; i < _orders.Length; i++) _orders[i] = new Order();
for (int i = 0; i < _roles.Length; i++) _roles[i] = "";
for (int i = 0; i < _arrDepTriggers.Length; i++) _arrDepTriggers[i] = new Mission.Trigger();
for (int i = 0; i < _skipToOrder4Trigger.Length; i++) { _skipToOrder4Trigger[i] = new Mission.Trigger(); _skipToOrder4Trigger[i].Condition = 10; }
for (int i = 0; i < _goals.Length; i++) _goals[i] = new Goal();
_optLoad[0] = true;
_optLoad[8] = true;
_optLoad[12] = true;
for (int i = 0; i < _waypoints.Length; i++) _waypoints[i] = new Waypoint();
_waypoints[(int)WaypointIndex.Start1].Enabled = true;
_rolesIndexer = new Indexer<string>(_roles, 4);
_loadoutIndexer = new LoadoutIndexer(_optLoad);
}
开发者ID:MikeG621,项目名称:Platform,代码行数:18,代码来源:FlightGroup.cs
示例17: button1_Click
private void button1_Click(object sender, EventArgs e)
{
if (isearcher != null) isearcher.Close();
isearcher = null;
folderBrowserDialog1.ShowNewFolderButton = false;
if (folderBrowserDialog1.ShowDialog() != DialogResult.OK || folderBrowserDialog1.SelectedPath == string.Empty)
{
return;
}
textBox1.Text = folderBrowserDialog1.SelectedPath;
Indexer indexer = new Indexer(_indexTarget);
indexer.UpdateCallback = new IndexerUpdateCallback(this.UpdateIndexingInfo);
indexer.IndexDirectory(folderBrowserDialog1.SelectedPath);
}
开发者ID:usmanghani,项目名称:Misc,代码行数:16,代码来源:Form1.cs
示例18: IndexerTest2
public void IndexerTest2()
{
const int length = 5;
var list = Enumerable.Range(5, length).ToList();
var indexerAllNull = new Indexer<int>(null, null);
indexerAllNull[0].Is(0); // 未定義はdefault(T)が返る
indexerAllNull.Count.Is(0); // 未定義は0が返る
AssertEx.Throws<NotSupportedException>(() => indexerAllNull[0] = 0);
var indexerCountNull = new Indexer<int>(null, i => list[i]);
indexerCountNull[0].Is(5);
indexerCountNull.Count.Is(0); // 未定義は0が返る
AssertEx.Throws<NotSupportedException>(() => indexerCountNull[0] = 0);
// この例外は、Indexerが出しているのではなく、setterのActionがListにアクセスして発生する
AssertEx.Throws <ArgumentOutOfRangeException>(() => indexerCountNull[5].Is(0));
}
开发者ID:manbou404,项目名称:CSharpLab,代码行数:17,代码来源:IndexerTests.cs
示例19: IndexerGerTest
public void IndexerGerTest()
{
using (var indexer = new Indexer(this.Directory)) {
// TODO: use the right analyser here; document contains "donaudampfschiff...."
// this is missing: indexer.Analyser = new Lucene.Net.Analysis.Compound.HyphenationCompoundWordTokenFilter(indexer.Version);
// IndexTest(indexer, TestDir + "TikaGer.odt", "donau");
#if LuceneV303
indexer.Analyser = new Lucene.Net.Analysis.De.GermanAnalyzer(indexer.Version);
indexer.Analyser = new Lucene.Net.Analysis.Snowball.SnowballAnalyzer(indexer.Version,"German");
#endif
#if LuceneV290
indexer.Analyser = new Lucene.Net.Analysis.Snowball.SnowballAnalyzer("German");
#endif
// remark: document contains "Wörter", so find it with:
IndexTest(indexer, TestDir + "TikaGer.docx", "wort");
}
}
开发者ID:xpohama,项目名称:Luceneria,代码行数:17,代码来源:LuceneTest.cs
示例20: GetTargetOf
public Core GetTargetOf(Core core)
{
int x, y;
Indexer<Entry> c = new Indexer<Entry>(_entries, _width, ClampMode.Repeat);
c.Find(e => e.Core == core, out x, out y);
switch (core.Target)
{
case Core.Focus.Up:
return c[y - 1, x].Core;
case Core.Focus.Right:
return c[y, x + 1].Core;
case Core.Focus.Down:
return c[y + 1, x].Core;
case Core.Focus.Left:
return c[y, x - 1].Core;
default:
return core;
}
}
开发者ID:ddebowczyk,项目名称:CoreSociety,代码行数:19,代码来源:Grid.cs
注:本文中的Indexer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论