--- a/BTree.st Fri Jul 29 12:55:50 2011 +0200
+++ b/BTree.st Tue Aug 02 09:36:21 2011 +0200
@@ -232,48 +232,73 @@
"
! !
+!BTree::BTreeKeys methodsFor:'accessing'!
+
+first
+ ^ self at:1
+
+ "Modified (format): / 02-08-2011 / 09:19:05 / cg"
+! !
+
!BTree::BTreeKeys methodsFor:'as yet unclassified'!
+emptyCopy
+ ^ self class new:self size
+
+ "Modified (format): / 02-08-2011 / 09:19:22 / cg"
+!
+
+findIndexForKey:aMagnitude
+ self
+ withIndexDo:[:key :i |
+ (key isNil or:[ key > aMagnitude ]) ifTrue:[
+ ^ i - 1
+ ]
+ ].
+ ^ self size
+
+ "Modified (format): / 02-08-2011 / 09:19:10 / cg"
+!
+
+shiftLeftTo:index
+ index to:self size - 1 by:1 do:[:i |
+ self at:i put:(self at:i + 1)
+ ].
+ self at:self size put:nil.
+
+ "Modified (format): / 02-08-2011 / 09:18:52 / cg"
+!
+
+shiftRightFrom:index
+ self size to:index + 1 by:-1 do:[:i |
+ self at:i put:(self at:i - 1)
+ ]
+
+ "Modified (format): / 02-08-2011 / 09:18:57 / cg"
+! !
+
+!BTree::BTreeKeys methodsFor:'enumeration'!
+
+withIndexDo:aBlock
+ 1 to:self size do:[:i |
+ aBlock value:(self at:i) value:i
+ ]
+
+ "Modified (format): / 02-08-2011 / 09:19:01 / cg"
+! !
+
+!BTree::BTreeKeys methodsFor:'queries'!
+
canGrow
- ^ (self at: self size) isNil
+ ^ (self at:self size) isNil
+
+ "Modified (format): / 02-08-2011 / 09:19:27 / cg"
!
canShrink
- ^ (self at: self size // 2 + 1) notNil
-!
-
-emptyCopy
- ^ self class new: self size
-!
-
-findIndexForKey: aMagnitude
- self withIndexDo:
- [:key :i |
- (key isNil or: [key > aMagnitude]) ifTrue:
- [^ i - 1]].
- ^ self size
-!
+ ^ (self at:self size // 2 + 1) notNil
-first
- ^ self at: 1
-!
-
-shiftLeftTo: index
- index to: self size - 1 by: 1 do:
- [:i |
- self at: i put: (self at: i+1)].
- self at: self size put: nil.
-!
-
-shiftRightFrom: index
- self size to: index+1 by: -1 do:
- [:i |
- self at: i put: (self at: i - 1)]
-
-!
-
-withIndexDo: aBlock
- 1 to: self size do: [:i | aBlock value: (self at: i) value: i]
+ "Modified (format): / 02-08-2011 / 09:19:23 / cg"
! !
!BTree::BTreeKeysArray class methodsFor:'documentation'!
@@ -366,9 +391,12 @@
!
keysDo: aBlock
- keys withIndexDo:
- [:key :i |
- key ifNotNil: [aBlock value: key] ifNil: [^ self]]
+ keys withIndexDo:[:key :i |
+ key isNil ifTrue:[^ self].
+ aBlock value: key
+ ]
+
+ "Modified: / 02-08-2011 / 09:17:49 / cg"
!
leavesFrom: start to: end do: aBlock
@@ -837,5 +865,5 @@
!BTree class methodsFor:'documentation'!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic2/BTree.st,v 1.8 2010-08-24 08:28:45 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/BTree.st,v 1.9 2011-08-02 07:36:21 cg Exp $'
! !