Skip to content

Commit

Permalink
Merge pull request #536 from ApptiveGrid/SmallInteratorCleanup
Browse files Browse the repository at this point in the history
another small cleanup of the Iterator
  • Loading branch information
noha authored Dec 7, 2023
2 parents 3f291cd + 90f9d11 commit f656f38
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
5 changes: 0 additions & 5 deletions src/Soil-Core/SoilBTreeIterator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ SoilBTreeIterator >> findPageFor: key [
^currentPage := index rootPage find: key with: index
]

{ #category : #accessing }
SoilBTreeIterator >> index [
^index
]

{ #category : #accessing }
SoilBTreeIterator >> lastPage [
| pageNumber |
Expand Down
14 changes: 13 additions & 1 deletion src/Soil-Core/SoilIndexIterator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ SoilIndexIterator >> firstAssociation [
^ item
]

{ #category : #accessing }
SoilIndexIterator >> index [
^index
]

{ #category : #accessing }
SoilIndexIterator >> index: anIndex [
index := anIndex
Expand Down Expand Up @@ -199,11 +204,18 @@ SoilIndexIterator >> nextPresentAssociation [
^ assoc
]

{ #category : #accessing }
{ #category : #private }
SoilIndexIterator >> pageAt: anInteger [
^ index store pageAt: anInteger
]

{ #category : #removing }
SoilIndexIterator >> removeKey: key [
^ self
at: key
put: (SoilObjectId segment: 0 index: 0)
]

{ #category : #accessing }
SoilIndexIterator >> size [
"We iterate over all elements to get the size. Slow!"
Expand Down
3 changes: 1 addition & 2 deletions src/Soil-Core/SoilIndexedDictionary.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ SoilIndexedDictionary >> at: key put: anObject [

| objectId iterator |
objectId := transaction makeRoot: anObject.
"binKey := (key asSkipListKeyOfSize: index keySize) asInteger."
iterator := self index newIterator.
(iterator at: key put: objectId) ifNotNil: [ :value |
oldValues
Expand Down Expand Up @@ -258,7 +257,7 @@ SoilIndexedDictionary >> removeKey: key ifAbsent: aBlock [
removedValues
at: key
put: v asSoilObjectId.
^ iterator at: key put: (SoilObjectId segment: 0 index: 0)
^ iterator removeKey: key
]

{ #category : #private }
Expand Down
11 changes: 2 additions & 9 deletions src/Soil-Core/SoilSkipListIterator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Class {
#category : #'Soil-Core-Index-SkipList'
}

{ #category : #accessing }
{ #category : #skiplist }
SoilSkipListIterator >> atLevel: key put: anObject [
levels at: key put: anObject
]
Expand Down Expand Up @@ -75,7 +75,7 @@ SoilSkipListIterator >> lastPage [
^ currentPage
]

{ #category : #accessing }
{ #category : #skiplist }
SoilSkipListIterator >> levelAt: anInteger [
^ levels at: anInteger
]
Expand All @@ -99,10 +99,3 @@ SoilSkipListIterator >> nextKeyCloseTo: key [
SoilSkipListIterator >> printOn: aStream [
aStream << 'path: ' << levels asString
]

{ #category : #removing }
SoilSkipListIterator >> removeKey: key [
^ self
at: key
put: (SoilObjectId segment: 0 index: 0)
]

0 comments on commit f656f38

Please sign in to comment.