equal
deleted
inserted
replaced
398 Abstract subclasses must redefine again." |
398 Abstract subclasses must redefine again." |
399 |
399 |
400 ^ self == SequenceableCollection |
400 ^ self == SequenceableCollection |
401 ! ! |
401 ! ! |
402 |
402 |
403 |
|
404 !SequenceableCollection methodsFor:'Compatibility-Squeak'! |
403 !SequenceableCollection methodsFor:'Compatibility-Squeak'! |
405 |
404 |
406 allButFirst |
405 allButFirst |
407 "Return a copy of the receiver containing all but the first element. |
406 "Return a copy of the receiver containing all but the first element. |
408 Raise an error if there are not enough elements." |
407 Raise an error if there are not enough elements." |
711 |
710 |
712 replaceElementsFrom:start to:stop withArray:anArray startingAt:repStart |
711 replaceElementsFrom:start to:stop withArray:anArray startingAt:repStart |
713 ^ self replaceFrom:start to:stop with:anArray startingAt:repStart |
712 ^ self replaceFrom:start to:stop with:anArray startingAt:repStart |
714 ! ! |
713 ! ! |
715 |
714 |
|
715 |
716 !SequenceableCollection methodsFor:'accessing'! |
716 !SequenceableCollection methodsFor:'accessing'! |
717 |
717 |
718 after:anObject |
718 after:anObject |
719 "return the element, after anObject. |
719 "return the element, after anObject. |
720 If anObject is not in the receiver, report an error; |
720 If anObject is not in the receiver, report an error; |
895 "Modified: / 20.5.1998 / 14:50:25 / cg" |
895 "Modified: / 20.5.1998 / 14:50:25 / cg" |
896 ! |
896 ! |
897 |
897 |
898 first:n |
898 first:n |
899 "return the n first elements of the collection. |
899 "return the n first elements of the collection. |
900 Raises an error if there are not enough elements in the receiver." |
900 No longer raises an error if there are not enough elements; |
|
901 instead, returns what is there" |
901 |
902 |
902 n < 0 ifTrue:[self error:'bad (negative) argument']. |
903 n < 0 ifTrue:[self error:'bad (negative) argument']. |
903 n > self size ifTrue:[^ self notEnoughElementsError]. |
904 |
904 |
905 "/ OLD: |
905 ^ self copyFirst:n |
906 "/ "error if collection has not enough elements" |
|
907 "/ n > self size ifTrue:[ |
|
908 "/ ^ self notEnoughElementsError |
|
909 "/ ]. |
|
910 |
|
911 "/ NEW: |
|
912 "/ return what we have - no error if not enough elements |
|
913 ^ self copyFirst:(n min:self size) |
906 |
914 |
907 " |
915 " |
908 #(1 2 3 4 5) first:3 |
916 #(1 2 3 4 5) first:3 |
909 #(1 2 3 4 5) first:6 |
917 #(1 2 3 4 5) first:6 |
910 #(1 2 3 4 5) asSet first:3 |
918 #(1 2 3 4 5) asSet first:3 |
9824 ! ! |
9832 ! ! |
9825 |
9833 |
9826 !SequenceableCollection class methodsFor:'documentation'! |
9834 !SequenceableCollection class methodsFor:'documentation'! |
9827 |
9835 |
9828 version |
9836 version |
9829 ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.404 2015-03-05 12:44:33 cg Exp $' |
9837 ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.405 2015-03-28 08:55:27 cg Exp $' |
9830 ! |
9838 ! |
9831 |
9839 |
9832 version_CVS |
9840 version_CVS |
9833 ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.404 2015-03-05 12:44:33 cg Exp $' |
9841 ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.405 2015-03-28 08:55:27 cg Exp $' |
9834 ! ! |
9842 ! ! |
9835 |
9843 |
9836 |
9844 |
9837 SequenceableCollection initialize! |
9845 SequenceableCollection initialize! |