swarm.collections
Class ArrayImpl

java.lang.Object
  |
  +--swarm.BaseImpl
        |
        +--swarm.collections.ArrayImpl

public class ArrayImpl
extends BaseImpl
implements Collection, CollectionS, DefaultMember, DefaultMemberS, MemberBlock, MemberBlockS, Serialization, SerializationS, ArrayS, Array

Collection supporting access only by relative position.. An array is a collection of members that are all created as members of the collection at the same time. Existing member values may be replaced with new values, but the members themselves are fixed at constant offsets within the collection. The fixed structure of an array permits very fast access to members by integer offset positions, since the location of each member may be directly calculated. The Array type is one of the simplest collection types in the collections library, and the closest to a data structure directly supported in C. Unlike C arrays, the group of members belonging to the array is not necessarily fixed for the lifetime of the array, but may be dynamically resized to contain a different number of members. When an array is dynamically resized, existing member values are preserved as much as possible. The Array type adds few messages to the generic messages inherited from Collection. This type is provided partly so that a fixed-structure array can be accessed with the same uniform set of basic messages as any other kind of object collection. It also handles all required memory allocation within the collection. As an option, however, the Array type can be used to wrap an existing C array for external access as an object collection. It can also provide access to an internal C array for direct manipulation using C expressions. These forms of low-level access support hybrid modes of use in which advantages of both low-level manipulation and external object access can be combined. The Array type is directly creatable, and supports all standard messages of Collection except removal of individual members. The messages based on an integer offset, either on the collection (atOffset:, atOffset:put:), or an index (setOffset:) all execute in fast constant time. Members of an array are fully ordered according to these integer offsets. Sequential access to members through its members is also fully supported. The Array type disables the remove message inherited from Collection; the message is defined, but any attempt to remove a member will raise an error that the operation is not supported. The default value of the ReplaceOnly option is true, and cannot be overridden. The type of index returned by begin: on an array is simply Index. There is no special index type for Array because there are no additional messages beyond those already defined by Index. All the Array create-time options can also be set after the array is already created, subject to restrictions noted below.


Constructor Summary
ArrayImpl()
           
ArrayImpl(Zone aZone)
          The create: message creates a new instance of a type with default options.
ArrayImpl(Zone aZone, int count)
           
 
Methods implemented by this class for interface swarm.collections.Collection
allSameClass, begin, beginPermuted, contains, copy, deleteAll, getCount, getReplaceOnly, remove, removeAll
 
Methods implemented by this class for interface swarm.collections.DefaultMember
getDefaultMember
 
Methods implemented by this class for interface swarm.collections.DefaultMemberS
setDefaultMember
 
Methods implemented by this class for interface swarm.defobj.Serialization
hdf5OutDeep, hdf5OutShallow, lispOutDeep, lispOutShallow, lispOutVars$deep, lispSaveStream$Boolean$Value, lispSaveStream$Char$Value, lispSaveStream$Double$Value, lispSaveStream$Float$Value, lispSaveStream$Integer$Value, lispSaveStream$Long$Value, lispSaveStream$LongLong$Value, lispSaveStream$Short$Value, lispSaveStream$Unsigned$Value, lispSaveStream$UnsignedLong$Value, lispSaveStream$UnsignedLongLong$Value, lispSaveStream$UnsignedShort$Value, updateArchiver
 
Methods implemented by this class for interface swarm.defobj.SerializationS
hdf5In, lispIn
 
Methods implemented by this class for interface swarm.collections.ArrayS
setCount
 
Methods implemented by this class for interface swarm.defobj.Copy
copy
 
Methods implemented by this class for interface swarm.defobj.Drop
drop
 
Methods implemented by this class for interface swarm.collections.Offsets
atOffset, atOffset$put, getFirst, getLast
 
Methods implemented by this class for interface swarm.collections.ForEach
describeForEach, describeForEachID, forEach, forEach, forEach, forEach
 
Methods implemented by this class for interface swarm.defobj.DefinedObject
compare, describe, describeID, getDisplayName, getTypeName, getZone, perform, perform$with, perform$with$with, perform$with$with$with, respondsTo, setDisplayName, xfprint, xfprintid, xprint, xprintid
 
Methods implemented by this class for interface swarm.defobj.GetName
getName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayImpl

public ArrayImpl()

ArrayImpl

public ArrayImpl(Zone aZone,
                 int count)

ArrayImpl

public ArrayImpl(Zone aZone)
The create: message creates a new instance of a type with default options. The zone argument specifies the source of storage for the new object. The receiving object of this message is a previously defined type object. The message is declared as a class message (with a + declaration tag) to indicate that the message is accepted only by the type object itself rather than an already created instance of the type (which a - declaration tag otherwise defines). The create: message returns the new object just created. This object is an instance of some class selected to implement the type. The class which a type selects to implement an object may be obtained by the getClass message, but is not otherwise visible to the calling program. A caller never refers to any class name when creating objects using these messages, only to type names, which are automatically published as global constants from any @protocol declaration.