|
intarray Specification SheetPortable Object Compiler (c) 1998. All Rights Reserved.
IntArrayInherits from: Array
Class DescriptionIntArray instances are used to hold regular, small, C integers (of type int). This class is somewhat similar to String, the difference being that a String is an Array of bytes, while this class provides a somewhat similar API to strings of int.
Method typesCreationInterrogationResizingPrintingArchivingMethodsnew+newCreates an instance whose value is set to the empty array.
new:+new:(unsigned)nCreates an instance of n zeroes.
with:+with:(int)nArgs,...Creates an instance of nArgs objects, using a variable number of int arguments.
id myArray = [IntArray with:3,0,1,2]; copy-copyReturns a copy of the receiver with its internal C array copied as well. See also: - strCopy
deepCopy-deepCopyFor this class, this method acts as copy.
free-freeFrees the receiver and its internal C array as well.
size- (unsigned)sizeReturns the number of integers in the array. For this class, size is equivalent to capacity.
intAt:- (int)intAt:(unsigned)anOffsetReturns the integer at anOffset or generates an error if anOffset is greater than the length of the C array.
intAt:put:- (int)intAt:(unsigned)anOffsetput:(int)anIntReplaces the integer at anOffset with anInt and returns the old integer which was in that location. Generates an out of bounds exception if anOffset is greater than the length of the array.
capacity- (unsigned)capacityReturns the number of integers in the array. For this class, capacity is equivalent to size.
capacity:-capacity:(unsigned)nSlotsChanges the capacity to nSlots. If nSlots is larger than the current capacity, the memory added at the end will be zero-filled. If nSlots is less than the current capacity, the array is truncated.
packContents-packContentsRemoves zero elements while preserving the order of elements in the IntArray. Used to eliminate the 'hole' left by a at:put: message with a zero argument.
printOn:-printOn:(IOD)aFilePrints the array to aFile without appending a newline. Returns the receiver.
fileOutOn:-fileOutOn:aFilerWrites the array on aFiler. Returns the receiver.
fileInFrom:-fileInFrom:aFilerReads a array object from aFiler. Returns the receiver.
|