Exemplo n.º 1
0
 public Matrix(int width, int height, T[] dictionary, TraverseOrientation traverseOrientation)
 {
     Width  = width;
     Height = height;
     Data   = new T[Width, Height];
     _traverseOrientation = traverseOrientation;
     Populate(dictionary, _traverseOrientation);
 }
Exemplo n.º 2
0
 private void Populate(T[] dictionary, TraverseOrientation traverseOrientation)
 {
     switch (traverseOrientation)
     {
     case TraverseOrientation.TopToBottom:
         var currentDictionaryIndex = 0;
         var dictionaryLength       = dictionary.Length;
         for (var i = 0; i < Width; i++)
         {
             for (var j = 0; j < Height; j++)
             {
                 T item = dictionary[currentDictionaryIndex % dictionaryLength];
                 Data[i, j] = item;
                 currentDictionaryIndex++;
             }
         }
         break;
     }
 }