Skip to content

Commit

Permalink
Merge pull request #65 from moosetechnology/sequenceable-links
Browse files Browse the repository at this point in the history
FMMultivalueLink inherits from SequenceableCollection
  • Loading branch information
jecisc committed Dec 14, 2023
2 parents 47c17ac + 3370940 commit 48515e0
Showing 1 changed file with 11 additions and 53 deletions.
64 changes: 11 additions & 53 deletions src/Fame-Core/FMMultivalueLink.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ that refers to it are updated accordingly.
"
Class {
#name : #FMMultivalueLink,
#superclass : #Collection,
#superclass : #SequenceableCollection,
#instVars : [
'values',
'owner',
Expand All @@ -41,6 +41,12 @@ Class {
#category : #'Fame-Core-Utilities'
}

{ #category : #'instance creation' }
FMMultivalueLink class >> new: size [

^ self new setCollection: (OrderedCollection new: size)
]

{ #category : #'instance creation' }
FMMultivalueLink class >> on: element opposite: oppositeSelector [
^ self new
Expand Down Expand Up @@ -119,50 +125,16 @@ FMMultivalueLink >> do: aBlock [
values do: aBlock
]

{ #category : #'accessing-computed' }
FMMultivalueLink >> eighth [
^ self at: 8
]

{ #category : #'accessing-computed' }
FMMultivalueLink >> fifth [
^ self at: 5
]

{ #category : #'accessing-computed' }
FMMultivalueLink >> first [
^ self at: 1
]

{ #category : #'accessing-computed' }
FMMultivalueLink >> fourth [
^ self at: 4
]

{ #category : #comparing }
FMMultivalueLink >> hash [
"From sequenceable collection"
| hash |
hash := self species hash.
1 to: self size do: [ :i | hash := (hash + (self at: i) hash) hashMultiply ].
^ hash
]

{ #category : #iterators }
FMMultivalueLink >> iterator [
^ values iterator
]

{ #category : #'accessing-computed' }
{ #category : #accessing }
FMMultivalueLink >> last [
^ values last
]

{ #category : #'accessing-computed' }
FMMultivalueLink >> ninth [
^ self at: 9
]

{ #category : #copying }
FMMultivalueLink >> postCopy [

Expand Down Expand Up @@ -190,19 +162,10 @@ FMMultivalueLink >> removeAll [
do: [ :anElement | anElement perform: opposite with: nil ]
]

{ #category : #'accessing-computed' }
FMMultivalueLink >> second [
^ self at: 2
]

{ #category : #'accessing-computed' }
FMMultivalueLink >> seventh [
^ self at: 7
]
{ #category : #initialization }
FMMultivalueLink >> setCollection: aCollection [

{ #category : #'accessing-computed' }
FMMultivalueLink >> sixth [
^ self at: 6
values := aCollection
]

{ #category : #accessing }
Expand All @@ -217,11 +180,6 @@ FMMultivalueLink >> species [
^OrderedCollection
]

{ #category : #'accessing-computed' }
FMMultivalueLink >> third [
^ self at: 3
]

{ #category : #private }
FMMultivalueLink >> unsafeAdd: element [
(values includes: element)
Expand Down

0 comments on commit 48515e0

Please sign in to comment.