本文整理汇总了C#中PriorityQueue.AddAll方法的典型用法代码示例。如果您正苦于以下问题:C# PriorityQueue.AddAll方法的具体用法?C# PriorityQueue.AddAll怎么用?C# PriorityQueue.AddAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PriorityQueue
的用法示例。
在下文中一共展示了PriorityQueue.AddAll方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddAllWithCollection
public void AddAllWithCollection()
{
Int32[] empty = new Int32[0];
Int32[] ints = new Int32[SIZE];
for (int i = 0; i < SIZE; ++i)
ints[i] = (SIZE - 1 - i);
PriorityQueue q = new PriorityQueue(SIZE);
Assert.IsFalse(q.AddAll(new ArrayList(empty)));
Assert.IsTrue(q.AddAll(new ArrayList(ints)));
for (int i = 0; i < SIZE; ++i)
Assert.AreEqual(i, q.Poll());
}
示例2: AddAllWithCollectionWithNullElements
public void AddAllWithCollectionWithNullElements()
{
PriorityQueue q = new PriorityQueue(SIZE);
object[] ints = new object[SIZE];
q.AddAll(new ArrayList(ints));
}
示例3: AddAllWithCollectionWithSomeNullElements
public void AddAllWithCollectionWithSomeNullElements()
{
PriorityQueue q = new PriorityQueue(SIZE);
object[] ints = new object[SIZE];
for (int i = 0; i < SIZE - 1; ++i)
ints[i] = i;
q.AddAll(new ArrayList(ints));
}
示例4: AddAllWithNullElements
public void AddAllWithNullElements()
{
PriorityQueue q = new PriorityQueue(1);
q.AddAll(null);
}
示例5: ConstructorUsingComparator
public void ConstructorUsingComparator()
{
MyReverseComparator cmp = new MyReverseComparator();
PriorityQueue q = new PriorityQueue(SIZE, cmp);
Assert.AreEqual(cmp, q.Comparator());
Int32[] ints = new Int32[SIZE];
for (int i = 0; i < SIZE; ++i)
ints[i] = i;
q.AddAll(new ArrayList(ints));
for (int i = SIZE - 1; i >= 0; --i)
Assert.AreEqual(ints[i], q.Poll());
Assert.IsTrue( q.IsEmpty );
}
示例6: AddAllWithCollectionWithSomeNullElements
public void AddAllWithCollectionWithSomeNullElements()
{
PriorityQueue q = new PriorityQueue(SIZE);
object[] ints = new object[SIZE];
for (int i = 0; i < SIZE - 1; ++i)
ints[i] = i;
Assert.Throws<ArgumentNullException>(() => q.AddAll(new ArrayList(ints)));
}
示例7: AddAllWithCollectionWithNullElements
public void AddAllWithCollectionWithNullElements()
{
PriorityQueue q = new PriorityQueue(SIZE);
object[] ints = new object[SIZE];
Assert.Throws<ArgumentNullException>(() => q.AddAll(new ArrayList(ints)));
}
示例8: AddAllWithNullElements
public void AddAllWithNullElements()
{
PriorityQueue q = new PriorityQueue(1);
Assert.Throws<ArgumentNullException>(() => q.AddAll(null));
}