--- a/Plug.st Tue Feb 14 12:05:34 2006 +0100
+++ b/Plug.st Tue Feb 14 12:08:47 2006 +0100
@@ -74,6 +74,7 @@
plug foo:'some argument'
[exEnd]
+
using a plug as a generator (simulates a readStream):
[exBegin]
|generator num|
@@ -88,6 +89,19 @@
]
[exEnd]
+
+ simulating a big collection:
+ [exBegin]
+ |virtualList|
+
+ virtualList := Plug new.
+ virtualList inheritFrom:SequenceableCollection.
+ virtualList respondTo:#size with:[ 1000000 ].
+ virtualList respondTo:#at: with:[:lineNr | 'List line Nr. ' , lineNr printString ].
+ virtualList inspect.
+ [exEnd]
+
+
simulating ``instance variables'':
(actually, this is somewhat expensive - the contexts locals are used for them ...)
be careful with unintended variable sharing (if plugs are created in a loop ..)
@@ -112,6 +126,7 @@
Transcript show:'plug2''s value: '; showCR:plug2 get.
[exEnd]
+
simulating a big list in a ListView
(real applications would read the lines from a database or file):
[exBegin]
@@ -191,6 +206,12 @@
"Modified: 27.4.1996 / 16:15:34 / cg"
!
+isSequenceable
+ "catch this one - its so common"
+
+ ^ self doesNotUnderstand:(Message selector:#isSequenceable arguments:#())
+!
+
size
"catch this one - its so common"
@@ -320,5 +341,5 @@
!Plug class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/Plug.st,v 1.22 2006-02-14 11:05:34 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/Plug.st,v 1.23 2006-02-14 11:08:47 cg Exp $'
! !