Skip to content

Commit

Permalink
Merge pull request #742 from moosetechnology/722-MooseGroup-and-Colle…
Browse files Browse the repository at this point in the history
…ction-API-tries-to-be-too-clever

Fix #722
  • Loading branch information
uNouss authored Mar 29, 2024
2 parents 08b6c3b + 7820f30 commit f4794eb
Showing 1 changed file with 87 additions and 6 deletions.
93 changes: 87 additions & 6 deletions src/Moose-Core/MooseAbstractGroup.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ MooseAbstractGroup >> at: anIndex [
^ self entities at: anIndex
]

{ #category : #accessing }
MooseAbstractGroup >> at: anIndex ifAbsent: aBlock [

^ self entities at: anIndex ifAbsent: aBlock
]

{ #category : #'public interface' }
MooseAbstractGroup >> average: aSymbolOrBlock [

Expand Down Expand Up @@ -236,6 +242,12 @@ MooseAbstractGroup >> collect: collectBlock thenReject: selectBlock [
^ (self collect: collectBlock) reject: selectBlock
]

{ #category : #enumerating }
MooseAbstractGroup >> collect: aBlockCollect thenSelect: aBlockThenSelect [

^ self entities collect: aBlockCollect thenSelect: aBlockThenSelect
]

{ #category : #enumerating }
MooseAbstractGroup >> collectAsSet: aBlock [
^ self entities collectAsSet: aBlock
Expand All @@ -262,6 +274,12 @@ MooseAbstractGroup >> copyWithout: anEntity [
^ self entities copyWithout: anEntity
]

{ #category : #copying }
MooseAbstractGroup >> copyWithoutAll: mooseEntities [

^ self entities copyWithoutAll: mooseEntities
]

{ #category : #enumerating }
MooseAbstractGroup >> count: aBlock [

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

{ #category : #enumerating }
MooseAbstractGroup >> detectMax: aString [

^ self entities detectMax: aString
]

{ #category : #'entity collection' }
MooseAbstractGroup >> difference: aCollection [
^ self species withAll: (self entities difference: aCollection)
Expand All @@ -309,13 +333,10 @@ MooseAbstractGroup >> doWithIndex: aBlockClosure [
self entities doWithIndex: aBlockClosure
]

{ #category : #'reflective operations' }
MooseAbstractGroup >> doesNotUnderstand: aMessage [
"Forward message to collection"
{ #category : #accessing }
MooseAbstractGroup >> eighth [

^ [ aMessage sendTo: self entities ]
on: MessageNotUnderstood
do: [ super doesNotUnderstand: aMessage ]
^ self entities eighth
]

{ #category : #'entity collection' }
Expand Down Expand Up @@ -381,6 +402,12 @@ MooseAbstractGroup >> equalsTo: aCollection [
^ self entities equalsTo: aCollection
]

{ #category : #accessing }
MooseAbstractGroup >> fifth [

^ self entities fifth
]

{ #category : #accessing }
MooseAbstractGroup >> first [

Expand Down Expand Up @@ -411,6 +438,18 @@ MooseAbstractGroup >> flatten [
^self gather: [ :each | each ]
]

{ #category : #enumerating }
MooseAbstractGroup >> fold: aBlock [

^ self entities fold: aBlock
]

{ #category : #accessing }
MooseAbstractGroup >> fourth [

^ self entities fourth
]

{ #category : #enumerating }
MooseAbstractGroup >> gather: aBlock [
"This method is kept for compatibility reasons, use flatCollect instead."
Expand Down Expand Up @@ -452,6 +491,12 @@ MooseAbstractGroup >> ifNotEmpty: aBlock [
^ self ifEmpty: [ self ] ifNotEmpty: [ aBlock cull: self ]
]

{ #category : #testing }
MooseAbstractGroup >> ifNotEmpty: aBlockIfNotEmpty ifEmpty: aBlockIfEmpty [

^ self entities ifEmpty: aBlockIfEmpty ifNotEmpty: aBlockIfNotEmpty
]

{ #category : #testing }
MooseAbstractGroup >> includes: anEntity [

Expand All @@ -474,6 +519,12 @@ MooseAbstractGroup >> includesID: elementID [
^self entityStorage includesID: elementID
]

{ #category : #accessing }
MooseAbstractGroup >> indexOf: aMooseEntity [

^ self entities indexOf: aMooseEntity
]

{ #category : #initialization }
MooseAbstractGroup >> initialize [

Expand Down Expand Up @@ -555,6 +606,12 @@ MooseAbstractGroup >> mooseModel [
^ self ifEmpty: [ nil ] ifNotEmpty: [ self anyOne mooseModel ]
]

{ #category : #accessing }
MooseAbstractGroup >> ninth [

^ self entities ninth
]

{ #category : #testing }
MooseAbstractGroup >> notEmpty [
^ self entities isNotEmpty
Expand Down Expand Up @@ -660,6 +717,12 @@ MooseAbstractGroup >> select: aBlock [
^self entities select: aBlock
]

{ #category : #enumerating }
MooseAbstractGroup >> select: aBlockSelect thenDo: aBlockThenDo [

^ self entities select: aBlockSelect thenDo: aBlockThenDo
]

{ #category : #enumerating }
MooseAbstractGroup >> selectFirst: anInteger [

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

{ #category : #accessing }
MooseAbstractGroup >> seventh [

^ self entities seventh
]

{ #category : #accessing }
MooseAbstractGroup >> sixth [

^ self entities sixth
]

{ #category : #accessing }
MooseAbstractGroup >> size [
^ self entityStorage size
]

{ #category : #sorting }
MooseAbstractGroup >> sorted [

^ self entities sorted
]

{ #category : #arithmetic }
MooseAbstractGroup >> sumNumbers: aBlockClosure [
^ self entities sumNumbers: aBlockClosure
Expand Down

0 comments on commit f4794eb

Please sign in to comment.