home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
vol_300
/
310_01
/
array.st
< prev
next >
Wrap
Text File
|
1990-04-20
|
655b
|
32 lines
Class Array :ArrayedCollection
[
new: aValue
^ <NewArray aValue>
|
at: aNumber
( (aNumber < 1) or: [aNumber > <Size self> ] )
ifTrue: [ self error: 'index error'. ^nil ].
^ <At self aNumber >
|
at: aNumber put: aValue
( (aNumber < 1) or: [aNumber > <Size self> ] )
ifTrue: [ self error: 'index error'. ^nil ].
<AtPut self aNumber aValue >.
^ aValue
|
grow: newObject
^ <Grow self newObject>
|
printString | value i |
value <- ')'.
i <- <Size self>.
[i > 0] whileTrue:
[ value <- <At self i> printString ,
' ', value.
i <- i - 1].
^ '#( ' , value
|
size
^ <Size self>
]