示例#1
0
 /// <summary>
 /// Returns a list of values from the InputKrystal (axis or contour) aligned to the outerSuperStrands.
 /// The returned List has as many values as there are strands in the source file at permutationLevel and below.
 /// The permutationLevel must be less than or equal to the level of the source krystal, and greater than the
 /// level of the InputKrystal.
 /// </summary>
 /// <param name="source"></param>
 /// <param name="krystal"></param>
 /// <returns></returns>
 private List<int> GetSourceAlignedValues(PermutationSourceInputKrystal source, uint permutationLevel, InputKrystal acKrystal)
 {
     Debug.Assert(permutationLevel <= source.Level && permutationLevel > acKrystal.Level);
     List<int> alignedValues = new List<int>();
     int acStrandIndex = 0;
     int acValueIndex = 0;
     int acValueLevel = (int)acKrystal.Level + 1;
     foreach(Strand strand in source.Strands)
     {
         if(permutationLevel == 1)
         {
             AddValue(alignedValues, acKrystal, acStrandIndex, acValueIndex);
             break;
         }
         else if(strand.Level <= permutationLevel)
         {
             if(strand.Level == 1)
             {
                 acStrandIndex = 0;
                 acValueIndex = 0;
             }
             else if(strand.Level == acValueLevel)
             {
                 acValueIndex++;
             }
             else if(strand.Level < acValueLevel)
             {
                 acStrandIndex++;
                 acValueIndex = 0;
             }
             AddValue(alignedValues, acKrystal, acStrandIndex, acValueIndex);
         }
         // else if(strand.Level > permutationLevel) do nothing
     }
     return alignedValues;
 }
示例#2
0
        private void AddValue(List<int> alignedValues, InputKrystal acKrystal, int acStrandIndex, int acValueIndex)
        {
            Debug.Assert(acStrandIndex < acKrystal.Strands.Count);
            Debug.Assert(acValueIndex < acKrystal.Strands[acStrandIndex].Values.Count);

            alignedValues.Add((int)(acKrystal.Strands[acStrandIndex].Values[acValueIndex]));
        }