|
|
6.80 LargeArraySubpart
- Defined in namespace Smalltalk
- Category: Collections-Sequenceable
This class is an auxiliary class used to store information
about a LargeArrayedCollection's contents. LargeArrayedCollections
store their items non-contiguously in a separate storage object, and
use a SortedCollection to map between indices in the array and indices
in the storage object; instances of this class represent a block of
indices that is stored contiguously in the storage object.
6.80.1 LargeArraySubpart class: instance creation
- first: first last: last index: index
- Answer a LargeArraySubpart which answers first, last, and index when it is sent (respectively) #first, #last and #firstIndex.
6.80.2 LargeArraySubpart: accessing
- first
- Answer the index of the first item of the LargeArrayedCollection that the receiver refers to.
- first: firstIndex last: lastIndex index: storagePosition
- Set up the receiver so that it answers first, last, and index when it is sent (respectively) #first, #last and #firstIndex.
- firstIndex
- Answer the index in the collection's storage object of the first item of the LargeArrayedCollection that the receiver refers to.
- last
- Answer the index of the last item of the LargeArrayedCollection that the receiver refers to.
- lastIndex
- Answer the index in the collection's storage object of the last item of the LargeArrayedCollection that the receiver refers to.
6.80.3 LargeArraySubpart: comparing
- < anObject
- Answer whether the receiver points to a part of the array that is before anObject (this makes sense only if the receiver and anObject are two LargeArraySubparts referring to the same LargeArrayedCollection).
- <= anObject
- Answer whether the receiver points to a part of the array that is before anObject or starts at the same point (this makes sense only if the receiver and anObject are two LargeArraySubparts referring to the same LargeArrayedCollection).
- = anObject
- Answer whether the receiver and anObject are equal (assuming that the receiver and anObject are two LargeArraySubparts referring to the same LargeArrayedCollection, which the receiver cannot check for).
- hash
- Answer an hash value for the receiver
6.80.4 LargeArraySubpart: modifying
- cutAt: position
- Answer a new LargeArraySubpart whose lastIndex is position - 1, and apply a #removeFirst: to the receiver so that the firstIndex becomes position
- grow
- Add one to last and lastIndex
- growBy: numberOfElements
- Add numberOfElements to last and lastIndex
- relocateTo: position
- Move the firstIndex to position, and the lastIndex accordingly.
- removeFirst: n
- Sum n to first and firstIndex, but leave last/lastIndex untouched
- removeLast: n
- Subtract n from last and lastIndex, but leave first/firstIndex untouched
|