--- a/DirectoryContents.st Tue Aug 22 00:45:09 2000 +0200
+++ b/DirectoryContents.st Tue Aug 22 15:49:22 2000 +0200
@@ -12,6 +12,8 @@
+"{ Package: 'stx:libbasic2' }"
+
Object subclass:#DirectoryContents
instanceVariableNames:'directory timeStamp names files types'
classVariableNames:'List'
@@ -347,12 +349,6 @@
!DirectoryContents methodsFor:'queries'!
-isEmpty
- "retuirns true if directory is empty
- "
- ^ names size == 0
-!
-
isObsolete
"returns true if directory contents is obsolete
"
@@ -361,6 +357,14 @@
)
"Modified: / 17.8.1998 / 10:05:23 / cg"
+! !
+
+!DirectoryContents methodsFor:'testing'!
+
+isEmpty
+ "retuirns true if directory is empty
+ "
+ ^ names size == 0
!
notEmpty
@@ -372,5 +376,5 @@
!DirectoryContents class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/DirectoryContents.st,v 1.9 2000-02-11 13:15:06 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/DirectoryContents.st,v 1.10 2000-08-22 13:47:38 cg Exp $'
! !
--- a/MappedCollection.st Tue Aug 22 00:45:09 2000 +0200
+++ b/MappedCollection.st Tue Aug 22 15:49:22 2000 +0200
@@ -10,6 +10,8 @@
hereby transferred.
"
+"{ Package: 'stx:libbasic2' }"
+
Collection subclass:#MappedCollection
instanceVariableNames:'domain map'
classVariableNames:''
@@ -17,7 +19,7 @@
category:'Collections-Sequenceable'
!
-!MappedCollection class methodsFor:'documentation'!
+!MappedCollection class methodsFor:'documentation'!
copyright
"
@@ -46,7 +48,7 @@
"
! !
-!MappedCollection class methodsFor:'instance creation'!
+!MappedCollection class methodsFor:'instance creation'!
collection:domainCollection map:mapCollection
"return a new MappedCollection"
@@ -62,14 +64,6 @@
!MappedCollection methodsFor:'accessing'!
-add:anObject
- "report an error; mappedCollections cannot add elements (without a key)"
-
- self shouldNotImplement
-
- "Modified: 2.8.1996 / 21:03:57 / cg"
-!
-
at:key
"retrieve an element"
@@ -97,6 +91,16 @@
"Modified: 2.8.1996 / 21:04:10 / cg"
! !
+!MappedCollection methodsFor:'adding & removing'!
+
+add:anObject
+ "report an error; mappedCollections cannot add elements (without a key)"
+
+ self shouldNotImplement
+
+ "Modified: 2.8.1996 / 21:03:57 / cg"
+! !
+
!MappedCollection methodsFor:'copying'!
postCopy
@@ -157,8 +161,8 @@
^ map size
! !
-!MappedCollection class methodsFor:'documentation'!
+!MappedCollection class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/MappedCollection.st,v 1.16 1996-08-02 19:04:21 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/MappedCollection.st,v 1.17 2000-08-22 13:48:33 cg Exp $'
! !
--- a/Queue.st Tue Aug 22 00:45:09 2000 +0200
+++ b/Queue.st Tue Aug 22 15:49:22 2000 +0200
@@ -249,8 +249,7 @@
!Queue methodsFor:'accessing-protocol compatibility'!
addLast:someObject
- "same as #nextPut: - for protocol compatibility with
- other collections"
+ "same as #nextPut: - for protocol compatibility with other collections"
self nextPut:someObject.
^ someObject
@@ -259,8 +258,7 @@
!
removeFirst
- "same as #next - for protocol compatibility with
- other collections"
+ "same as #next - for protocol compatibility with other collections"
^ self next
@@ -306,6 +304,14 @@
^ contentsArray size
!
+size
+ "return the number of elements in the queue"
+
+ ^ tally
+! !
+
+!Queue methodsFor:'testing'!
+
isEmpty
"return true, if there are no elements in the queue"
@@ -317,16 +323,10 @@
possible"
^ tally == contentsArray size
-!
-
-size
- "return the number of elements in the queue"
-
- ^ tally
! !
!Queue class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/Queue.st,v 1.25 2000-08-21 22:45:09 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/Queue.st,v 1.26 2000-08-22 13:49:13 cg Exp $'
! !
--- a/RunArray.st Tue Aug 22 00:45:09 2000 +0200
+++ b/RunArray.st Tue Aug 22 15:49:22 2000 +0200
@@ -567,7 +567,7 @@
"Modified: 11.5.1996 / 13:34:27 / cg"
! !
-!RunArray methodsFor:'adding'!
+!RunArray methodsFor:'adding & removing'!
add:newObject
"add newObject at the end; returns the object (sigh)"
@@ -619,69 +619,6 @@
"
"Modified: 11.5.1996 / 13:34:37 / cg"
-!
-
-grow:howBig
- "grow or shrink the receiver to contain howBig elements.
- If growing, new slots will be filled (logically) with nil."
-
- |sz info runIndex runOffset runSz newRuns|
-
- sz := self size.
-
- howBig == sz ifTrue:[^ self].
-
- howBig == 0 ifTrue:[
- contentsArray := nil.
- ^ self.
- ].
-
- contentsArray isNil ifTrue:[
- contentsArray := Array with:howBig with:nil.
- ^ self
- ].
-
- runSz := contentsArray size.
-
- howBig > sz ifTrue:[
- newRuns := Array new:(runSz + 2).
- newRuns replaceFrom:1 to:runSz with:contentsArray startingAt:1.
- newRuns at:(runSz+1) put:(howBig - sz).
- contentsArray := newRuns.
- ^ self
- ].
-
- "/ shrinking; possibly cut of a run
-
- info := self runIndexAndStartIndexForIndex:howBig.
- runIndex := info at:1.
- runOffset := info at:2.
-
- howBig == (runOffset - 1) ifTrue:[
- "/ we are lucky - new size is up-to previous run
-
- contentsArray := contentsArray copyFrom:1 to:runIndex-1.
- ] ifFalse:[
- contentsArray := contentsArray copyFrom:1 to:(runIndex+1).
- contentsArray at:runIndex put:(howBig - runOffset + 1)
- ].
-
- "
- |c|
-
- c := RunArray new.
- c addAll:#(1 2 3 4 4 4 4 5 5 5 1 2 3); yourself.
-
- c grow:50; yourself.
-
- c grow:7; yourself.
-
- c grow:6; yourself.
-
- c grow:0; yourself.
- "
-
- "Modified: 11.5.1996 / 13:34:53 / cg"
! !
!RunArray methodsFor:'comparing'!
@@ -976,14 +913,6 @@
^ contentsArray
!
-isEmpty
- "Am I empty or not. Returns a boolean"
-
- ^ contentsArray notNil
-
- "Modified: 11.5.1996 / 13:35:17 / cg"
-!
-
runIndexAndStartIndexForIndex:anIndex
"given a logical index, find the index of that run and the logical index
of the first item in that run."
@@ -1092,6 +1021,71 @@
].
! !
+!RunArray methodsFor:'private-growing'!
+
+grow:howBig
+ "grow or shrink the receiver to contain howBig elements.
+ If growing, new slots will be filled (logically) with nil."
+
+ |sz info runIndex runOffset runSz newRuns|
+
+ sz := self size.
+
+ howBig == sz ifTrue:[^ self].
+
+ howBig == 0 ifTrue:[
+ contentsArray := nil.
+ ^ self.
+ ].
+
+ contentsArray isNil ifTrue:[
+ contentsArray := Array with:howBig with:nil.
+ ^ self
+ ].
+
+ runSz := contentsArray size.
+
+ howBig > sz ifTrue:[
+ newRuns := Array new:(runSz + 2).
+ newRuns replaceFrom:1 to:runSz with:contentsArray startingAt:1.
+ newRuns at:(runSz+1) put:(howBig - sz).
+ contentsArray := newRuns.
+ ^ self
+ ].
+
+ "/ shrinking; possibly cut of a run
+
+ info := self runIndexAndStartIndexForIndex:howBig.
+ runIndex := info at:1.
+ runOffset := info at:2.
+
+ howBig == (runOffset - 1) ifTrue:[
+ "/ we are lucky - new size is up-to previous run
+
+ contentsArray := contentsArray copyFrom:1 to:runIndex-1.
+ ] ifFalse:[
+ contentsArray := contentsArray copyFrom:1 to:(runIndex+1).
+ contentsArray at:runIndex put:(howBig - runOffset + 1)
+ ].
+
+ "
+ |c|
+
+ c := RunArray new.
+ c addAll:#(1 2 3 4 4 4 4 5 5 5 1 2 3); yourself.
+
+ c grow:50; yourself.
+
+ c grow:7; yourself.
+
+ c grow:6; yourself.
+
+ c grow:0; yourself.
+ "
+
+ "Modified: 11.5.1996 / 13:34:53 / cg"
+! !
+
!RunArray methodsFor:'searching'!
findFirst:aBlock
@@ -1230,6 +1224,14 @@
^ false
"Created: / 30.10.1997 / 15:38:30 / cg"
+!
+
+isEmpty
+ "Am I empty or not. Returns a boolean"
+
+ ^ contentsArray notNil
+
+ "Modified: 11.5.1996 / 13:35:17 / cg"
! !
!RunArray methodsFor:'user interface'!
@@ -1246,5 +1248,5 @@
!RunArray class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/RunArray.st,v 1.17 2000-07-18 15:01:09 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/RunArray.st,v 1.18 2000-08-22 13:49:22 cg Exp $'
! !