'From Squeak3.2gamma of 15 January 2002 [latest update: #4881] on 20 July 2002 at 4:58:37 pm'! Object subclass: #ContainerType instanceVariableNames: 'containerType elementType ' classVariableNames: '' poolDictionaries: '' category: 'Types'! !Object methodsFor: 'types' stamp: 'ikp 7/20/2002 16:20'! type: aClass (aClass hasInstance: self) ifFalse: [self error: self printString, ' is not of type ', aClass printString]. ! ! !Array methodsFor: 'types' stamp: 'ikp 7/20/2002 16:56'! hasInstance: anObject ^(self detect: [ :aClass | aClass hasInstance: anObject] ifNone: [nil]) notNil! ! !Behavior methodsFor: 'types' stamp: 'ikp 7/20/2002 16:20'! hasInstance: anObject ^anObject isKindOf: self! ! !Collection class methodsFor: 'types' stamp: 'ikp 7/20/2002 16:24'! of: aClass ^ContainerType new containerType: self elementType: aClass! ! !ContainerType methodsFor: 'accessing' stamp: 'ikp 7/20/2002 16:24'! containerType: ct elementType: et containerType _ ct. elementType _ et.! ! !ContainerType methodsFor: 'testing' stamp: 'ikp 7/20/2002 16:27'! hasInstance: anObject ^(anObject isKindOf: containerType) and: [anObject do: [ :elt | (elementType hasInstance: elt) ifFalse: [^false]]. true]! ! !ContainerType methodsFor: 'printing' stamp: 'ikp 7/20/2002 16:29'! printOn: aStream aStream nextPut: $(. containerType printOn: aStream. aStream nextPutAll: ' of: '. elementType printOn: aStream. aStream nextPut: $)! ! !ContainerType reorganize! ('accessing' containerType:elementType:) ('testing' hasInstance:) ('printing' printOn:) !