public TestPair(DatabaseIndex probe, DatabaseIndex candidate) { Probe = probe; Candidate = candidate; }
public IEnumerable <TestPair> GetAllPairs(DatabaseIndex probe) { return(GetMatchingPairs(probe).Concat(GetNonMatchingPairs(probe))); }
public View this[DatabaseIndex index] { get { return(Fingers[index.Finger].Views[index.View]); } }
public IEnumerable <TestPair> GetNonMatchingPairs(DatabaseIndex probe) { return((from view in GetSelfAndConsequentViews(probe) from candidate in GetConsequentFingers(view) select new TestPair(probe, candidate)).Take(NonMatchingPerProbe)); }
public IEnumerable <DatabaseIndex> GetConsequentFingers(DatabaseIndex probe) { return(from offset in Enumerable.Range(1, FingerCount - 1) select new DatabaseIndex((probe.Finger + offset) % FingerCount, probe.View)); }
public IEnumerable <TestPair> GetMatchingPairs(DatabaseIndex probe) { return((from candidate in GetConsequentViews(probe) select new TestPair(probe, candidate)).Take(MatchingPerProbe)); }
public IEnumerable <DatabaseIndex> GetConsequentViews(DatabaseIndex probe) { return(GetSelfAndConsequentViews(probe).Skip(1)); }
public IEnumerable <DatabaseIndex> GetSelfAndConsequentViews(DatabaseIndex probe) { return(from offset in Enumerable.Range(0, ViewCount) select new DatabaseIndex(probe.Finger, (probe.View + offset) % ViewCount)); }