Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ IntersectWith()

virtual void System.Collections.Generic.SortedSet< T >.IntersectWith ( IEnumerable< T > other)
inlinevirtualinherited

Implements System.Collections.Generic.ISet< T >.

Definition at line 1454 of file SortedSet.cs.

1455 {
1456 if (other == null)
1457 {
1458 throw new ArgumentNullException("other");
1459 }
1460 if (Count == 0 || other == this)
1461 {
1462 return;
1463 }
1465 TreeSubSet treeSubSet = this as TreeSubSet;
1466 if (treeSubSet != null)
1467 {
1468 VersionCheck();
1469 }
1470 if (sortedSet != null && treeSubSet == null && HasEqualComparer(sortedSet))
1471 {
1472 T[] array = new T[Count];
1473 int num = 0;
1475 Enumerator enumerator2 = sortedSet.GetEnumerator();
1476 bool flag = !enumerator.MoveNext();
1477 bool flag2 = !enumerator2.MoveNext();
1478 T max = Max;
1479 while (!flag && !flag2 && Comparer.Compare(enumerator2.Current, max) <= 0)
1480 {
1481 int num2 = Comparer.Compare(enumerator.Current, enumerator2.Current);
1482 if (num2 < 0)
1483 {
1484 flag = !enumerator.MoveNext();
1485 }
1486 else if (num2 == 0)
1487 {
1488 array[num++] = enumerator2.Current;
1489 flag = !enumerator.MoveNext();
1490 flag2 = !enumerator2.MoveNext();
1491 }
1492 else
1493 {
1494 flag2 = !enumerator2.MoveNext();
1495 }
1496 }
1497 root = null;
1498 root = ConstructRootFromSortedArray(array, 0, num - 1, null);
1499 count = num;
1500 version++;
1501 }
1502 else
1503 {
1505 }
1506 }
static Node ConstructRootFromSortedArray(T[] arr, int startIndex, int endIndex, Node redNode)
virtual void IntersectWithEnumerable(IEnumerable< T > other)
bool HasEqualComparer(SortedSet< T > other)
virtual void VersionCheck(bool updateCount=false)
Definition SortedSet.cs:894

References System.array, System.Collections.Generic.Comparer< T >.Compare(), System.Collections.Generic.SortedSet< T >.ConstructRootFromSortedArray(), System.Collections.Generic.SortedSet< T >.count, System.Collections.Generic.SortedSet< T >.Count, System.Collections.Generic.SortedSet< T >.GetEnumerator(), System.Collections.Generic.Dictionary< TKey, TValue >.GetEnumerator(), System.Collections.Generic.SortedSet< T >.HasEqualComparer(), System.Collections.Generic.SortedSet< T >.IntersectWithEnumerable(), System.Collections.Generic.SortedSet< T >.Max, System.other, System.Collections.Generic.SortedSet< T >.root, System.Collections.Generic.SortedSet< T >.version, and System.Collections.Generic.SortedSet< T >.VersionCheck().