Back: Array-testing Up: Base classes Forward: ArrayedCollection class-instance creation   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.5 ArrayedCollection

Defined in namespace Smalltalk
Superclass: SequenceableCollection
Category: Collections-Sequenceable
My instances are objects that are generally fixed size, and are accessed by an integer index. The ordering of my instance's elements is determined externally; I will not rearrange the order of the elements.

1.5.1 ArrayedCollection class: instance creation  (class)
1.5.2 ArrayedCollection: basic  (instance)
1.5.3 ArrayedCollection: built ins  (instance)
1.5.4 ArrayedCollection: copying Collections  (instance)
1.5.5 ArrayedCollection: enumerating the elements of a collection  (instance)
1.5.6 ArrayedCollection: storing  (instance)
1.5.7 ArrayedCollection: streams  (instance)


1.5.1 ArrayedCollection class: instance creation

join: aCollection
Where aCollection is a collection of SequenceableCollections, answer a new instance with all the elements therein, in order.

join: aCollection separatedBy: sepCollection
Where aCollection is a collection of SequenceableCollections, answer a new instance with all the elements therein, in order, each separated by an occurrence of sepCollection.

new: size withAll: anObject
Answer a collection with the given size, whose elements are all set to anObject

streamContents: aBlock
Create a ReadWriteStream on an empty instance of the receiver; pass the stream to aBlock, then retrieve its contents and answer them.

with: element1
Answer a collection whose only element is element1

with: element1 with: element2
Answer a collection whose only elements are the parameters in the order they were passed

with: element1 with: element2 with: element3
Answer a collection whose only elements are the parameters in the order they were passed

with: element1 with: element2 with: element3 with: element4
Answer a collection whose only elements are the parameters in the order they were passed

with: element1 with: element2 with: element3 with: element4 with: element5
Answer a collection whose only elements are the parameters in the order they were passed

withAll: aCollection
Answer a collection whose elements are the same as those in aCollection


1.5.2 ArrayedCollection: basic

, aSequenceableCollection
Answer a new instance of an ArrayedCollection containing all the elements in the receiver, followed by all the elements in aSequenceableCollection

add: value
This method should not be called for instances of this class.

atAll: keyCollection
Answer a collection of the same kind returned by #collect:, that only includes the values at the given indices. Fail if any of the values in keyCollection is out of bounds for the receiver.

copyFrom: start to: stop
Answer a new collection containing all the items in the receiver from the start-th and to the stop-th

copyWith: anElement
Answer a new instance of an ArrayedCollection containing all the elements in the receiver, followed by the single item anElement

copyWithout: oldElement
Answer a copy of the receiver to which all occurrences of oldElement are removed


1.5.3 ArrayedCollection: built ins

size
Answer the size of the receiver


1.5.4 ArrayedCollection: copying Collections

copyReplaceAll: oldSubCollection with: newSubCollection
Answer a new collection in which all the sequences matching oldSubCollection are replaced with newSubCollection

copyReplaceFrom: start to: stop with: replacementCollection
Answer a new collection of the same class as the receiver that contains the same elements as the receiver, in the same order, except for elements from index `start' to index `stop'.

If start < stop, these are replaced by the contents of the replacementCollection. Instead, If start = (stop + 1), like in `copyReplaceFrom: 4 to: 3 with: anArray', then every element of the receiver will be present in the answered copy; the operation will be an append if stop is equal to the size of the receiver or, if it is not, an insert before index `start'.

copyReplaceFrom: start to: stop withObject: anObject
Answer a new collection of the same class as the receiver that contains the same elements as the receiver, in the same order, except for elements from index `start' to index `stop'.

If start < stop, these are replaced by stop-start+1 copies of anObject. Instead, If start = (stop + 1), then every element of the receiver will be present in the answered copy; the operation will be an append if stop is equal to the size of the receiver or, if it is not, an insert before index `start'.

reverse
Answer the receivers' contents in reverse order


1.5.5 ArrayedCollection: enumerating the elements of a collection

collect: aBlock
Answer a new instance of an ArrayedCollection containing all the results of evaluating aBlock passing each of the receiver's elements

reject: aBlock
Answer a new instance of an ArrayedCollection containing all the elements in the receiver which, when passed to aBlock, answer false

select: aBlock
Answer a new instance of an ArrayedCollection containing all the elements in the receiver which, when passed to aBlock, answer true

with: aSequenceableCollection collect: aBlock
Evaluate aBlock for each pair of elements took respectively from the re- ceiver and from aSequenceableCollection; answer a collection of the same kind of the receiver, made with the block's return values. Fail if the receiver has not the same size as aSequenceableCollection.


1.5.6 ArrayedCollection: storing

storeOn: aStream
Store Smalltalk code compiling to the receiver on aStream


1.5.7 ArrayedCollection: streams

writeStream
Answer a WriteStream streaming on the receiver



Back: ArrayedCollection-storing Up: ArrayedCollection Forward: Association   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on July, 23 2009 using texi2html