equal
deleted
inserted
replaced
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.25 1995-03-06 19:17:49 claus Exp $ |
24 $Header: /cvs/stx/stx/libbasic/Attic/SeqColl.st,v 1.26 1995-03-08 23:39:46 claus Exp $ |
25 '! |
25 '! |
26 |
26 |
27 !SequenceableCollection class methodsFor:'documentation'! |
27 !SequenceableCollection class methodsFor:'documentation'! |
28 |
28 |
29 copyright |
29 copyright |
40 " |
40 " |
41 ! |
41 ! |
42 |
42 |
43 version |
43 version |
44 " |
44 " |
45 $Header: /cvs/stx/stx/libbasic/Attic/SeqColl.st,v 1.25 1995-03-06 19:17:49 claus Exp $ |
45 $Header: /cvs/stx/stx/libbasic/Attic/SeqColl.st,v 1.26 1995-03-08 23:39:46 claus Exp $ |
46 " |
46 " |
47 ! |
47 ! |
48 |
48 |
49 documentation |
49 documentation |
50 " |
50 " |
83 ! |
83 ! |
84 |
84 |
85 at:index ifAbsent:exceptionBlock |
85 at:index ifAbsent:exceptionBlock |
86 "return the element at index if valid. |
86 "return the element at index if valid. |
87 If the index is invalid, return the result of evaluating |
87 If the index is invalid, return the result of evaluating |
88 the exceptionblock." |
88 the exceptionblock. |
|
89 NOTICE: |
|
90 in ST-80, this message is only defined for Dictionaries, |
|
91 however, having a common protocol with indexed collections |
|
92 often simplifies things." |
89 |
93 |
90 ((index < 1) or:[index > self size]) ifTrue:[ |
94 ((index < 1) or:[index > self size]) ifTrue:[ |
91 ^ exceptionBlock value |
95 ^ exceptionBlock value |
92 ]. |
96 ]. |
93 ^ self at:index |
97 ^ self at:index |
94 |
98 |
95 " |
99 " |
96 #(1 2 3) at:4 ifAbsent:['no such index'] |
100 #(1 2 3) at:4 ifAbsent:['no such index'] |
|
101 #(1 2 3) asOrderedCollection at:4 ifAbsent:['no such index'] |
|
102 |
97 (Dictionary with:(#foo -> #bar) |
103 (Dictionary with:(#foo -> #bar) |
98 with:(#frob -> #baz)) |
104 with:(#frob -> #baz)) |
99 at:#foobar ifAbsent:['no such index'] |
105 at:#foobar ifAbsent:['no such index'] |
100 " |
106 " |
101 ! ! |
107 ! ! |