예제 #1
0
 private void HandleCollisions(IEnumerable<int> collisions, FrequencyHandlerWithTabu frequencyHandler)
 {
     TRX[] frequencies = frequencyHandler.GetFrequencyArray();
     Parallel.ForEach(collisions, collisionIndex =>
     {
         if (collisionIndex > -1)
         {
             int newFrequency = RandomizeChannelIndex(frequencies[collisionIndex], frequencyHandler.TabuList);
             frequencies[collisionIndex] = new TRX(newFrequency);
         }
     }
     );
 }
 private static IEnumerable<int> FindCollisionsForTabuItem(FrequencyHandlerWithTabu frequencyHandler, TRXTabu tabu)
 {
     var collisions = frequencyHandler.GetFrequencyArray().Select((freq, freqIndex) =>
     {
         if ((freq.Value == tabu.TRX.Value) && (freqIndex == tabu.Index))
         {
             return freqIndex;
         }
         return -1;
     }
     );
     return collisions;
 }
예제 #3
0
 public FrequencyHandlerWithTabu(FrequencyHandlerWithTabu frequencyHandler)
     : base(frequencyHandler)
 {
     TabuList = new Queue<TRXTabu>(frequencyHandler.TabuList);
 }