diff --git a/src/MuTalk-Utilities-Tests/MTNonMutatedMethodsAnalysisTest.class.st b/src/MuTalk-Utilities-Tests/MTNonMutatedMethodsAnalysisTest.class.st index 252641b..e12af65 100644 --- a/src/MuTalk-Utilities-Tests/MTNonMutatedMethodsAnalysisTest.class.st +++ b/src/MuTalk-Utilities-Tests/MTNonMutatedMethodsAnalysisTest.class.st @@ -12,7 +12,7 @@ MTNonMutatedMethodsAnalysisTest >> testNonMutatedMethods [ results := (MTNonMutatedMethodsAnalysis forClasses: { MTAuxiliarClassForMatrix. MTAuxiliarClassForMatrixTest }) - findMethodsWithoutMutation asSet. + methodsWithoutMutation asSet. self assert: results diff --git a/src/MuTalk-Utilities/MTMutantOperatorAnalysis.class.st b/src/MuTalk-Utilities/MTMutantOperatorAnalysis.class.st index 0e42f68..1acb1ed 100644 --- a/src/MuTalk-Utilities/MTMutantOperatorAnalysis.class.st +++ b/src/MuTalk-Utilities/MTMutantOperatorAnalysis.class.st @@ -22,22 +22,24 @@ MTMutantOperatorAnalysis >> addAllAssociationsFrom: sourceDictionary to: destina ] { #category : 'computing' } -MTMutantOperatorAnalysis >> findOperatorsWithoutMutantsFor: aDictionary [ +MTMutantOperatorAnalysis >> operatorDictionary [ + "Returns the dictionary with mutant operators as keys, and for each operator the number of mutants it produce" - | operatorsWithoutMutants | - operatorsWithoutMutants := (MTMutantOperator contentsAll collect: - #species) reject: [ :ope | - aDictionary keys includes: ope ]. + | operatorDictionary operatorsWithoutMutants | + operatorDictionary := self operatorDictionaryFromAnalysis. + operatorsWithoutMutants := self operatorsWithoutMutantsFor: + operatorDictionary. - ^ Dictionary new - addAll: - (operatorsWithoutMutants collect: [ :each | each -> 0 ]) - asDictionary; - yourself + operatorDictionary := self + addAllAssociationsFrom: + operatorsWithoutMutants + to: operatorDictionary asDictionary. + + ^ operatorDictionary ] { #category : 'computing' } -MTMutantOperatorAnalysis >> mutantOperatorsDictionaryFromAnalysis [ +MTMutantOperatorAnalysis >> operatorDictionaryFromAnalysis [ | analysis dic | analysis := MTAnalysis new @@ -66,21 +68,20 @@ MTMutantOperatorAnalysis >> operatorsProducingAtMost: aNumber [ { #category : 'computing' } MTMutantOperatorAnalysis >> operatorsSelectedWith: aBlock [ - ^ (self wholeOperatorsDictionary select: aBlock) keys asSet + ^ (self operatorDictionary select: aBlock) keys asSet ] { #category : 'computing' } -MTMutantOperatorAnalysis >> wholeOperatorsDictionary [ +MTMutantOperatorAnalysis >> operatorsWithoutMutantsFor: aDictionary [ - | operatorsDictionary operatorsWithoutMutants | - operatorsDictionary := self mutantOperatorsDictionaryFromAnalysis. - operatorsWithoutMutants := self findOperatorsWithoutMutantsFor: - operatorsDictionary. - - operatorsDictionary := self - addAllAssociationsFrom: - operatorsWithoutMutants - to: operatorsDictionary asDictionary. + | operatorsWithoutMutants | + operatorsWithoutMutants := (MTMutantOperator contentsAll collect: + #species) reject: [ :ope | + aDictionary keys includes: ope ]. - ^ operatorsDictionary + ^ Dictionary new + addAll: + (operatorsWithoutMutants collect: [ :each | each -> 0 ]) + asDictionary; + yourself ] diff --git a/src/MuTalk-Utilities/MTNonMutatedMethodsAnalysis.class.st b/src/MuTalk-Utilities/MTNonMutatedMethodsAnalysis.class.st index 1fd811f..9243c41 100644 --- a/src/MuTalk-Utilities/MTNonMutatedMethodsAnalysis.class.st +++ b/src/MuTalk-Utilities/MTNonMutatedMethodsAnalysis.class.st @@ -6,25 +6,25 @@ Class { } { #category : 'computing' } -MTNonMutatedMethodsAnalysis >> findMethodsWithoutMutation [ +MTNonMutatedMethodsAnalysis >> allMethods [ - | allMethods allMutatedMethods | - allMethods := self getAllMethods. - allMutatedMethods := self getMutatedMethods. - - ^ allMethods reject: [ :method | allMutatedMethods includes: method ] + ^ classes inject: OrderedCollection new into: [ :coll :class | + coll addAll: (class methods reject: #isExtension). + coll ] ] { #category : 'computing' } -MTNonMutatedMethodsAnalysis >> getAllMethods [ +MTNonMutatedMethodsAnalysis >> methodsWithoutMutation [ - ^ classes inject: OrderedCollection new into: [ :coll :class | - coll addAll: (class methods reject: #isExtension). - coll ] + | allMethods allMutatedMethods | + allMethods := self allMethods. + allMutatedMethods := self mutatedMethods. + + ^ allMethods reject: [ :method | allMutatedMethods includes: method ] ] { #category : 'computing' } -MTNonMutatedMethodsAnalysis >> getMutatedMethods [ +MTNonMutatedMethodsAnalysis >> mutatedMethods [ | analysis mutatedMethods | analysis := MTAnalysis new