1 class SCR_SortedArray<Class TValue>: Managed
3 protected ref array<int> m_aOrders =
new array<int>();
4 protected ref array<TValue>
m_aValues =
new array<TValue>();
20 void Set(
int n, TValue value)
30 void Insert(
int order, TValue value)
33 for (
int i = 0; i <
index; i++)
35 if (order < m_aOrders[i])
41 m_aOrders.InsertAt(order,
index);
50 m_aOrders.RemoveOrdered(i);
57 void RemoveOrders(
int order)
59 for (
int i = Count() - 1; i >= 0; i--)
61 if (m_aOrders[i] == order)
63 m_aOrders.RemoveOrdered(i);
72 void RemoveValues(TValue value)
74 for (
int i = Count() - 1; i >= 0; i--)
78 m_aOrders.RemoveOrdered(i);
104 return m_aOrders.Count();
111 return m_aOrders.IsEmpty();
125 int Find(TValue value)
134 int CopyFrom(notnull SCR_SortedArray<TValue> from)
137 int count = from.Count();
138 for (
int i = 0; i < count; i++)
140 m_aOrders.Insert(from.m_aOrders[i]);
158 int ToArray(out notnull array<TValue> outArray)
167 PrintFormat(
"SCR_SortedArray count: %1", Count());
168 for (
int i, count = Count(); i < count; i++)
170 PrintFormat(
"[%1] => %2: %3", i, m_aOrders[i],
m_aValues[i]);