[go: up one dir, main page]

Menu

[9a0086]: / man / man3 / IdArray.3  Maximize  Restore  History

Download this file

362 lines (355 with data), 3.8 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
.TH "idarray" 3 "Mar 12, 2023"
.SH IdArray
.PP
.B
Inherits from:
Array
.SH Class Description
.PP
.B
IdArray
instances are used to hold objects (
.B
nil
is allowed)\&. This class is somewhat similar to
.B
String
, the difference being that a String is an Array of bytes, while this class provides a somewhat similar API to
.I
strings of id
\&.
.PP
.B
Note:
This class is present mostly for compatibility with ICpak101\&. You most likely want to use
.B
OrdCltn
instead of this class\&.
.PP
The method
.B
size
returns the number of non-nil objects in the
.B
IdArray
\&. The method
.B
capacity
returns the total number of objects that the array can hold\&.
.SH Method types
.PP
.B
Creation
.RS 3
.br
* new
.br
* new:
.br
* with:
.br
* copy
.br
* deepCopy
.br
* free
.RE
.PP
.B
Interrogation
.RS 3
.br
* size
.br
* at:
.br
* at:put:
.RE
.PP
.B
Resizing
.RS 3
.br
* capacity
.br
* capacity:
.br
* packContents
.RE
.PP
.B
Printing
.RS 3
.br
* printOn:
.RE
.PP
.B
Archiving
.RS 3
.br
* fileOutOn:
.br
* fileInFrom:
.RE
.SH Methods
.PP
new
.RS 1
+
.B
new
.RE
.PP
Creates an instance whose value is set to the empty array\&.
.PP
new:
.RS 1
+
.B
new
:(unsigned)
.I
n
.RE
.PP
Creates an instance of
.I
n
.B
nil
objects\&.
.PP
with:
.RS 1
+
.B
with
:(int)
.I
nArgs,\&.\&.\&.
.RE
.PP
Creates an instance of
.I
nArgs
objects, using a variable number of arguments, that may contain
.B
nil
objects\&.
.RS 3
id myArray = [IdArray with:3,nil,[Object new],nil];
.br
.RE
.PP
copy
.RS 1
-
.B
copy
.RE
.PP
Returns a copy of the receiver with its internal C array copied as well (but not the objects that it contains)\&.
.PP
deepCopy
.RS 1
-
.B
deepCopy
.RE
.PP
Like
.B
copy
, but also sends
.B
deepCopy
messages to the objects in the IdArray\&.
.PP
free
.RS 1
-
.B
free
.RE
.PP
Frees the receiver and its internal C array as well\&.
.PP
size
.RS 1
- (
unsigned
)
.B
size
.RE
.PP
Returns the number of non-nil objects in the array\&.
.PP
.B
Note:
For Stepstone compatibility (with ICpak101) this method is, for this class, not the same as
.B
capacity
\&. In the case of the
.B
IntArray
class,
.B
size
and
.B
capacity
are the same\&.
.PP
at:
.RS 1
-
.B
at
:(unsigned)
.I
anOffset
.RE
.PP
Returns the object at
.I
anOffset
or signals the
.B
OutOfBounds
exception if
.I
anOffset
is greater than the length of the array\&.
.PP
Unlike for
.B
OrdCltn
instances, this method may return a nil object\&.
.PP
at:put:
.RS 1
-
.B
at
:(unsigned)
.I
anOffset
.B
put
:
.I
anObject
.RE
.PP
Replaces the object at
.I
anOffset
with
.I
anObject
and returns the old object which was in that location\&. Generates an out of bounds exception if
.I
anOffset
is greater than the length of the array\&.
.PP
Unlike for
.B
OrdCltn
instances, this method will accept a nil object\&.
.PP
capacity
.RS 1
- (
unsigned
)
.B
capacity
.RE
.PP
Returns the total number of objects in the IdArray\&. (nil or non-nil)\&.
.PP
capacity:
.RS 1
-
.B
capacity
:(unsigned)
.I
nSlots
.RE
.PP
Changes the capacity to
.I
nSlots
\&. If
.I
nSlots
is larger than the current capacity, the memory added at the end will be zero-filled\&. If
.I
nSlots
is less than the current capacity, the array is truncated\&.
.PP
packContents
.RS 1
-
.B
packContents
.RE
.PP
Removes nil objects while preserving the order of elements in the
.B
IdArray
\&. Used to eliminate the \&'hole\&' left by a
.B
at:put:
message with a
.B
nil
argument\&.
.PP
printOn:
.RS 1
-
.B
printOn
:(IOD)
.I
aFile
.RE
.PP
Prints the array to
.I
aFile
without appending a newline\&. Returns the receiver\&.
.PP
fileOutOn:
.RS 1
-
.B
fileOutOn
:
.I
aFiler
.RE
.PP
Writes the array on
.I
aFiler
\&. Returns the receiver\&.
.PP
fileInFrom:
.RS 1
-
.B
fileInFrom
:
.I
aFiler
.RE
.PP
Reads a array object from
.I
aFiler
\&. Returns the receiver\&.