5 SequenceableCollection method!
9 collection := self species new: (self size + aCollection size).
11 collection replaceFrom: 1
16 collection replaceFrom: self size + 1
26 SequenceableCollection method!
30 self size = aCollection size
35 element = (aCollection at: i) ifFalse: [ ^ false ].
40 SequenceableCollection method!
44 hash := 11111111111111111.
47 hash := hash bitXor: ((hash bitShift: 5) + element hash + (hash bitShift: -2))].
53 SequenceableCollection method!
55 self subclassResponsibility!
57 SequenceableCollection method!
58 replaceFrom: start to: stop with: replacement startingAt: repStart
59 "This destructively replaces elements from start to stop in the receiver
60 starting at index, repStart, in the sequenceable collection,
61 replacementCollection. Answer the receiver. No range checks are
65 repOff := repStart - start.
67 [(index := index + 1) <= stop]
68 whileTrue: [self at: index put: (replacement at: repOff + index)]!
71 SequenceableCollection method!
75 SequenceableCollection method!
79 SequenceableCollection method!
83 SequenceableCollection method!
90 SequenceableCollection method!
91 remove: anObject ifAbsent: anExceptionBlock
92 self shouldNotImplement!
97 SequenceableCollection method!
102 [(index := index + 1) <= length]
103 whileTrue: [ aBlock value: (self at: index) ].!
105 SequenceableCollection method!
107 | aStream index length |
108 aStream := WriteStream on: (self species new: self size).
111 [(index := index + 1) <= length]
112 whileTrue: [aStream nextPut: (aBlock value: (self at: index))].
115 SequenceableCollection method!
117 | aStream index length |
118 aStream := WriteStream on: (self species new: self size).
121 [(index := index + 1) <= length]
122 whileTrue: [(aBlock value: (self at: index))
123 ifTrue: [aStream nextPut: (self at: index)]].
129 SequenceableCollection method!
130 copyFrom: start to: stop
131 "Answer a copy of a subset of the receiver, starting from element at
132 index start until element at index stop."
135 newSize := stop - start + 1.
136 ^ (self species new: newSize)
144 SequenceableCollection method!
146 "Answer a copy of the receiver with element order reversed."
147 "Example: 'frog' reversed"
151 result := self species new: n.
153 1 to: n do: [:i | result at: i put: (self at: (src := src - 1))].