91 lines · 4.2 KB · HTML
RawDownload
<HTML><TITLE>intarray Specification Sheet</TITLE><H1>intarray Specification Sheet</H1> <HR>Portable Object Compiler (c) 1998.  All Rights Reserved.<P><H1>IntArray</H1><B>Inherits from:</B> Array<P><H2>Class Description</H2><B>IntArray</B> instances are used to hold regular, small, C integers (of type <B>int</B>).  This class is somewhat similar to <B>String</B>, the difference being that a String is an Array of bytes, while this class provides a somewhat similar API to <I>strings of int</I>.<P><H2>Method types</H2><H3><B>Creation</B></H3><UL><LI><A HREF="#0">new</A></LI><LI><A HREF="#1">new:</A></LI><LI><A HREF="#2">with:</A></LI><LI><A HREF="#3">copy</A></LI><LI><A HREF="#4">deepCopy</A></LI><LI><A HREF="#5">free</A></LI></UL><H3><B>Interrogation</B></H3><UL><LI><A HREF="#7">size</A></LI><LI><A HREF="#8">intAt:</A></LI><LI><A HREF="#9">intAt:put:</A></LI></UL><H3><B>Resizing</B></H3><UL><LI><A HREF="#10">capacity</A></LI><LI><A HREF="#11">capacity:</A></LI><LI><A HREF="#12">packContents</A></LI></UL><H3><B>Printing</B></H3><UL><LI><A HREF="#13">printOn:</A></LI></UL><H3><B>Archiving</B></H3><UL><LI><A HREF="#14">fileOutOn:</A></LI><LI><A HREF="#15">fileInFrom:</A></LI></UL><H2>Methods</H2><H3><A NAME="0">new</A></H3><BLOCKQUOTE>+<B>new</B></BLOCKQUOTE>Creates an instance whose value is set to the empty array.<P><H3><A NAME="1">new:</A></H3><BLOCKQUOTE>+<B>new</B>:(unsigned)<I>n</I></BLOCKQUOTE>Creates an instance of <I>n</I> zeroes.<P><H3><A NAME="2">with:</A></H3><BLOCKQUOTE>+<B>with</B>:(int)<I>nArgs,...</I></BLOCKQUOTE>Creates an instance of <I>nArgs</I> objects, using a variable number of <I>int</I> arguments.<P><BLOCKQUOTE><PRE>id myArray = [IntArray with:3,0,1,2];</PRE></BLOCKQUOTE><H3><A NAME="3">copy</A></H3><BLOCKQUOTE>-<B>copy</B></BLOCKQUOTE>Returns a copy of the receiver with its internal C array copied as well.<P><B>See also:</B> - strCopy<P><H3><A NAME="4">deepCopy</A></H3><BLOCKQUOTE>-<B>deepCopy</B></BLOCKQUOTE>For this class, this method acts as <B>copy</B>.<P><H3><A NAME="5">free</A></H3><BLOCKQUOTE>-<B>free</B></BLOCKQUOTE>Frees the receiver and its internal C array as well.<P><H3><A NAME="7">size</A></H3><BLOCKQUOTE>- (unsigned)<B>size</B></BLOCKQUOTE>Returns the number of integers in the array.  For this class, <B>size</B> is equivalent to <B>capacity</B>.<P><H3><A NAME="8">intAt:</A></H3><BLOCKQUOTE>- (int)<B>intAt</B>:(unsigned)<I>anOffset</I></BLOCKQUOTE>Returns the integer at <I>anOffset</I> or signals the <B>OutOutBounds</B> exception if <I>anOffset</I> is greater than the length of the C array.<P><H3><A NAME="9">intAt:put:</A></H3><BLOCKQUOTE>- (int)<B>intAt</B>:(unsigned)<I>anOffset</I><B>put</B>:(int)<I>anInt</I></BLOCKQUOTE>Replaces the integer at <I>anOffset</I> with <I>anInt</I> and returns the old integer which was in that location.  Generates an out of bounds exception if <I>anOffset</I> is greater than the length of the array.<P><H3><A NAME="10">capacity</A></H3><BLOCKQUOTE>- (unsigned)<B>capacity</B></BLOCKQUOTE>Returns the number of integers in the array.  For this class, <B>capacity</B> is equivalent to <B>size</B>.<P><H3><A NAME="11">capacity:</A></H3><BLOCKQUOTE>-<B>capacity</B>:(unsigned)<I>nSlots</I></BLOCKQUOTE>Changes the capacity to <I>nSlots</I>.  If <I>nSlots</I> is larger than the current capacity, the memory added at the end will be zero-filled.  If <I>nSlots</I> is less than the current capacity, the array is truncated.<P><H3><A NAME="12">packContents</A></H3><BLOCKQUOTE>-<B>packContents</B></BLOCKQUOTE>Removes zero elements while preserving the order of elements in the <B>IntArray</B>.  Used to eliminate the 'hole' left by a <B>at:put:</B> message with a zero argument.<P><H3><A NAME="13">printOn:</A></H3><BLOCKQUOTE>-<B>printOn</B>:(IOD)<I>aFile</I></BLOCKQUOTE>Prints the array to <I>aFile</I> without appending a newline.  Returns the receiver.<P><H3><A NAME="14">fileOutOn:</A></H3><BLOCKQUOTE>-<B>fileOutOn</B>:<I>aFiler</I></BLOCKQUOTE>Writes the array on <I>aFiler</I>.  Returns the receiver.<P><H3><A NAME="15">fileInFrom:</A></H3><BLOCKQUOTE>-<B>fileInFrom</B>:<I>aFiler</I></BLOCKQUOTE>Reads a array object from <I>aFiler</I>.  Returns the receiver.<P>

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t