'From Squeak3.6 of ''6 October 2003'' [latest update: #5424] on 18 February 2004 at 3:19:48 am'! OrderedCollection subclass: #Owner instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Category-YukiQuiz'! Owner subclass: #Mammal instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Category-YukiQuiz'! Mammal subclass: #Human instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Category-YukiQuiz'! !Integer methodsFor: 'As I was going to St. Ives' stamp: 'sumim 2/18/2004 03:02'! cats ^ self mammals! ! !Integer methodsFor: 'As I was going to St. Ives' stamp: 'sumim 2/18/2004 03:11'! humans | humans | humans _ Array new: self. 1 to: self do: [ : index | humans at: index put: Human new ]. ^ humans! ! !Integer methodsFor: 'As I was going to St. Ives' stamp: 'sumim 2/18/2004 03:02'! kits ^ self mammals! ! !Integer methodsFor: 'As I was going to St. Ives' stamp: 'sumim 2/18/2004 03:11'! mammals | mammals | mammals _ Array new: self. 1 to: self do: [ : index | mammals at: index put: Mammal new ]. ^ mammals! ! !Integer methodsFor: 'As I was going to St. Ives' stamp: 'sumim 2/18/2004 03:11'! ownees | ownees | ownees _ Array new: self. 1 to: self do: [ : index | ownees at: index put: Owner new ]. ^ ownees! ! !Integer methodsFor: 'As I was going to St. Ives' stamp: 'sumim 2/18/2004 01:19'! sacks ^ self ownees! ! !Integer methodsFor: 'As I was going to St. Ives' stamp: 'sumim 2/18/2004 03:02'! wives ^ self humans! ! !Owner methodsFor: 'As I was going to St. Ives' stamp: 'sumim 2/18/2004 01:04'! had: anCollection ^ self addAll: anCollection! ! !Owner methodsFor: 'As I was going to St. Ives' stamp: 'sumim 2/18/2004 03:05'! howManyCompanions ^ self howManyCompanions: [ : each | true ]! ! !Owner methodsFor: 'As I was going to St. Ives' stamp: 'sumim 2/18/2004 03:16'! howManyCompanions: aBlock ^ self inject: ((aBlock value: self) ifTrue: [1] ifFalse: [0]) into: [ : sum : each | sum + (each howManyCompanions: aBlock) ]! ! !Owner class methodsFor: 'examples' stamp: 'sumim 2/18/2004 03:19'! numOfAll | man | man := Human new. (man had: 7 wives) do: [ : eachWife | (eachWife had: 7 sacks) do: [ : eachSack | (eachSack had: 7 cats) do: [ : eachCat | (eachCat had: 7 kits) ]]]. ^ man howManyCompanions! ! !Owner class methodsFor: 'examples' stamp: 'sumim 2/18/2004 03:18'! numOfHuman | man | man := Human new. (man had: 7 wives) do: [ : eachWife | (eachWife had: 7 sacks) do: [ : eachSack | (eachSack had: 7 cats) do: [ : eachCat | (eachCat had: 7 kits) ]]]. ^ man howManyCompanions: [ :each | each isKindOf: Human ]! ! !Owner class methodsFor: 'examples' stamp: 'sumim 2/18/2004 03:18'! numOfMammal | man | man := Human new. (man had: 7 wives) do: [ : eachWife | (eachWife had: 7 sacks) do: [ : eachSack | (eachSack had: 7 cats) do: [ : eachCat | (eachCat had: 7 kits) ]]]. ^ man howManyCompanions: [ :each | each isKindOf: Mammal ]! ! Owner class removeSelector: #example!