Ejemplo n.º 1
0
 public static IEnumerable <IKeyPair> Reduce(this IReadOnlyList <DependentKeyPair> dependentKeyPairs)
 {
     for (var i = 0; i < dependentKeyPairs.Count; i++)
     {
         if (dependentKeyPairs[i].IsUsed)
         {
             yield return(KeyPairRepository.AtIndex(dependentKeyPairs[i].Index));
         }
     }
 }
Ejemplo n.º 2
0
        public static ISorter ToSorter2(this ISorterGenome sorterGenome)
        {
            IList <IReadOnlyList <IKeyPair> > keyPairGroups = sorterGenome.Chromosome.Sequence
                                                              .Select(i => KeyPairRepository.AtIndex((int)i))
                                                              .Slice(18)
                                                              .ToList();

            var sorter = StagedSorter.Make
                         (
                guid: sorterGenome.Guid,
                keyCount: sorterGenome.KeyCount,
                sorterStages: Enumerable.Range(0, 77)
                .Select(
                    i => keyPairGroups[i].ToReducedSorterStage(SwitchableGroups[i])
                    ).ToList()
                         );

            return(sorter);
        }