OrderedCollection.st
changeset 282 94f5c3a6230d
parent 253 30daee717a53
child 293 31df3850e98c
--- a/OrderedCollection.st	Fri Feb 24 17:32:55 1995 +0100
+++ b/OrderedCollection.st	Fri Feb 24 17:38:46 1995 +0100
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.20 1995-02-15 10:27:46 claus Exp $
+$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.21 1995-02-24 16:37:34 claus Exp $
 '!
 
 !OrderedCollection class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.20 1995-02-15 10:27:46 claus Exp $
+$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.21 1995-02-24 16:37:34 claus Exp $
 "
 !
 
@@ -604,7 +604,10 @@
 !
 
 makeRoomAtLast
-    "grow/shift the contents for more room at the end"
+    "grow/shift the contents for more room at the end.
+     Does not change the logical size.
+     i.e.
+     #(1 2 3 4 5 6) -> #(1 2 3 4 5 6 nil)"
 
     |newContents 
      oldSize    "{ Class:SmallInteger }"
@@ -636,7 +639,10 @@
 !
 
 makeRoomAtFront
-    "grow/shift the contents for more room at the beginning"
+    "grow/shift the contents for more room at the beginning.
+     Does not change the logical size.
+     i.e.
+     #(1 2 3 4 5 6) -> #(nil 1 2 3 4 5 6)"
 
     |newContents
      oldSize    "{ Class:SmallInteger }"
@@ -681,6 +687,7 @@
 
 makeRoomAtIndex:index
     "grow the contents for inserting at index
+     Changes the logical size.
      i.e.
      #(1 2 3 4 5 6) asOrderedCollection makeRoomAtIndex:3 -> #(1 2 nil 3 4 5 6)
      #(1 2 3 4 5 6) asOrderedCollection makeRoomAtIndex:1 -> #(nil 1 2 3 4 5 6)
@@ -839,6 +846,12 @@
     start to:stop do:[:index |
 	aTwoArgBlock value:index value:(contentsArray at:index)
     ]
+
+    "
+     #(10 20 30 40) asOrderedCollection keysAndValuesDo:[:index :value |
+	Transcript show:index; show:' '; showCr:value
+     ]  
+    "
 !
 
 collect:aBlock
@@ -856,21 +869,24 @@
 	newCollection add:(aBlock value:(contentsArray at:index)).
     ].
     ^ newCollection
+
+    "
+     #(1 2 3 4) asOrderedCollection collect:[:i | i * i] 
+     #(1 2 3 4) asOrderedCollection collect:[:i | i even] 
+    "
 ! !
 
-!OrderedCollection methodsFor:'misc'!
+!OrderedCollection methodsFor:'inspecting'!
 
-inspect
-    "redefined to launch an OrderedCollectionInspector on the receiver
+inspectorClass
+    "redefined to launch an OrderedCollectionInspector
      (instead of the default InspectorView)."
 
-    OrderedCollectionInspectorView isNil ifTrue:[
-	super inspect
-    ] ifFalse:[
-	OrderedCollectionInspectorView openOn:self
-    ]
+    ^ OrderedCollectionInspectorView
 
-    "(OrderedCollection withAll:#(3 2 1)) inspect"
-    "(OrderedCollection withAll:#(3 2 1)) removeFirst; yourself; inspect"
-    "#(0 8 15 3 99 2) asSortedCollection inspect"
+    "
+     (OrderedCollection withAll:#(3 2 1)) inspect
+     (OrderedCollection withAll:#(3 2 1)) removeFirst; yourself; inspect
+     #(0 8 15 3 99 2) asSortedCollection inspect
+    "
 ! !