Skip to content

Commit f4794eb

Browse files
authored
Merge pull request #742 from moosetechnology/722-MooseGroup-and-Collection-API-tries-to-be-too-clever
Fix #722
2 parents 08b6c3b + 7820f30 commit f4794eb

File tree

1 file changed

+87
-6
lines changed

1 file changed

+87
-6
lines changed

src/Moose-Core/MooseAbstractGroup.class.st

+87-6
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,12 @@ MooseAbstractGroup >> at: anIndex [
205205
^ self entities at: anIndex
206206
]
207207

208+
{ #category : #accessing }
209+
MooseAbstractGroup >> at: anIndex ifAbsent: aBlock [
210+
211+
^ self entities at: anIndex ifAbsent: aBlock
212+
]
213+
208214
{ #category : #'public interface' }
209215
MooseAbstractGroup >> average: aSymbolOrBlock [
210216

@@ -236,6 +242,12 @@ MooseAbstractGroup >> collect: collectBlock thenReject: selectBlock [
236242
^ (self collect: collectBlock) reject: selectBlock
237243
]
238244

245+
{ #category : #enumerating }
246+
MooseAbstractGroup >> collect: aBlockCollect thenSelect: aBlockThenSelect [
247+
248+
^ self entities collect: aBlockCollect thenSelect: aBlockThenSelect
249+
]
250+
239251
{ #category : #enumerating }
240252
MooseAbstractGroup >> collectAsSet: aBlock [
241253
^ self entities collectAsSet: aBlock
@@ -262,6 +274,12 @@ MooseAbstractGroup >> copyWithout: anEntity [
262274
^ self entities copyWithout: anEntity
263275
]
264276

277+
{ #category : #copying }
278+
MooseAbstractGroup >> copyWithoutAll: mooseEntities [
279+
280+
^ self entities copyWithoutAll: mooseEntities
281+
]
282+
265283
{ #category : #enumerating }
266284
MooseAbstractGroup >> count: aBlock [
267285

@@ -283,6 +301,12 @@ MooseAbstractGroup >> detect: aBlock ifNone: anotherBlock [
283301
^self entities detect: aBlock ifNone: anotherBlock
284302
]
285303

304+
{ #category : #enumerating }
305+
MooseAbstractGroup >> detectMax: aString [
306+
307+
^ self entities detectMax: aString
308+
]
309+
286310
{ #category : #'entity collection' }
287311
MooseAbstractGroup >> difference: aCollection [
288312
^ self species withAll: (self entities difference: aCollection)
@@ -309,13 +333,10 @@ MooseAbstractGroup >> doWithIndex: aBlockClosure [
309333
self entities doWithIndex: aBlockClosure
310334
]
311335

312-
{ #category : #'reflective operations' }
313-
MooseAbstractGroup >> doesNotUnderstand: aMessage [
314-
"Forward message to collection"
336+
{ #category : #accessing }
337+
MooseAbstractGroup >> eighth [
315338

316-
^ [ aMessage sendTo: self entities ]
317-
on: MessageNotUnderstood
318-
do: [ super doesNotUnderstand: aMessage ]
339+
^ self entities eighth
319340
]
320341

321342
{ #category : #'entity collection' }
@@ -381,6 +402,12 @@ MooseAbstractGroup >> equalsTo: aCollection [
381402
^ self entities equalsTo: aCollection
382403
]
383404

405+
{ #category : #accessing }
406+
MooseAbstractGroup >> fifth [
407+
408+
^ self entities fifth
409+
]
410+
384411
{ #category : #accessing }
385412
MooseAbstractGroup >> first [
386413

@@ -411,6 +438,18 @@ MooseAbstractGroup >> flatten [
411438
^self gather: [ :each | each ]
412439
]
413440

441+
{ #category : #enumerating }
442+
MooseAbstractGroup >> fold: aBlock [
443+
444+
^ self entities fold: aBlock
445+
]
446+
447+
{ #category : #accessing }
448+
MooseAbstractGroup >> fourth [
449+
450+
^ self entities fourth
451+
]
452+
414453
{ #category : #enumerating }
415454
MooseAbstractGroup >> gather: aBlock [
416455
"This method is kept for compatibility reasons, use flatCollect instead."
@@ -452,6 +491,12 @@ MooseAbstractGroup >> ifNotEmpty: aBlock [
452491
^ self ifEmpty: [ self ] ifNotEmpty: [ aBlock cull: self ]
453492
]
454493

494+
{ #category : #testing }
495+
MooseAbstractGroup >> ifNotEmpty: aBlockIfNotEmpty ifEmpty: aBlockIfEmpty [
496+
497+
^ self entities ifEmpty: aBlockIfEmpty ifNotEmpty: aBlockIfNotEmpty
498+
]
499+
455500
{ #category : #testing }
456501
MooseAbstractGroup >> includes: anEntity [
457502

@@ -474,6 +519,12 @@ MooseAbstractGroup >> includesID: elementID [
474519
^self entityStorage includesID: elementID
475520
]
476521

522+
{ #category : #accessing }
523+
MooseAbstractGroup >> indexOf: aMooseEntity [
524+
525+
^ self entities indexOf: aMooseEntity
526+
]
527+
477528
{ #category : #initialization }
478529
MooseAbstractGroup >> initialize [
479530

@@ -555,6 +606,12 @@ MooseAbstractGroup >> mooseModel [
555606
^ self ifEmpty: [ nil ] ifNotEmpty: [ self anyOne mooseModel ]
556607
]
557608

609+
{ #category : #accessing }
610+
MooseAbstractGroup >> ninth [
611+
612+
^ self entities ninth
613+
]
614+
558615
{ #category : #testing }
559616
MooseAbstractGroup >> notEmpty [
560617
^ self entities isNotEmpty
@@ -660,6 +717,12 @@ MooseAbstractGroup >> select: aBlock [
660717
^self entities select: aBlock
661718
]
662719

720+
{ #category : #enumerating }
721+
MooseAbstractGroup >> select: aBlockSelect thenDo: aBlockThenDo [
722+
723+
^ self entities select: aBlockSelect thenDo: aBlockThenDo
724+
]
725+
663726
{ #category : #enumerating }
664727
MooseAbstractGroup >> selectFirst: anInteger [
665728

@@ -674,11 +737,29 @@ MooseAbstractGroup >> selectWithNameSimilarTo: anEntity [
674737
(each name pairsSimilarityWith: anEntity name) > 0.5]]
675738
]
676739

740+
{ #category : #accessing }
741+
MooseAbstractGroup >> seventh [
742+
743+
^ self entities seventh
744+
]
745+
746+
{ #category : #accessing }
747+
MooseAbstractGroup >> sixth [
748+
749+
^ self entities sixth
750+
]
751+
677752
{ #category : #accessing }
678753
MooseAbstractGroup >> size [
679754
^ self entityStorage size
680755
]
681756

757+
{ #category : #sorting }
758+
MooseAbstractGroup >> sorted [
759+
760+
^ self entities sorted
761+
]
762+
682763
{ #category : #arithmetic }
683764
MooseAbstractGroup >> sumNumbers: aBlockClosure [
684765
^ self entities sumNumbers: aBlockClosure

0 commit comments

Comments
 (0)