Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_SortedArray.c
Go to the documentation of this file.
1
class
SCR_SortedArray<
Class
TValue>
2
{
3
protected
ref array<int>
m_aOrders
= {};
4
protected
ref array<TValue>
m_aValues
= {};
5
6
//------------------------------------------------------------------------------------------------
9
TValue
Get
(
int
n)
10
{
11
return
m_aValues
.Get(n);
12
}
13
14
//------------------------------------------------------------------------------------------------
18
void
Set
(
int
n, TValue value)
19
{
20
m_aValues
.Set(n, value);
21
}
22
23
//------------------------------------------------------------------------------------------------
28
void
Insert
(
int
order, TValue value)
29
{
30
int
index
=
Count
();
31
for
(
int
i = 0; i <
index
; i++)
32
{
33
if
(order <
m_aOrders
[i])
34
{
35
index
= i;
36
break
;
37
}
38
}
39
40
m_aOrders
.InsertAt(order,
index
);
41
m_aValues
.InsertAt(value,
index
);
42
}
43
44
//------------------------------------------------------------------------------------------------
47
void
Remove
(
int
i)
48
{
49
m_aOrders
.RemoveOrdered(i);
50
m_aValues
.RemoveOrdered(i);
51
}
52
53
//------------------------------------------------------------------------------------------------
56
void
RemoveOrders
(
int
order)
57
{
58
for
(
int
i =
Count
() - 1; i >= 0; i--)
59
{
60
if
(
m_aOrders
[i] == order)
61
{
62
m_aOrders
.RemoveOrdered(i);
63
m_aValues
.RemoveOrdered(i);
64
}
65
}
66
}
67
68
//------------------------------------------------------------------------------------------------
71
void
RemoveValues
(TValue value)
72
{
73
for
(
int
i =
Count
() - 1; i >= 0; i--)
74
{
75
if
(
m_aValues
[i] == value)
76
{
77
m_aOrders
.RemoveOrdered(i);
78
m_aValues
.RemoveOrdered(i);
79
}
80
}
81
}
82
83
//------------------------------------------------------------------------------------------------
86
int
GetOrder
(
int
i)
87
{
88
return
m_aOrders
[i];
89
}
90
91
//------------------------------------------------------------------------------------------------
94
TValue
GetValue
(
int
i)
95
{
96
return
m_aValues
[i];
97
}
98
99
//------------------------------------------------------------------------------------------------
101
int
Count
()
102
{
103
return
m_aOrders
.Count();
104
}
105
106
//------------------------------------------------------------------------------------------------
108
bool
IsEmpty
()
109
{
110
return
m_aOrders
.IsEmpty();
111
}
112
113
//------------------------------------------------------------------------------------------------
115
bool
Contains
(TValue value)
116
{
117
return
m_aValues
.Contains(value);
118
}
119
120
//------------------------------------------------------------------------------------------------
124
int
Find
(TValue value)
125
{
126
return
m_aValues
.Find(value);
127
}
128
129
//------------------------------------------------------------------------------------------------
133
int
CopyFrom
(notnull SCR_SortedArray<TValue> from)
134
{
135
Clear
();
136
int
count = from.Count();
137
for
(
int
i; i < count; i++)
138
{
139
m_aOrders
.Insert(from.m_aOrders[i]);
140
m_aValues
.Insert(from.m_aValues[i]);
141
}
142
143
return
count;
144
}
145
146
//------------------------------------------------------------------------------------------------
148
void
Clear
()
149
{
150
m_aOrders
.Clear();
151
m_aValues
.Clear();
152
}
153
154
//------------------------------------------------------------------------------------------------
158
int
ToArray
(out notnull array<TValue> outArray)
159
{
160
return
outArray.Copy(
m_aValues
);
161
}
162
163
//------------------------------------------------------------------------------------------------
165
void
Debug
()
166
{
167
PrintFormat
(
"SCR_SortedArray count: %1"
,
Count
(), level:
LogLevel
.NORMAL);
168
for
(
int
i, count =
Count
(); i < count; i++)
169
{
170
PrintFormat
(
"[%1] => %2: %3"
, i,
m_aOrders
[i],
m_aValues
[i], level:
LogLevel
.NORMAL);
171
}
172
}
173
}
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition
SCR_DestructionSynchronizationComponent.c:17
Class
Super root of all classes in Enforce script.
Definition
Types.c:35
SCR_SortedArray< Class TValue >::Set
void Set(int n, TValue value)
Definition
SCR_SortedArray.c:18
SCR_SortedArray< Class TValue >::RemoveValues
void RemoveValues(TValue value)
Definition
SCR_SortedArray.c:71
SCR_SortedArray< Class TValue >::Contains
bool Contains(TValue value)
Definition
SCR_SortedArray.c:115
SCR_SortedArray< Class TValue >::Clear
void Clear()
Destroys all elements of the array and sets the Count to 0.
Definition
SCR_SortedArray.c:148
SCR_SortedArray< Class TValue >::Count
int Count()
Definition
SCR_SortedArray.c:101
SCR_SortedArray< Class TValue >::ToArray
int ToArray(out notnull array< TValue > outArray)
Definition
SCR_SortedArray.c:158
SCR_SortedArray< Class TValue >::Insert
void Insert(int order, TValue value)
Definition
SCR_SortedArray.c:28
SCR_SortedArray< Class TValue >::GetValue
TValue GetValue(int i)
Definition
SCR_SortedArray.c:94
SCR_SortedArray< Class TValue >::Debug
void Debug()
Print array values to log.
Definition
SCR_SortedArray.c:165
SCR_SortedArray< Class TValue >::Remove
void Remove(int i)
Definition
SCR_SortedArray.c:47
SCR_SortedArray< Class TValue >::CopyFrom
int CopyFrom(notnull SCR_SortedArray< TValue > from)
Definition
SCR_SortedArray.c:133
SCR_SortedArray< Class TValue >::IsEmpty
bool IsEmpty()
Definition
SCR_SortedArray.c:108
SCR_SortedArray< Class TValue >::Find
int Find(TValue value)
Definition
SCR_SortedArray.c:124
SCR_SortedArray< Class TValue >::Get
TValue Get(int n)
Definition
SCR_SortedArray.c:9
SCR_SortedArray< Class TValue >::RemoveOrders
void RemoveOrders(int order)
Definition
SCR_SortedArray.c:56
SCR_SortedArray< Class TValue >::m_aValues
ref array< TValue > m_aValues
Definition
SCR_SortedArray.c:4
SCR_SortedArray< Class TValue >::m_aOrders
ref array< int > m_aOrders
Definition
SCR_SortedArray.c:3
SCR_SortedArray< Class TValue >::GetOrder
int GetOrder(int i)
Definition
SCR_SortedArray.c:86
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
PrintFormat
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
Clear
proto native void Clear()
Remove all calls from list.
Definition
SCR_HintSequenceComponent.c:119
Count
TypeID handle64 Count()
scripts
Game
Global
SCR_SortedArray.c
Generated by
1.17.0