--- a/SequenceableCollection.st Tue Nov 09 10:31:31 1999 +0100
+++ b/SequenceableCollection.st Tue Nov 09 10:32:10 1999 +0100
@@ -250,6 +250,25 @@
"
#(1 2 3) atRandom
"
+!
+
+atWrap:index
+ "Return the index'th element of me if possible.
+ Wrap the index modulu the receivers size if it is out of bounds."
+
+ ^ self at:((index - 1) \\ (self size)) + 1
+
+ "
+ #(1 2 3) atWrap:1
+ #(1 2 3) atWrap:2
+ #(1 2 3) atWrap:3
+ #(1 2 3) atWrap:4
+ #(1 2 3) atWrap:5
+ #(1 2 3) atWrap:6
+ #(1 2 3) atWrap:7
+ #(1 2 3) atWrap:0
+ #(1 2 3) atWrap:-1
+ "
! !
!SequenceableCollection methodsFor:'accessing'!
@@ -4442,6 +4461,6 @@
!SequenceableCollection class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.120 1999-10-06 16:33:34 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.121 1999-11-09 09:32:10 cg Exp $'
! !
SequenceableCollection initialize!