--- a/Queue.st Fri Nov 22 17:12:19 2002 +0100
+++ b/Queue.st Tue Nov 26 10:03:40 2002 +0100
@@ -206,6 +206,27 @@
aCollection do:[:element | self nextPut:element]
!
+nextPutFirst:anObject
+ |sz pos "{ Class: SmallInteger }" |
+
+ tally == 0 ifTrue:[
+ self nextPut:anObject.
+ ^ self
+ ].
+
+ sz := contentsArray size.
+ (tally == sz) ifTrue:[
+ self error:'queue is full' mayProceed:true.
+ ^ self
+ ].
+ pos := readPosition - 1.
+ pos < 1 ifTrue:[pos := sz].
+ contentsArray at:pos put:anObject.
+ readPosition := pos.
+
+ tally := tally + 1
+!
+
peek
"return the next value in the queue without removing it.
If the queue is empty, return nil."
@@ -328,5 +349,5 @@
!Queue class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/Queue.st,v 1.26 2000-08-22 13:49:13 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/Queue.st,v 1.27 2002-11-26 09:03:40 cg Exp $'
! !