1 write to _data
Microsoft.ML.Tokenizers (1)
Utils\PriorityQueue.cs (1)
17
_data
= new List<T>(capacity);
34 references to _data
Microsoft.ML.Tokenizers (34)
Utils\PriorityQueue.cs (34)
22
_data
.Add(item);
23
int ci =
_data
.Count - 1; // child index; start at end
27
if (
_data
[ci].CompareTo(
_data
[pi]) >= 0) break; // child item is larger than (or equal) parent so we're done
28
T tmp =
_data
[ci];
_data
[ci] =
_data
[pi];
_data
[pi] = tmp;
36
int li =
_data
.Count - 1; // last index (before removal)
37
T frontItem =
_data
[0]; // fetch the front
38
_data
[0] =
_data
[li];
39
_data
.RemoveAt(li);
48
if (rc <= li &&
_data
[rc].CompareTo(
_data
[ci]) < 0) // if there is a rc (ci + 1), and it is smaller than left child, use the rc instead
50
if (
_data
[pi].CompareTo(
_data
[ci]) <= 0) break; // parent is smaller than (or equal to) smallest child so done
51
T tmp =
_data
[pi];
_data
[pi] =
_data
[ci];
_data
[ci] = tmp; // swap parent and child
59
T frontItem =
_data
[0];
63
public int Count =>
_data
.Count;
68
for (int i = 0; i <
_data
.Count; ++i)
69
s +=
_data
[i].ToString() + " ";
70
s += "count = " +
_data
.Count;
74
public void Clear() =>
_data
.Clear();
79
if (
_data
.Count == 0) return true;
80
int li =
_data
.Count - 1; // last index
81
for (int pi = 0; pi <
_data
.Count; ++pi) // each parent index
86
if (lci <= li &&
_data
[pi].CompareTo(
_data
[lci]) > 0) return false; // if lc exists and it's greater than parent then bad.
87
if (rci <= li &&
_data
[pi].CompareTo(
_data
[rci]) > 0) return false; // check the right child too.