19 |
19 |
20 SequenceableCollection comment:' |
20 SequenceableCollection comment:' |
21 COPYRIGHT (c) 1989 by Claus Gittinger |
21 COPYRIGHT (c) 1989 by Claus Gittinger |
22 All Rights Reserved |
22 All Rights Reserved |
23 |
23 |
24 $Header: /cvs/stx/stx/libbasic/Attic/SeqColl.st,v 1.27 1995-03-18 05:06:08 claus Exp $ |
24 $Header: /cvs/stx/stx/libbasic/Attic/SeqColl.st,v 1.28 1995-05-18 15:10:08 claus Exp $ |
25 '! |
25 '! |
26 |
26 |
27 !SequenceableCollection class methodsFor:'documentation'! |
27 !SequenceableCollection class methodsFor:'documentation'! |
28 |
28 |
29 copyright |
29 copyright |
1071 " |
1071 " |
1072 ! |
1072 ! |
1073 |
1073 |
1074 removeFromIndex:startIndex toIndex:endIndex |
1074 removeFromIndex:startIndex toIndex:endIndex |
1075 "remove the elements stored at indexes between startIndex and endIndex. |
1075 "remove the elements stored at indexes between startIndex and endIndex. |
|
1076 Return the receiver. |
|
1077 Returning the receiver is a historic leftover - it may at one |
|
1078 time return a collection of the removed elements. |
1076 |
1079 |
1077 Notice, that this is modifies the receiver - NOT a copy; |
1080 Notice, that this is modifies the receiver - NOT a copy; |
1078 therefore any other users of the receiver will also see this change. |
1081 therefore any other users of the receiver will also see this change. |
1079 Also note, that it may be a slow operation for some collections, |
1082 Also note, that it may be a slow operation for some collections, |
1080 due to the grow:-message, which is inefficient for fixed size |
1083 due to the grow:-message, which is inefficient for fixed size |
1106 #(1 2 3 4 5 6 7 8 9 0) asOrderedCollection removeFromIndex:1 toIndex:10 |
1109 #(1 2 3 4 5 6 7 8 9 0) asOrderedCollection removeFromIndex:1 toIndex:10 |
1107 #(1 2 3 4 5 6 7 8 9 0) removeFromIndex:1 toIndex:10 |
1110 #(1 2 3 4 5 6 7 8 9 0) removeFromIndex:1 toIndex:10 |
1108 " |
1111 " |
1109 ! |
1112 ! |
1110 |
1113 |
1111 removeAtIndex:index |
1114 removeAtIndex:anIndex |
1112 "remove the argument stored at index and return it. |
1115 "remove the element stored at anIndex. Return the removed object. |
1113 |
1116 |
1114 Notice, that this is modifies the receiver NOT a copy. |
1117 Notice, that this is modifies the receiver NOT a copy. |
1115 Also note, that it may be a slow operation for some collections, |
1118 Also note, that it may be a slow operation for some collections, |
1116 due to the grow:-message, which is inefficient for fixed size |
1119 due to the grow:-message, which is inefficient for fixed size |
1117 collections (i.e. for Strings and Arrays it is not recommened)." |
1120 collections (i.e. for Strings and Arrays it is not recommened)." |
1118 |
1121 |
1119 |element| |
1122 |element| |
1120 |
1123 |
1121 element := self at:index. |
1124 element := self at:anIndex. |
1122 self removeIndex:index. |
1125 self removeFromIndex:anIndex toIndex:anIndex. |
1123 ^ element |
1126 ^ element |
1124 |
1127 |
1125 " |
1128 " |
|
1129 #(1 2 3 4 5 6 7 8 9) asOrderedCollection removeAtIndex:3 |
|
1130 #(1 2 3 4 5) asOrderedCollection removeAtIndex:6 |
1126 #($a $b $c $d $e $f $g) removeAtIndex:3 |
1131 #($a $b $c $d $e $f $g) removeAtIndex:3 |
1127 " |
1132 " |
1128 ! |
1133 ! |
1129 |
1134 |
1130 removeIndex:index |
1135 removeIndex:index |