Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## swarm.defobj
Interface Zone

All Known Subinterfaces:
  GUISwarm, Swarm, SwarmProcess

All Known Implementing Classes:
  ZoneImpl

public interface Zone
extends Create, CreateS, Drop, DropS

Modular unit of storage allocation.. A zone is a source of storage for objects or other allocated data. Whenever a new object is created, a zone must be identified from which the storage for its instance variables, or other internal data, is obtained. A program may establish multiple zones to ensure that objects with similar lifetime or storage needs are allocated together, and in general to optimize allocation and reuse of storage. Zones also maintain a collection of all objects allocated within the zone. This collection, referred to as the "population" of a zone, is a set of all objects which have been created but not yet dropped within the zone. Collections maintained automatically by zones can eliminate a need for other, separately maintained collections in applications that need to keep track of entire populations of objects. Collections of allocated objects can provide support for object query, external object storage, and automatic storage reclamation. A zone may be used to obtain storage not only for objects, but also for raw storage blocks like those provided by the C malloc function. All objects and storage blocks allocated in a zone remain local to that zone. This means that allocation of storage in other zones does not affect the efficiency of storage allocation within a particular zone. For most zone types, individual allocations may still be freed within a zone, and total storage of a zone may grow and shrink according to aggregate needs. In addition to freeing individual allocations, an entire zone may also dropped. Dropping a zone automatically frees all object allocations made within it, including final drop processing on any allocated objects that need it. Release of an entire zone can be much faster than individual release of each object within it. The Zone type is a fully implemented type that provides default storage management support for objects and other allocated storage. It is also a supertype for other zones that implement alternative policies for use in specialized situations. A zone is created using standard create messages just like other objects. This means that a zone must identify another zone from which it obtains its storage. Storage is typically obtained from this other zone in large units called pages, which are then managed by the local zone to support internal allocations. The getZone message of the DefinedObject type returns the zone which provides these base pages. Since a new zone always requires that an existing zone be identified, no new zones could be created unless there were some zones that already existed. Two such zones are predefined as part of the defobj library: globalZone and scratchZone.

Method Summary
`java.lang.Object` | `allocIVars(java.lang.Class aClass)` allocIVars: allocates the instance variable structure for a new object.
`java.lang.Object` | `allocIVarsComponent(java.lang.Class aClass)` These messages allocate, copy, and free This message allocates the storage that holds the instance variables for an object.
`java.lang.Object` | `copyIVars(java.lang.Object anObject)` copyIVars: creates copies an existing instance variable structure into a new allocation made within the local zone.
`java.lang.Object` | `copyIVarsComponent(java.lang.Object anObject)` Like allocateIVarsComponent, except it copies the storage that holds the instances variables for an object.
`void` | `describeForEach(java.lang.Object outputCharStream)` Generate debug description for each member of the zone population.
`void` | `describeForEachID(java.lang.Object outputCharStream)` Generate debug id description for each member of the zone population.
`void` | `freeIVars(java.lang.Object anObject)` freeIVars: releases storage that was previously allocated to hold the instance variable structure of an object.
`void` | `freeIVarsComponent(java.lang.Object anObject)` Frees the instance variable storage for an object.
`java.lang.Object` | `getComponentZone()` Returns a specially qualified version of the zone that automatically allocates all its objects with the internal component qualification, even if allocated with allocIVars: or copyIVars:.
`int` | `getPageSize()`
`List` | `getPopulation()` getPopulation returns a collection all objects allocated in a zone using either allocIVars: or copyIVars: and not yet freed using freeIVars:.

Methods inherited from interface swarm.defobj.Drop
`drop`

Methods inherited from 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 inherited from interface swarm.defobj.GetName
`getName`

Method Detail

### getPageSize

    public int getPageSize()

### allocIVars

    public java.lang.Object allocIVars(java.lang.Class aClass)

  allocIVars: allocates the instance variable structure for a new object. The initial word of this structure is set to class id passed as its argument. The class also determines the size of the structure allocated. All remaining contents of this structure are initialized to binary zeroes.

### copyIVars

    public java.lang.Object copyIVars(java.lang.Object anObject)

  copyIVars: creates copies an existing instance variable structure into a new allocation made within the local zone. The existing instance variable structure may be in any zone, but must contain a class pointer in its first word that correctly describes the size of the structure.

### freeIVars

    public void freeIVars(java.lang.Object anObject)

  freeIVars: releases storage that was previously allocated to hold the instance variable structure of an object. The first word of the object must be a class pointer that correctly describes the size of the structure. Storage allocated by allocIVars: or copyIVars: may be freed only by freeIVars:, and freeIVars: may be used only to free storage allocated by one of these messages.

### allocIVarsComponent

    public java.lang.Object allocIVarsComponent(java.lang.Class aClass)

  These messages allocate, copy, and free This message allocates the storage that holds the instance variables for an object. It allocates the object as an internal component of the zone that is not included in the zone population. It is used by classes that allocate additional objects as part of the implementation of another object, and that control the mapping of this storage separately from the zone level objects.

### copyIVarsComponent

    public java.lang.Object copyIVarsComponent(java.lang.Object anObject)

  Like allocateIVarsComponent, except it copies the storage that holds the instances variables for an object.

### freeIVarsComponent

    public void freeIVarsComponent(java.lang.Object anObject)

  Frees the instance variable storage for an object.

### getComponentZone

    public java.lang.Object getComponentZone()

  Returns a specially qualified version of the zone that automatically allocates all its objects with the internal component qualification, even if allocated with allocIVars: or copyIVars:. This qualified zone may be passed as an argument to a create: or createBegin: message so that it will create the new object as an internal component object.

### getPopulation

    public List getPopulation()

  getPopulation returns a collection all objects allocated in a zone using either allocIVars: or copyIVars: and not yet freed using freeIVars:. getObjects returns nil if the ObjectCollection option is false. The collection returned has the type OrderedSet as defined in the collections library, with the ReadOnly option set true and the IndexSafety option set to SafeAlways. The members of this collection may change as objects are allocated and freed, but may not added or removed directly within the collection.

### describeForEach

    public void describeForEach(java.lang.Object outputCharStream)

  Generate debug description for each member of the zone population.

### describeForEachID

    public void describeForEachID(java.lang.Object outputCharStream)

  Generate debug id description for each member of the zone population.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD