swarm.collections
Interface Offsets

All Known Subinterfaces:
ActionGroup, ActivationOrder, Array, Collection, CompoundAction, ConcurrentGroup, ConcurrentSchedule, KeyedCollection, List, Map, Permutation, Schedule

public interface Offsets

Methods for accessing collection members by position.. An offset is an integer value that gives relative position of a member in the enumeration sequence of a collection. Offsets start the count of the first member at zero, just like C array indexing. Offsets provide an alternate means to access the members of a collection, without creating a separate index object. Some collection subtypes (such as Array) support fast, direct access by integer member offset, while others support member offsets only as a shorthand for sequential access through every preceding member. Access by offsets is supported on all collections regardless of whether its speed on a particular collection type. atOffset: and atOffset:put: raise the error OffsetOutOfRange if the offset is greater than or equal to the count of members in the collection.


Method Summary
 java.lang.Object atOffset(int offset)
          Returns the member at a particular member offset.
 java.lang.Object atOffset$put(int offset, java.lang.Object anObject)
          The atOffset: put: message replaces the member at a particular offset with a new value, and returns the previous member value at this offset.
 java.lang.Object getFirst()
          Equivalent to [aCollection atOffset: 0].
 java.lang.Object getLast()
          Equivalent to [aCollection atOffset: [aCollection getCount] - 1].
 

Method Detail

atOffset

public java.lang.Object atOffset(int offset)
Returns the member at a particular member offset.

atOffset$put

public java.lang.Object atOffset$put(int offset,
                                     java.lang.Object anObject)
The atOffset: put: message replaces the member at a particular offset with a new value, and returns the previous member value at this offset.

getFirst

public java.lang.Object getFirst()
Equivalent to [aCollection atOffset: 0].

getLast

public java.lang.Object getLast()
Equivalent to [aCollection atOffset: [aCollection getCount] - 1].