本文整理汇总了C#中PriorityQueue.AddPriorityGroup方法的典型用法代码示例。如果您正苦于以下问题:C# PriorityQueue.AddPriorityGroup方法的具体用法?C# PriorityQueue.AddPriorityGroup怎么用?C# PriorityQueue.AddPriorityGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PriorityQueue
的用法示例。
在下文中一共展示了PriorityQueue.AddPriorityGroup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Simple
public void Simple()
{
var priorityQueue = new PriorityQueue<string, int>(PriorityQueueType.Minimum);
var stringValues = new[] { "a", "b", "c", "d" };
priorityQueue.AddPriorityGroup(stringValues, 4);
stringValues = new[] { "e", "f", "g", "h" };
priorityQueue.AddPriorityGroup(stringValues, 2);
int priority;
Assert.AreEqual(priorityQueue.Dequeue(out priority), "e");
Assert.AreEqual(priority, 2);
Assert.AreEqual(priorityQueue.Dequeue(out priority), "f");
Assert.AreEqual(priority, 2);
Assert.AreEqual(priorityQueue.Dequeue(out priority), "g");
Assert.AreEqual(priority, 2);
Assert.AreEqual(priorityQueue.Dequeue(out priority), "h");
Assert.AreEqual(priority, 2);
Assert.AreEqual(priorityQueue.Dequeue(out priority), "a");
Assert.AreEqual(priority, 4);
Assert.AreEqual(priorityQueue.Dequeue(out priority), "b");
Assert.AreEqual(priority, 4);
Assert.AreEqual(priorityQueue.Dequeue(out priority), "c");
Assert.AreEqual(priority, 4);
Assert.AreEqual(priorityQueue.Dequeue(out priority), "d");
Assert.AreEqual(priority, 4);
}
示例2: ExceptionNullList
public void ExceptionNullList()
{
var priorityQueue = new PriorityQueue<string, int>(PriorityQueueType.Minimum);
priorityQueue.AddPriorityGroup(null, 4);
}