Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

595-SoilIndexedDictionary-should-it-have-the-Association-methods #599

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 0 additions & 82 deletions src/Soil-Core-Tests/SoilIndexedDictionaryTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -265,40 +265,6 @@ SoilIndexedDictionaryTest >> testDoWithTransAction [

]

{ #category : #tests }
SoilIndexedDictionaryTest >> testFirstAssociationWithTransaction [
| tx tx2 |
tx := soil newTransaction.
tx root: dict.
dict at: #one put: #onevalue.
dict at: #two put: #twovalue.
tx commit.
"open a second transaction ..."
tx2 := soil newTransaction.
"and test last"
self assert: tx2 root firstAssociation value equals: #onevalue.

]

{ #category : #tests }
SoilIndexedDictionaryTest >> testFirstAssociationWithTransactionRemoved [
| tx tx1 tx2 |
tx := soil newTransaction.
tx root: dict.
dict at: #one put: #onevalue.
dict at: #two put: #twovalue.
tx commit.

"open a two transactions ..."
tx1 := soil newTransaction.
tx2 := soil newTransaction.
tx2 root removeKey: #one.
tx2 commit.
"in tx1 the removed one is not removed"
self assert: tx1 root firstAssociation value equals: #onevalue.

]

{ #category : #tests }
SoilIndexedDictionaryTest >> testFirstWithTransaction [
| tx tx2 |
Expand Down Expand Up @@ -419,40 +385,6 @@ SoilIndexedDictionaryTest >> testIsEmpty [
self deny: tx1 root isEmpty.
]

{ #category : #tests }
SoilIndexedDictionaryTest >> testLastAssociationWithTransaction [
| tx tx2 |
tx := soil newTransaction.
tx root: dict.
dict at: #two put: #twovalue.
dict at: #one put: #onevalue.

tx commit.
"open a second transaction ..."
tx2 := soil newTransaction.
"and test last, not: key order"
self assert: tx2 root lastAssociation value equals: #twovalue
]

{ #category : #tests }
SoilIndexedDictionaryTest >> testLastAssociationWithTransactionRemoved [
| tx tx1 tx2 |
tx := soil newTransaction.
tx root: dict.
dict at: #one put: #onevalue.
dict at: #two put: #twovalue.
tx commit.

"open a two transactions ..."
tx1 := soil newTransaction.
tx2 := soil newTransaction.
tx2 root removeKey: #two.
tx2 commit.
"in tx1 the removed one is not removed"
self assert: tx1 root lastAssociation value equals: #twovalue.

]

{ #category : #tests }
SoilIndexedDictionaryTest >> testLastWithTransaction [
| tx tx2 |
Expand Down Expand Up @@ -518,20 +450,6 @@ SoilIndexedDictionaryTest >> testNextAfterWithTransaction [
self assert: (tx2 root nextAfter: #one) value equals: #twovalue
]

{ #category : #tests }
SoilIndexedDictionaryTest >> testNextAssociationAfterWithTransaction [
| tx tx2 |
tx := soil newTransaction.
tx root: dict.
dict at: #one put: #onevalue.
dict at: #two put: #twovalue.
tx commit.
"open a second transaction ..."
tx2 := soil newTransaction.
"and test last"
self assert: (tx2 root nextAssociationAfter: #one) value equals: #twovalue
]

{ #category : #tests }
SoilIndexedDictionaryTest >> testNextKeyCloseToWithTransaction [
| tx tx2 |
Expand Down
5 changes: 5 additions & 0 deletions src/Soil-Core/SoilIndexIterator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@ SoilIndexIterator >> next: anInteger [
^ result
]

{ #category : #accessing }
SoilIndexIterator >> nextAfter: key [
^ (self nextAssociationAfter: key) value
]

{ #category : #accessing }
SoilIndexIterator >> nextAssociation [
"Note: key will be binary key"
Expand Down
26 changes: 1 addition & 25 deletions src/Soil-Core/SoilIndexedDictionary.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,6 @@ SoilIndexedDictionary >> first: anInteger [
self proxyFromByteArray: each ]
]

{ #category : #accessing }
SoilIndexedDictionary >> firstAssociation [
"Note: key will be binary key"
^ self newIterator firstAssociation ifNotNil: [ :assoc |
assoc key -> (transaction objectWithId: assoc value asSoilObjectId) ]
]

{ #category : #testing }
SoilIndexedDictionary >> hasIndexUpdates [
self isRegistered ifFalse: [ ^ true ].
Expand Down Expand Up @@ -146,14 +139,6 @@ SoilIndexedDictionary >> last [

]

{ #category : #accessing }
SoilIndexedDictionary >> lastAssociation [
"Note: key will be binary key"
^ self newIterator lastAssociation ifNotNil: [ :assoc |
assoc key -> (transaction objectWithId: assoc value asSoilObjectId) ]

]

{ #category : #private }
SoilIndexedDictionary >> loadFrom: aFileReference [
^ SoilSkipList new
Expand All @@ -177,16 +162,7 @@ SoilIndexedDictionary >> newIterator [

{ #category : #accessing }
SoilIndexedDictionary >> nextAfter: key [
^ (self nextAssociationAfter: key) value

]

{ #category : #accessing }
SoilIndexedDictionary >> nextAssociationAfter: key [
"Note: key will be binary key"
^ (self newIterator nextAssociationAfter: key)
ifNotNil: [ :assoc |
assoc key -> (transaction objectWithId: assoc value asSoilObjectId) ]
^ self proxyFromByteArray: (self newIterator nextAfter: key) value
]

{ #category : #private }
Expand Down
Loading