8.2. File tom/Array

class tom.Array

Array is the superclass of all arrays; it is an Indexed Collection

inherits

State supers: State, Indexed, C

instance tom.Array

variables

public int length;

The number of elements in the array.

pointer contents;

A pointer to the elements of this array.

methods


void
  dealloc;

Clean up the memory this array is using.


deferred int
  elementByteSize;

Return the size, in bytes, of the elements contained in this Array.


id
  initAsCopyOf id other;

Get the elements from the other, and invoke [self initCopy].


id (self)
  initCopy;

Duplicate our contents since that is what we own.


id (self)
  initWith int n
        at pointer addr;

Initialize with the indicated pointer and integer for contents and length.


Any
  member All object;

Return the element contained in this Array, which is equal to the object.


Any
  memq All object;

Like member, but the element is identified on reference equality.


deferred (pointer, int) (address, number)
  pointerToElements (int, int) (start, len)
pre
  start >= 0 && len >= -1
post
  number >= 0 && !number == !address;

Return the address of the first element of the receiving array in the range (start, len), and the number of elements in that range.


void
  makeVanishingElementsPerform Invocation inv;

Like makeElementsPerform, but allow the element currently messaged to vanish from this array.