AutomaticMethodCategorizer

AutomaticMethodCategorizer
Instances of this class can be used to categorize methods in a class based on a set of rules.
Example:
myCategorizationRule := MethodCategorizationRule whenSelectorMatches: 'initialize*' categorizeIn: #initialization.
(AutomaticMethodCategorizer using: myCategorizationRule) categorizeAllMethodsOf: MyClass
See also:
AutomaticMethodCategorizerTest for more examples
AutomaticMethodCategorizer defaultCategorizationRules
categorizationRuleFor:
categorizationRules
categorizeAllMethodsOf:
categorizeAllMethodsReferencedBy:
categorizeAllUncategorizedMethodsOf:
categorizeMethodReferencedBy:
defaultCategorizationRules
firstInstallationInstructions
initialize
Subclasses should redefine this method to perform initializations on instance creation
initializePreferences
initializeUsingAll:
new
showFirstInstallationInstructions
using:
usingAll:
AutomaticMethodCategorizerApplier
Instances of this class observes the changes notified by a SystemChangeNotifier and applies categories to methods using an instance of AutomaticMethodCategorizer.
You can use this class to autocategorize methods after compilation.
Example:
AutomaticMethodCategorizerApplier install
applyCategorizationFrom:
handleSelectionOf:inMethodModificationNotifiedWith:
This is an ugly hack to reselect the category in the browser, because when the method is recategorized
the browser updates the category list but deselects the current method (very annoing).
This hack appears to fixit... but is ugly an can fail with other kind of browsers, if some browser guru
knowns a better way to solve it, please let me known :) - DF
initialize
Subclasses should redefine this method to perform initializations on instance creation
initializeUsing:onChangesNotifiedBy:
install
methodAdditionNotifiedWith:
methodModificationNotifiedWith:
registerForNotifications
reinstall
shouldApplyCategorizationFrom:
uninstall
using:onChangesNotifiedBy:
AutomaticMethodCategorizerApplierTest
An AutomaticMethodCategorizerApplierTest is xxxxxxxxx.
Instance Variables
automaticMethodCategorizer: <Object>
mockClass: <Object>
mockSystemChangeNotifier: <Object>
automaticMethodCategorizer
- xxxxx
mockClass
- xxxxx
mockSystemChangeNotifier
- xxxxx
categoryForTesting
mockClass
setUp
setUpAutomaticMethodCategorizer
tearDown
testCategorizeOnMethodModification
testCategorizeOnNewMethod
AutomaticMethodCategorizerMockClass
An AutomaticMethodCategorizerMockClass is xxxxxxxxx.
Instance Variables
accessor: <Object>
accessor
- xxxxx
accessor
otherSelectorForTesting
This method is classified and unclassified by the tests, don't remove it.
If you classify it in another category.. it doesn't matter the classification will be lost each time
that you run the tests - DF
selectorForTesting
This method is classified and unclassified by the tests, don't remove it.
If you classify it in another category.. it doesn't matter the classification will be lost each time
that you run the tests - DF
AutomaticMethodCategorizerMockParentClass
An AutomaticMethodCategorizerMockParentClass is xxxxxxxxx.
Instance Variables
categorizeAllMethods
selectorForTesting
This method is classified and unclassified by the tests, don't remove it.
If you classify it in another category.. it doesn't matter the classification will be lost each time
that you run the tests - DF
uncategorizeAllMethods
AutomaticMethodCategorizerTest
An AutomaticMethodCategorizerTest is xxxxxxxxx.
Instance Variables
categorizationRules: <Object>
categorizationRules
- xxxxx
assertCategorizationOfAllMethodsWith:
categorizationRules
categoryForTesting
globalWithTestingRules
mockClass
setUp
setUpCategorizationRules
tearDown
testCategorizationRuleFor
Get a categorization rule for a given method reference - DF
testCategorizeAll
Categorize all methods (including those already categorized) - DF
testCategorizeAllUncategorized
Categorize only the uncategorized methods - DF
testCategorizeUsingRulesDefinedInPreferences
This test could fail if the Preferences are modified during the execution. - DF
CategorizationRulesExample
A CategorizationRulesExample is xxxxxxxxx.
Instance Variables
oneRule
rulesWithDefaults
FixedResultMethodCategoriesFinder
Instances of this class always returns a given category for a method.
findCategoriesFor:
initializeReturning:
returning:
ImageMethodCategoriesFinder
An ImageMethodCategoriesFinder is xxxxxxxxx.
Instance Variables
findCategoriesFor:
MethodCategoriesFinderBehavior
This abstract class defines the protocol of an object that given a MethodReference returns a bag
of the possible categories for that method.
The returned bag contains categories and their occurrences (if it's applicable).
findCategoriesFor:
MethodCategorizationRule
Instances of this class represents a categorization rule.
This class is very flexible and can be used to define different rules, see the instance creation methods for examples.
appliesTo:
canSelectCategoryFor:
categorizeMethodReferencedBy:
categoryFor:
forAccessors
initializeWhen:selectFromCategoriesReturnedBy:using:
usingMostUsedCategoryInImage
usingMostUsedCategoryInSuperClasses
when:categorizeIn:
when:selectFromCategoriesReturnedBy:using:
whenSelectorMatches:andClassInheritsFrom:categorizeIn:
whenSelectorMatches:categorizeIn:
MethodCategorizationRuleBehavior
This abstract class defines the protocol that must implement a rule to be used in the AutomaticMethodCategorizer.
appliesTo:
categorizeMethodReferencedBy:
MethodCategorizationRuleTest
A MethodCategorizationRuleTest is xxxxxxxxx.
Instance Variables
categoryForTesting
mockClass
referenceToAccessorMethod
referenceToMethodForTesting
referenceToOtherMethodForTesting
selectorForTesting
Used in tests (see local senders of this method) - DF
setUp
superClassCategory
tearDown
testAppliesTo
testAppliesToAccessors
testAppliesToWhenCreatedForSelector
testAppliesToWhenCreatedForSelectorAndClassInheritsFrom
testAppliesToWhenUsingSuperClassCategory
testCategorize
testCategorizeWhenUsingSuperClassCategory
MethodCategorySelectionStrategyBehavior
A MethodCategorySelectionStrategyBehavior is xxxxxxxxx.
Instance Variables
canSelectCategoryFor:from:
selectCategoryFor:from:
MockSystemChangeNotifier
A MockSystemChangeNotifier is xxxxxxxxx.
Instance Variables
eventSource: <Object>
eventSource
- xxxxx
initialize
Subclasses should redefine this method to perform initializations on instance creation
methodAdded:selector:inClass:
methodChangedFrom:to:selector:inClass:
notify:ofEvents:using:
notify:ofSystemChangesOfItem:change:using:
systemEventsForItem:change:
trigger:
MostUsedMethodCategorySelectionStrategy
A MostUsedMethodCategorySelectionStrategy is xxxxxxxxx.
Instance Variables
canSelectCategoryFor:from:
selectCategoryFor:from:
NullMethodCategorizationRule
This is a null rule that does nothing.
See also:
Search on the web for "Null Object Pattern".
appliesTo:
categorizeMethodReferencedBy:
initialize
Subclasses should redefine this method to perform initializations on instance creation
initializeUniqueInstance
new
uniqueInstance
NullMethodCategorizationRuleTest
A NullMethodCategorizationRuleTest is xxxxxxxxx.
Instance Variables
rule: <Object>
rule
- xxxxx
mockClass
setUp
testAppliesTo
testCategorize
SuperClassMethodCategoriesFinder
Instances of this class returns all the categories found in the super-classes of a method.
findCategoriesFor: