diff --git a/BaselineOfObjectStatistics.package/.filetree b/BaselineOfObjectStatistics.package/.filetree new file mode 100644 index 0000000..57a6797 --- /dev/null +++ b/BaselineOfObjectStatistics.package/.filetree @@ -0,0 +1,5 @@ +{ + "separateMethodMetaAndSource" : false, + "noMethodMetaData" : true, + "useCypressPropertiesFile" : true +} \ No newline at end of file diff --git a/BaselineOfObjectStatistics.package/BaselineOfObjectStatistics.class/README.md b/BaselineOfObjectStatistics.package/BaselineOfObjectStatistics.class/README.md new file mode 100644 index 0000000..e69de29 diff --git a/BaselineOfObjectStatistics.package/BaselineOfObjectStatistics.class/instance/baseline..st b/BaselineOfObjectStatistics.package/BaselineOfObjectStatistics.class/instance/baseline..st new file mode 100644 index 0000000..c5197c7 --- /dev/null +++ b/BaselineOfObjectStatistics.package/BaselineOfObjectStatistics.class/instance/baseline..st @@ -0,0 +1,18 @@ +baselines +baseline: spec + + spec for: #'common' do: [ + spec baseline: 'StateSpecs' with: [ + spec + repository: 'github://dionisiydk/StateSpecs:v2.4.x'; + loads: 'Core' ]. + spec baseline: 'Mocketry' with: [ + spec repository: 'github://dionisiydk/Mocketry:v4.0.x' ]. + spec + package: 'ObjectStatistics' with: [spec requires: #('StateSpecs')]; + package: 'ObjectStatistics-Tests' with: [spec requires: #('ObjectStatistics' 'Mocketry')]; + package: 'ObjectStatistics-GTTools' with: [spec requires: #('ObjectStatistics')]. + spec + group: 'default' with: #('Core' 'ObjectStatistics-GTTools' 'Tests'); + group: 'Core' with: #('ObjectStatistics'); + group: 'Tests' with: #('ObjectStatistics-Tests') ] \ No newline at end of file diff --git a/BaselineOfObjectStatistics.package/BaselineOfObjectStatistics.class/properties.json b/BaselineOfObjectStatistics.package/BaselineOfObjectStatistics.class/properties.json new file mode 100644 index 0000000..9214bff --- /dev/null +++ b/BaselineOfObjectStatistics.package/BaselineOfObjectStatistics.class/properties.json @@ -0,0 +1,11 @@ +{ + "commentStamp" : "", + "super" : "BaselineOf", + "category" : "BaselineOfObjectStatistics", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ ], + "name" : "BaselineOfObjectStatistics", + "type" : "normal" +} \ No newline at end of file diff --git a/BaselineOfObjectStatistics.package/monticello.meta/categories.st b/BaselineOfObjectStatistics.package/monticello.meta/categories.st new file mode 100644 index 0000000..40a4f84 --- /dev/null +++ b/BaselineOfObjectStatistics.package/monticello.meta/categories.st @@ -0,0 +1 @@ +SystemOrganization addCategory: #BaselineOfObjectStatistics! diff --git a/BaselineOfObjectStatistics.package/monticello.meta/initializers.st b/BaselineOfObjectStatistics.package/monticello.meta/initializers.st new file mode 100644 index 0000000..e69de29 diff --git a/BaselineOfObjectStatistics.package/monticello.meta/package b/BaselineOfObjectStatistics.package/monticello.meta/package new file mode 100644 index 0000000..244063f --- /dev/null +++ b/BaselineOfObjectStatistics.package/monticello.meta/package @@ -0,0 +1 @@ +(name 'BaselineOfObjectStatistics') \ No newline at end of file diff --git a/BaselineOfObjectStatistics.package/properties.json b/BaselineOfObjectStatistics.package/properties.json new file mode 100644 index 0000000..6f31cf5 --- /dev/null +++ b/BaselineOfObjectStatistics.package/properties.json @@ -0,0 +1 @@ +{ } \ No newline at end of file diff --git a/ObjectStatistics-GTTools.package/.filetree b/ObjectStatistics-GTTools.package/.filetree new file mode 100644 index 0000000..57a6797 --- /dev/null +++ b/ObjectStatistics-GTTools.package/.filetree @@ -0,0 +1,5 @@ +{ + "separateMethodMetaAndSource" : false, + "noMethodMetaData" : true, + "useCypressPropertiesFile" : true +} \ No newline at end of file diff --git a/ObjectStatistics-GTTools.package/ObjectStatDimension.extension/instance/gtInspectorItemsTreeIn..st b/ObjectStatistics-GTTools.package/ObjectStatDimension.extension/instance/gtInspectorItemsTreeIn..st new file mode 100644 index 0000000..b50997c --- /dev/null +++ b/ObjectStatistics-GTTools.package/ObjectStatDimension.extension/instance/gtInspectorItemsTreeIn..st @@ -0,0 +1,4 @@ +*ObjectStatistics-GTTools +gtInspectorItemsTreeIn: composite + + ObjectStatistics buildInspectorMetricsTreeIn: composite \ No newline at end of file diff --git a/ObjectStatistics-GTTools.package/ObjectStatDimension.extension/instance/inspectorTreeItems.st b/ObjectStatistics-GTTools.package/ObjectStatDimension.extension/instance/inspectorTreeItems.st new file mode 100644 index 0000000..cbdc400 --- /dev/null +++ b/ObjectStatistics-GTTools.package/ObjectStatDimension.extension/instance/inspectorTreeItems.st @@ -0,0 +1,3 @@ +*ObjectStatistics-GTTools +inspectorTreeItems + ^self sortedSlices \ No newline at end of file diff --git a/ObjectStatistics-GTTools.package/ObjectStatDimension.extension/properties.json b/ObjectStatistics-GTTools.package/ObjectStatDimension.extension/properties.json new file mode 100644 index 0000000..9511795 --- /dev/null +++ b/ObjectStatistics-GTTools.package/ObjectStatDimension.extension/properties.json @@ -0,0 +1,3 @@ +{ + "name" : "ObjectStatDimension" +} \ No newline at end of file diff --git a/ObjectStatistics-GTTools.package/ObjectStatSlice.extension/instance/gtInspectorItemsTreeIn..st b/ObjectStatistics-GTTools.package/ObjectStatSlice.extension/instance/gtInspectorItemsTreeIn..st new file mode 100644 index 0000000..c82cc2c --- /dev/null +++ b/ObjectStatistics-GTTools.package/ObjectStatSlice.extension/instance/gtInspectorItemsTreeIn..st @@ -0,0 +1,4 @@ +*ObjectStatistics-GTTools +gtInspectorItemsTreeIn: composite + + statistics gtInspectorItemsTreeIn: composite \ No newline at end of file diff --git a/ObjectStatistics-GTTools.package/ObjectStatSlice.extension/instance/inspectorTreeItems.st b/ObjectStatistics-GTTools.package/ObjectStatSlice.extension/instance/inspectorTreeItems.st new file mode 100644 index 0000000..fa5ae05 --- /dev/null +++ b/ObjectStatistics-GTTools.package/ObjectStatSlice.extension/instance/inspectorTreeItems.st @@ -0,0 +1,3 @@ +*ObjectStatistics-GTTools +inspectorTreeItems + ^statistics inspectorTreeItems \ No newline at end of file diff --git a/ObjectStatistics-GTTools.package/ObjectStatSlice.extension/properties.json b/ObjectStatistics-GTTools.package/ObjectStatSlice.extension/properties.json new file mode 100644 index 0000000..3d41d08 --- /dev/null +++ b/ObjectStatistics-GTTools.package/ObjectStatSlice.extension/properties.json @@ -0,0 +1,3 @@ +{ + "name" : "ObjectStatSlice" +} \ No newline at end of file diff --git a/ObjectStatistics-GTTools.package/ObjectStatistics.extension/class/buildInspectorMetricsTreeIn..st b/ObjectStatistics-GTTools.package/ObjectStatistics.extension/class/buildInspectorMetricsTreeIn..st new file mode 100644 index 0000000..080c914 --- /dev/null +++ b/ObjectStatistics-GTTools.package/ObjectStatistics.extension/class/buildInspectorMetricsTreeIn..st @@ -0,0 +1,11 @@ +*ObjectStatistics-GTTools +buildInspectorMetricsTreeIn: composite + | tree | + tree := composite tree + title: 'Metrics'; + allowsRecursiveSearch: true; +" shouldExpandToLevel: 0;" + + children: [ :receiver | receiver inspectorTreeItems]. + self expandInspectorTree: tree. + ^tree diff --git a/ObjectStatistics-GTTools.package/ObjectStatistics.extension/class/expandInspectorTree..st b/ObjectStatistics-GTTools.package/ObjectStatistics.extension/class/expandInspectorTree..st new file mode 100644 index 0000000..4bfcdd0 --- /dev/null +++ b/ObjectStatistics-GTTools.package/ObjectStatistics.extension/class/expandInspectorTree..st @@ -0,0 +1,4 @@ +*ObjectStatistics-GTTools +expandInspectorTree: tree + tree rootsExpanded. + tree allExpanded \ No newline at end of file diff --git a/ObjectStatistics-GTTools.package/ObjectStatistics.extension/instance/gtInspectorItemsTreeIn..st b/ObjectStatistics-GTTools.package/ObjectStatistics.extension/instance/gtInspectorItemsTreeIn..st new file mode 100644 index 0000000..bf468b6 --- /dev/null +++ b/ObjectStatistics-GTTools.package/ObjectStatistics.extension/instance/gtInspectorItemsTreeIn..st @@ -0,0 +1,5 @@ +*ObjectStatistics-GTTools +gtInspectorItemsTreeIn: composite + + + self class buildInspectorMetricsTreeIn: composite \ No newline at end of file diff --git a/ObjectStatistics-GTTools.package/ObjectStatistics.extension/instance/inspectorTreeItems.st b/ObjectStatistics-GTTools.package/ObjectStatistics.extension/instance/inspectorTreeItems.st new file mode 100644 index 0000000..81a106a --- /dev/null +++ b/ObjectStatistics-GTTools.package/ObjectStatistics.extension/instance/inspectorTreeItems.st @@ -0,0 +1,5 @@ +*ObjectStatistics-GTTools +inspectorTreeItems + dimensions size = 1 ifTrue: [ ^dimensions first inspectorTreeItems ]. + + ^dimensions reject: #isEmpty \ No newline at end of file diff --git a/ObjectStatistics-GTTools.package/ObjectStatistics.extension/properties.json b/ObjectStatistics-GTTools.package/ObjectStatistics.extension/properties.json new file mode 100644 index 0000000..3643a12 --- /dev/null +++ b/ObjectStatistics-GTTools.package/ObjectStatistics.extension/properties.json @@ -0,0 +1,3 @@ +{ + "name" : "ObjectStatistics" +} \ No newline at end of file diff --git a/ObjectStatistics-GTTools.package/monticello.meta/categories.st b/ObjectStatistics-GTTools.package/monticello.meta/categories.st new file mode 100644 index 0000000..6e7b2c9 --- /dev/null +++ b/ObjectStatistics-GTTools.package/monticello.meta/categories.st @@ -0,0 +1 @@ +SystemOrganization addCategory: #'ObjectStatistics-GTTools'! diff --git a/ObjectStatistics-GTTools.package/monticello.meta/initializers.st b/ObjectStatistics-GTTools.package/monticello.meta/initializers.st new file mode 100644 index 0000000..e69de29 diff --git a/ObjectStatistics-GTTools.package/monticello.meta/package b/ObjectStatistics-GTTools.package/monticello.meta/package new file mode 100644 index 0000000..5c577b4 --- /dev/null +++ b/ObjectStatistics-GTTools.package/monticello.meta/package @@ -0,0 +1 @@ +(name 'ObjectStatistics-GTTools') \ No newline at end of file diff --git a/ObjectStatistics-GTTools.package/properties.json b/ObjectStatistics-GTTools.package/properties.json new file mode 100644 index 0000000..6f31cf5 --- /dev/null +++ b/ObjectStatistics-GTTools.package/properties.json @@ -0,0 +1 @@ +{ } \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/.filetree b/ObjectStatistics-Tests.package/.filetree new file mode 100644 index 0000000..57a6797 --- /dev/null +++ b/ObjectStatistics-Tests.package/.filetree @@ -0,0 +1,5 @@ +{ + "separateMethodMetaAndSource" : false, + "noMethodMetaData" : true, + "useCypressPropertiesFile" : true +} \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatCounterTests.class/README.md b/ObjectStatistics-Tests.package/ObjectStatCounterTests.class/README.md new file mode 100644 index 0000000..e69de29 diff --git a/ObjectStatistics-Tests.package/ObjectStatCounterTests.class/instance/testMeasureObjects.st b/ObjectStatistics-Tests.package/ObjectStatCounterTests.class/instance/testMeasureObjects.st new file mode 100644 index 0000000..d13dd52 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatCounterTests.class/instance/testMeasureObjects.st @@ -0,0 +1,8 @@ +tests +testMeasureObjects + + | counter | + counter := ObjectStatCounter new. + + (counter measure: Any) should be: 1. + (counter measure: Any) should be: 1 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatCounterTests.class/properties.json b/ObjectStatistics-Tests.package/ObjectStatCounterTests.class/properties.json new file mode 100644 index 0000000..64727be --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatCounterTests.class/properties.json @@ -0,0 +1,11 @@ +{ + "commentStamp" : "", + "super" : "TestCase", + "category" : "ObjectStatistics-Tests", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ ], + "name" : "ObjectStatCounterTests", + "type" : "normal" +} \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatDifferentPropertiesCounterTests.class/README.md b/ObjectStatistics-Tests.package/ObjectStatDifferentPropertiesCounterTests.class/README.md new file mode 100644 index 0000000..e69de29 diff --git a/ObjectStatistics-Tests.package/ObjectStatDifferentPropertiesCounterTests.class/instance/testCreationNewMetricForDimension.st b/ObjectStatistics-Tests.package/ObjectStatDifferentPropertiesCounterTests.class/instance/testCreationNewMetricForDimension.st new file mode 100644 index 0000000..11ac2b5 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatDifferentPropertiesCounterTests.class/instance/testCreationNewMetricForDimension.st @@ -0,0 +1,10 @@ +tests +testCreationNewMetricForDimension + + | metric actual | + metric := ObjectStatDifferentPropertiesCounter for: [:o | o first]. + + actual := metric newForDimension. + + actual should beInstanceOf: metric class. + actual measuredProperties should not be: metric measuredProperties \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatDifferentPropertiesCounterTests.class/instance/testMeasureObjects.st b/ObjectStatistics-Tests.package/ObjectStatDifferentPropertiesCounterTests.class/instance/testMeasureObjects.st new file mode 100644 index 0000000..ec3de4a --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatDifferentPropertiesCounterTests.class/instance/testMeasureObjects.st @@ -0,0 +1,9 @@ +tests +testMeasureObjects + + | counter | + counter := ObjectStatDifferentPropertiesCounter for: [:o | o first] . + + (counter measure: #(#object)) should be: 1. + (counter measure: #(#object) copy) should be: 0. + (counter measure: #(#object2)) should be: 1 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatDifferentPropertiesCounterTests.class/instance/testMeasureObjectsWhenPropertyIsCollection.st b/ObjectStatistics-Tests.package/ObjectStatDifferentPropertiesCounterTests.class/instance/testMeasureObjectsWhenPropertyIsCollection.st new file mode 100644 index 0000000..c308551 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatDifferentPropertiesCounterTests.class/instance/testMeasureObjectsWhenPropertyIsCollection.st @@ -0,0 +1,8 @@ +tests +testMeasureObjectsWhenPropertyIsCollection + + | counter | + counter := ObjectStatDifferentPropertiesCounter for: [:o | o first] . + + (counter measure: #(#object)) should be: 1. + (counter measure: #(#(#object #object2 #object3)) copy) should be: 2. \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatDifferentPropertiesCounterTests.class/properties.json b/ObjectStatistics-Tests.package/ObjectStatDifferentPropertiesCounterTests.class/properties.json new file mode 100644 index 0000000..515cb0d --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatDifferentPropertiesCounterTests.class/properties.json @@ -0,0 +1,11 @@ +{ + "commentStamp" : "", + "super" : "TestCase", + "category" : "ObjectStatistics-Tests", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ ], + "name" : "ObjectStatDifferentPropertiesCounterTests", + "type" : "normal" +} \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/README.md b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/README.md new file mode 100644 index 0000000..e69de29 diff --git a/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testCheckThatMetricIsIgnored.st b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testCheckThatMetricIsIgnored.st new file mode 100644 index 0000000..a14ac17 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testCheckThatMetricIsIgnored.st @@ -0,0 +1,11 @@ +tests +testCheckThatMetricIsIgnored + + | dimension | + dimension := ObjectStatDimension new. + dimension ignoreMetrics: #('metric1Name' 'metric2Name'). + + dimension should be isIgnoreMetric: (ObjectStatMetric named: 'metric1Name'). + dimension should be isIgnoreMetric: (ObjectStatMetric named: 'metric2Name'). + + dimension should not be isIgnoreMetric: (ObjectStatMetric named: 'someOtherMetric') \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testConvertingToDimension.st b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testConvertingToDimension.st new file mode 100644 index 0000000..ca04bee --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testConvertingToDimension.st @@ -0,0 +1,7 @@ +tests +testConvertingToDimension + + | dimension | + dimension := ObjectStatDimension new. + + dimension where asObjectStatDimension should be: dimension \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testCopyForSubDimension.st b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testCopyForSubDimension.st new file mode 100644 index 0000000..44e911a --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testCopyForSubDimension.st @@ -0,0 +1,13 @@ +tests +testCopyForSubDimension + + | dimension copy | + dimension := ObjectStatDimension named: 'test dim'. + dimension slices: #currentSlices. + + copy := dimension copyForSubDimension. + + copy should beInstanceOf: ObjectStatDimension. + copy name should equal: 'test dim'. + copy slices should not be: dimension slices. + copy slices should beInstanceOf: Dictionary \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testGettingSortedSlices.st b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testGettingSortedSlices.st new file mode 100644 index 0000000..1726186 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testGettingSortedSlices.st @@ -0,0 +1,17 @@ +tests +testGettingSortedSlices + + | dimension actual stat | + stat := ObjectStatistics new. + stat countAllAs: 'strings'. + dimension := [:o | o size] asObjectStatDimension. + dimension overallStatistics: stat. + + dimension accumulateAll: #('asd' 'qwe' 'a' 'b' 'c' '1234'). + + actual := dimension sortedSlices. + + actual should haveSize: 3. + actual where first coordinate should be: 1. + actual where second coordinate should be: 3. + actual where last coordinate should be: 4. \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testHasAnyObjectsSpecByDefault.st b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testHasAnyObjectsSpecByDefault.st new file mode 100644 index 0000000..1f23814 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testHasAnyObjectsSpecByDefault.st @@ -0,0 +1,7 @@ +tests +testHasAnyObjectsSpecByDefault + + | dimension | + dimension := ObjectStatDimension new. + + (dimension objectsSpec == Any) should be: true \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testHasEmptySlicesByDefault.st b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testHasEmptySlicesByDefault.st new file mode 100644 index 0000000..f0917f0 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testHasEmptySlicesByDefault.st @@ -0,0 +1,7 @@ +tests +testHasEmptySlicesByDefault + + | dimension | + dimension := ObjectStatDimension new. + + dimension where slices should be isEmpty \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testHasEmptySubDimensionsByDefault.st b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testHasEmptySubDimensionsByDefault.st new file mode 100644 index 0000000..88f63f8 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testHasEmptySubDimensionsByDefault.st @@ -0,0 +1,7 @@ +tests +testHasEmptySubDimensionsByDefault + + | dimension | + dimension := ObjectStatDimension new. + + dimension where subDimensions should be isEmpty \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testObjectsAccumulationShouldSkipObjectsWhichNotSatisfiedSpec.st b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testObjectsAccumulationShouldSkipObjectsWhichNotSatisfiedSpec.st new file mode 100644 index 0000000..8406382 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testObjectsAccumulationShouldSkipObjectsWhichNotSatisfiedSpec.st @@ -0,0 +1,13 @@ +tests +testObjectsAccumulationShouldSkipObjectsWhichNotSatisfiedSpec + + | dimension slice | + slice := Mock new. + dimension := ObjectStatDimension by: [ :each | #sliceCoordinate ]. + dimension objectsSpec: [ :o | o ~= #object ]. + + dimension slices at: #sliceCoordinate put: slice. + + dimension accumulate: #object. + + slice should not receive accumulate: #object \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testObjectsAccumulationWhenNoSlicesExist.st b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testObjectsAccumulationWhenNoSlicesExist.st new file mode 100644 index 0000000..62309cd --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testObjectsAccumulationWhenNoSlicesExist.st @@ -0,0 +1,15 @@ +tests +testObjectsAccumulationWhenNoSlicesExist + + | dimension overallStat slice | + overallStat := Mock new. + dimension := ObjectStatDimension by: [ :each | #sliceCoordinate ]. + dimension overallStatistics: overallStat. + + dimension accumulate: #object. + + slice := dimension sliceFor: #sliceCoordinate. + slice should beInstanceOf: ObjectStatSlice. + slice coordinate should be: #sliceCoordinate. + slice statistics should beReturnedFrom: [overallStat newForDimension: dimension]. + slice statistics should receive accumulate: #object \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testObjectsAccumulationWhenSliceAlreadyExistsForIt.st b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testObjectsAccumulationWhenSliceAlreadyExistsForIt.st new file mode 100644 index 0000000..f5aa4de --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testObjectsAccumulationWhenSliceAlreadyExistsForIt.st @@ -0,0 +1,12 @@ +tests +testObjectsAccumulationWhenSliceAlreadyExistsForIt + + | dimension slice | + slice := Mock new. + dimension := ObjectStatDimension by: [ :each | #sliceCoordinate ]. + + dimension slices at: #sliceCoordinate put: slice. + + dimension accumulate: #object. + + slice should receive accumulate: #object \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testPreparingStatistics.st b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testPreparingStatistics.st new file mode 100644 index 0000000..7b04d5e --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/instance/testPreparingStatistics.st @@ -0,0 +1,15 @@ +tests +testPreparingStatistics + + | dimension | + [:subDimension1 :subDimension2 :stat | + dimension := ObjectStatDimension new. + dimension subDimensions: { subDimension1. subDimension2 }. + subDimension1 stub copyForSubDimension willReturn: #newDim1. + subDimension2 stub copyForSubDimension willReturn: #newDim2. + + dimension prepareStatistics: stat. + + stat should receive addDimension: #newDim1. + stat should receive addDimension: #newDim2. + ] runWithMocks \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/properties.json b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/properties.json new file mode 100644 index 0000000..dce4ae6 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatDimensionTests.class/properties.json @@ -0,0 +1,11 @@ +{ + "commentStamp" : "", + "super" : "TestCase", + "category" : "ObjectStatistics-Tests", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ ], + "name" : "ObjectStatDimensionTests", + "type" : "normal" +} \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatFunctionalMetricTests.class/README.md b/ObjectStatistics-Tests.package/ObjectStatFunctionalMetricTests.class/README.md new file mode 100644 index 0000000..e69de29 diff --git a/ObjectStatistics-Tests.package/ObjectStatFunctionalMetricTests.class/instance/testCreationFromBlock.st b/ObjectStatistics-Tests.package/ObjectStatFunctionalMetricTests.class/instance/testCreationFromBlock.st new file mode 100644 index 0000000..ee9f7cd --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatFunctionalMetricTests.class/instance/testCreationFromBlock.st @@ -0,0 +1,10 @@ +tests +testCreationFromBlock + + | metric block | + block := [ :o | ]. + + metric := block asObjectStatMetric. + + metric should beInstanceOf: ObjectStatFunctionMetric. + metric functionBlock should be: block \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatFunctionalMetricTests.class/instance/testMeasureObjects.st b/ObjectStatistics-Tests.package/ObjectStatFunctionalMetricTests.class/instance/testMeasureObjects.st new file mode 100644 index 0000000..ec8c99a --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatFunctionalMetricTests.class/instance/testMeasureObjects.st @@ -0,0 +1,12 @@ +tests +testMeasureObjects + + | object metric actual | + object := Mock new. + object stub someMetric willReturn: #result. + + metric := [ :o | o someMetric ] asObjectStatMetric. + + actual := metric measure: object. + + actual should be: #result. \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatFunctionalMetricTests.class/properties.json b/ObjectStatistics-Tests.package/ObjectStatFunctionalMetricTests.class/properties.json new file mode 100644 index 0000000..e16437f --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatFunctionalMetricTests.class/properties.json @@ -0,0 +1,11 @@ +{ + "commentStamp" : "", + "super" : "TestCase", + "category" : "ObjectStatistics-Tests", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ ], + "name" : "ObjectStatFunctionalMetricTests", + "type" : "normal" +} \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/README.md b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/README.md new file mode 100644 index 0000000..e69de29 diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testCheckForMeaningful.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testCheckForMeaningful.st new file mode 100644 index 0000000..3ffc56a --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testCheckForMeaningful.st @@ -0,0 +1,13 @@ +tests +testCheckForMeaningful + + | metric parent | + parent := ObjectStatMetric new. + metric := ObjectStatMetric new. + metric parent: parent. + + parent value: 10. + metric should be isMeaningful. + + parent value: 0. + metric should not be isMeaningful. \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testCheckForMeaningfulWhenParentAbsent.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testCheckForMeaningfulWhenParentAbsent.st new file mode 100644 index 0000000..65503c7 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testCheckForMeaningfulWhenParentAbsent.st @@ -0,0 +1,8 @@ +tests +testCheckForMeaningfulWhenParentAbsent + + | metric | + metric := ObjectStatMetric new. + metric parent: nil. + + metric should be isMeaningful \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testComparisonToAnotherMetric.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testComparisonToAnotherMetric.st new file mode 100644 index 0000000..991a121 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testComparisonToAnotherMetric.st @@ -0,0 +1,12 @@ +tests +testComparisonToAnotherMetric + + | metric metric2 | + metric := ObjectStatMetric new. + metric value: 2. + + metric2 := ObjectStatMetric new. + metric2 value: 3. + + metric should be < metric2. + metric2 should be > metric. \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testComputingPercentWhenNoParent.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testComputingPercentWhenNoParent.st new file mode 100644 index 0000000..2258fbb --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testComputingPercentWhenNoParent.st @@ -0,0 +1,9 @@ +tests +testComputingPercentWhenNoParent + + | metric | + metric := ObjectStatMetric new. + metric parent: nil. + metric value: Any. + + metric percentage should equal: 100 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testComputingPercentage.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testComputingPercentage.st new file mode 100644 index 0000000..c2c301d --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testComputingPercentage.st @@ -0,0 +1,11 @@ +tests +testComputingPercentage + + | metric parentMetric | + parentMetric := Mock new. + parentMetric stub value willReturn: 1000. + metric := ObjectStatMetric new. + metric parent: parentMetric. + metric value: 100. + + metric percentage should equal: 10 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testConvertingClassToMetric.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testConvertingClassToMetric.st new file mode 100644 index 0000000..29ffc76 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testConvertingClassToMetric.st @@ -0,0 +1,8 @@ +tests +testConvertingClassToMetric + + | metric | + + metric := ObjectStatMetric asObjectStatMetric. + + metric should beInstanceOf: ObjectStatMetric \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testConvertingToMetric.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testConvertingToMetric.st new file mode 100644 index 0000000..4540098 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testConvertingToMetric.st @@ -0,0 +1,8 @@ +tests +testConvertingToMetric + + | metric | + + metric := ObjectStatMetric new. + + metric where asObjectStatMetric should be: metric \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testCreationNewMetricForDimension.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testCreationNewMetricForDimension.st new file mode 100644 index 0000000..8d3a5e6 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testCreationNewMetricForDimension.st @@ -0,0 +1,15 @@ +tests +testCreationNewMetricForDimension + + | metric actual objectsSpec | + objectsSpec := Kind of: Point. + metric := ObjectStatMetric named: 'test metric'. + metric objectsSpec: objectsSpec. + + actual := metric newForDimension. + + actual should beInstanceOf: metric class. + actual name should equal: 'test metric'. + actual parent should be: metric. + actual value should be: metric defaultValue. + actual objectsSpec should be: objectsSpec \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testEqualToAnotherSimilarMetricWithEqualValue.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testEqualToAnotherSimilarMetricWithEqualValue.st new file mode 100644 index 0000000..5feb556 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testEqualToAnotherSimilarMetricWithEqualValue.st @@ -0,0 +1,11 @@ +tests +testEqualToAnotherSimilarMetricWithEqualValue + + | metric metric2 | + metric := ObjectStatMetric new. + metric value: 'value1'. + + metric2 := ObjectStatMetric new. + metric2 value: 'value1' copy. + + metric should be = metric2 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testEqualToItself.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testEqualToItself.st new file mode 100644 index 0000000..45345c3 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testEqualToItself.st @@ -0,0 +1,8 @@ +tests +testEqualToItself + + | metric | + metric := ObjectStatMetric new. + metric value: #value1. + + metric should be = metric \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testHasAnyObjectsSpecByDefault.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testHasAnyObjectsSpecByDefault.st new file mode 100644 index 0000000..b473537 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testHasAnyObjectsSpecByDefault.st @@ -0,0 +1,7 @@ +tests +testHasAnyObjectsSpecByDefault + + | metric | + metric := ObjectStatMetric new. + + (metric objectsSpec == Any) should be: true \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testHasDefaultValueByDefault.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testHasDefaultValueByDefault.st new file mode 100644 index 0000000..a51a28b --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testHasDefaultValueByDefault.st @@ -0,0 +1,7 @@ +tests +testHasDefaultValueByDefault + + | metric | + metric := ObjectStatMetric new. + + metric value should be: metric defaultValue \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testNotEqualToAnotherMetricOfDifferentClass.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testNotEqualToAnotherMetricOfDifferentClass.st new file mode 100644 index 0000000..3d16269 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testNotEqualToAnotherMetricOfDifferentClass.st @@ -0,0 +1,10 @@ +tests +testNotEqualToAnotherMetricOfDifferentClass + + | metric metric2 | + metric := ObjectStatMetric new. + metric value: 'value1'. + + metric2 := Mock new. + + metric should not be = metric2 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testNotEqualToAnotherSimilarMetricWithDifferentValue.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testNotEqualToAnotherSimilarMetricWithDifferentValue.st new file mode 100644 index 0000000..e5242a1 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testNotEqualToAnotherSimilarMetricWithDifferentValue.st @@ -0,0 +1,11 @@ +tests +testNotEqualToAnotherSimilarMetricWithDifferentValue + + | metric metric2 | + metric := ObjectStatMetric new. + metric value: 'value1'. + + metric2 := ObjectStatMetric new. + metric2 value: 'value2'. + + metric should not be = metric2 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testPrinting.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testPrinting.st new file mode 100644 index 0000000..14a2e34 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testPrinting.st @@ -0,0 +1,10 @@ +tests +testPrinting + + | metric | + metric := ObjectStatMetric new. + metric parent: ObjectStatMetric new. + metric stub percentage willReturn: 10.2356. + metric value: 1000. + + metric printString should equal: '1000 (10.24%)' \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testPrintingWhenNamedExists.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testPrintingWhenNamedExists.st new file mode 100644 index 0000000..28b5fcc --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testPrintingWhenNamedExists.st @@ -0,0 +1,10 @@ +tests +testPrintingWhenNamedExists + + | metric | + metric := ObjectStatMetric named: 'test params'. + metric parent: ObjectStatMetric new. + metric stub percentage willReturn: 10.2356. + metric value: 1000. + + metric printString should equal: '1000 test params (10.24%)' \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testPrintingWhenNoParent.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testPrintingWhenNoParent.st new file mode 100644 index 0000000..056faea --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testPrintingWhenNoParent.st @@ -0,0 +1,9 @@ +tests +testPrintingWhenNoParent + + | metric | + metric := ObjectStatMetric new. + metric parent: nil. + metric value: 1000. + + metric printString should equal: '1000' \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testResultAccumulation.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testResultAccumulation.st new file mode 100644 index 0000000..9a525e2 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testResultAccumulation.st @@ -0,0 +1,14 @@ +tests +testResultAccumulation + + | metric result | + metric := ObjectStatMetric new. + (metric stub measure: #object1) willReturn: 10. + (metric stub measure: #object2) willReturn: 20. + + metric accumulate: #object1. + metric value should be: 10. + + result := metric accumulate: #object2. + metric value should be: 30. + result should be: 30 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testResultAccumulationForCollectionOfObjects.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testResultAccumulationForCollectionOfObjects.st new file mode 100644 index 0000000..0c34f03 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testResultAccumulationForCollectionOfObjects.st @@ -0,0 +1,12 @@ +tests +testResultAccumulationForCollectionOfObjects + + | metric result | + metric := ObjectStatMetric new. + (metric stub measure: #object1) willReturn: 10. + (metric stub measure: #object2) willReturn: 20. + + result := metric accumulateAll: #(#object1 #object2). + + metric value should be: 30. + result should be: 30 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testResultAccumulationShouldSkipObjectsWhichNotMatchesSpec.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testResultAccumulationShouldSkipObjectsWhichNotMatchesSpec.st new file mode 100644 index 0000000..1086587 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testResultAccumulationShouldSkipObjectsWhichNotMatchesSpec.st @@ -0,0 +1,15 @@ +tests +testResultAccumulationShouldSkipObjectsWhichNotMatchesSpec + + | metric result | + metric := ObjectStatMetric new. + metric objectsSpec: [:o | o == #object1]. + (metric stub measure: #object1) willReturn: 10. + + metric accumulate: #object1. + metric value should be: 10. + result := metric accumulate: #object2. + metric value should be: 10. + result should be: 10. + + metric should not receive measure: #object2 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testSettingObjectsSpec.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testSettingObjectsSpec.st new file mode 100644 index 0000000..1f85974 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testSettingObjectsSpec.st @@ -0,0 +1,10 @@ +tests +testSettingObjectsSpec + + | metric spec | + + spec := Kind of: Point. + metric := ObjectStatMetric new. + metric objectsSpec: spec. + + metric objectsSpec should be: spec \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testSettingObjectsSpecByBlock.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testSettingObjectsSpecByBlock.st new file mode 100644 index 0000000..5327e76 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testSettingObjectsSpecByBlock.st @@ -0,0 +1,11 @@ +tests +testSettingObjectsSpecByBlock + + | metric block | + + block := [:n | n even]. + metric := ObjectStatMetric new. + metric objectsSpec: block. + + metric objectsSpec should beInstanceOf: SpecOfObjectStateByPredicate. + metric objectsSpec predicate should be: block \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testSettingObjectsSpecBySymbol.st b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testSettingObjectsSpecBySymbol.st new file mode 100644 index 0000000..c89edc9 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/instance/testSettingObjectsSpecBySymbol.st @@ -0,0 +1,10 @@ +tests +testSettingObjectsSpecBySymbol + + | metric | + + metric := ObjectStatMetric new. + metric objectsSpec: #even. + + metric objectsSpec should beInstanceOf: SpecOfObjectStateByPredicate. + metric objectsSpec predicate should be: #even \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/properties.json b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/properties.json new file mode 100644 index 0000000..c2e54fd --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatMetricTests.class/properties.json @@ -0,0 +1,11 @@ +{ + "commentStamp" : "", + "super" : "TestCase", + "category" : "ObjectStatistics-Tests", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ ], + "name" : "ObjectStatMetricTests", + "type" : "normal" +} \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/README.md b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/README.md new file mode 100644 index 0000000..e69de29 diff --git a/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/childCall1To..st b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/childCall1To..st new file mode 100644 index 0000000..53c6635 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/childCall1To..st @@ -0,0 +1,4 @@ +tests +childCall1To: stat + childCall1 := thisContext. + stat accumulate: childCall1 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/childCall2To..st b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/childCall2To..st new file mode 100644 index 0000000..b859ad7 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/childCall2To..st @@ -0,0 +1,4 @@ +tests +childCall2To: stat + childCall2 := thisContext. + stat accumulate: childCall2 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenChildrenShouldBeCountInParents.st b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenChildrenShouldBeCountInParents.st new file mode 100644 index 0000000..e9e1e52 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenChildrenShouldBeCountInParents.st @@ -0,0 +1,24 @@ +tests +testObjectsAccumulationWhenChildrenShouldBeCountInParents + + | slice stat stop dim | + stat := ObjectStatistics new. + stat countAllAs: 'sends'. + stop := thisContext sender sender. + dim := stat + dimension: [ :context | context ] named: 'calls' + recursionUpTo: [:context |context == stop ifTrue: [ nil ] ifFalse: [ context sender ] ]. + dim shouldCountChildrenInParentMetrics: true. + + stat accumulate: thisContext sender sender. + stat accumulate: thisContext sender. + stat accumulate: thisContext. + stat accumulate: thisContext. + + stat mainMetric value should be: 4. + slice := (stat dimensionNamed: 'calls') sliceFor: thisContext sender sender. + slice mainMetric value should be: 4. + slice := (slice dimensionNamed: 'calls') sliceFor: thisContext sender. + slice mainMetric value should be: 3. + slice := (slice dimensionNamed: 'calls') sliceFor: thisContext. + slice mainMetric value should be: 2 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenChildrenShouldNotBeCountInParents.st b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenChildrenShouldNotBeCountInParents.st new file mode 100644 index 0000000..e02d2d3 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenChildrenShouldNotBeCountInParents.st @@ -0,0 +1,24 @@ +tests +testObjectsAccumulationWhenChildrenShouldNotBeCountInParents + + | slice stat stop dim | + stat := ObjectStatistics new. + stat countAllAs: 'sends'. + stop := thisContext sender sender. + dim := stat + dimension: [ :context | context ] named: 'calls' + recursionUpTo: [:context |context == stop ifTrue: [ nil ] ifFalse: [ context sender ] ]. + dim shouldCountChildrenInParentMetrics: false. + + stat accumulate: thisContext sender sender. + stat accumulate: thisContext sender. + stat accumulate: thisContext. + stat accumulate: thisContext. + + stat mainMetric value should be: 4. + slice := (stat dimensionNamed: 'calls') sliceFor: thisContext sender sender. + slice mainMetric value should be: 1. + slice := (slice dimensionNamed: 'calls') sliceFor: thisContext sender. + slice mainMetric value should be: 1. + slice := (slice dimensionNamed: 'calls') sliceFor: thisContext. + slice mainMetric value should be: 2 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenCoordinateIsDifferentKindThanParentObjects.st b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenCoordinateIsDifferentKindThanParentObjects.st new file mode 100644 index 0000000..b94d5d9 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenCoordinateIsDifferentKindThanParentObjects.st @@ -0,0 +1,17 @@ +tests +testObjectsAccumulationWhenCoordinateIsDifferentKindThanParentObjects + + | stat dim stop | + stat := ObjectStatistics new. + stat countAllAs: 'sends'. + stop := thisContext. + dim := stat + dimension: [ :context | context receiver class ] named: 'calls' + recursionUpTo: [:context |context == stop ifTrue: [ nil ] ifFalse: [ context sender ] ]. + dim shouldCountChildrenInParentMetrics: false. + + stat accumulate: thisContext. + self childCall1To: stat. + self childCall2To: stat. + + stat mainMetric value should be: 3 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenCoordinateIsDifferentKindThanParentObjectsAndFullStack.st b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenCoordinateIsDifferentKindThanParentObjectsAndFullStack.st new file mode 100644 index 0000000..42aef12 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenCoordinateIsDifferentKindThanParentObjectsAndFullStack.st @@ -0,0 +1,19 @@ +tests +testObjectsAccumulationWhenCoordinateIsDifferentKindThanParentObjectsAndFullStack + + | stat dim stop slices | + stat := ObjectStatistics new. + stat countAllAs: 'sends'. + stop := thisContext. + dim := stat + dimension: [ :context | context receiver class ] named: 'calls' + recursionUpTo: [:context | context sender]. + dim shouldCountChildrenInParentMetrics: false. + + stat accumulate: thisContext. + self childCall1To: stat. + self childCall2To: stat. + + stat mainMetric value should be: 3. + (slices := (stat dimensionNamed: 'calls') sortedSlices) should haveSize: 1. + (slices first dimensionNamed: 'calls') sortedSlices should haveSize: 1 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenNoChildren.st b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenNoChildren.st new file mode 100644 index 0000000..de06e16 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenNoChildren.st @@ -0,0 +1,18 @@ +tests +testObjectsAccumulationWhenNoChildren + + | stat stop dim slice | + stat := ObjectStatistics new. + stat countAllAs: 'sends'. + stop := thisContext. + dim := stat + dimension: [ :context | context ] named: 'calls' + recursionUpTo: [:context |context == stop ifTrue: [ nil ] ifFalse: [ context sender ] ]. + dim shouldCountChildrenInParentMetrics: false. + + stat accumulate: thisContext. + stat accumulate: thisContext. + + stat mainMetric value should be: 2. + slice := (stat dimensionNamed: 'calls') sliceFor: thisContext. + slice mainMetric value should be: 2 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenSomeNotSatisfiedObjectSpec.st b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenSomeNotSatisfiedObjectSpec.st new file mode 100644 index 0000000..331959b --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenSomeNotSatisfiedObjectSpec.st @@ -0,0 +1,24 @@ +tests +testObjectsAccumulationWhenSomeNotSatisfiedObjectSpec + + | slice stat stop dim | + stat := ObjectStatistics new. + stat countAllAs: 'sends'. + stop := thisContext sender sender. + dim := stat + dimension: [ :context | context ] named: 'calls' + recursionUpTo: [:context |context == stop ifTrue: [ nil ] ifFalse: [ context sender ] ]. + dim objectsSpec: (Identical to: thisContext sender) not. + dim shouldCountChildrenInParentMetrics: false. + + stat accumulate: thisContext sender sender. + stat accumulate: thisContext sender. + stat accumulate: thisContext. + stat accumulate: thisContext. + + stat mainMetric value should be: 4. + slice := (stat dimensionNamed: 'calls') sliceFor: thisContext sender sender. + slice mainMetric value should be: 1. + (slice dimensionNamed: 'calls') should not be hasSliceFor: thisContext sender. + slice := (slice dimensionNamed: 'calls') sliceFor: thisContext. + slice mainMetric value should be: 2 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenSomeNotSatisfiedObjectSpecAndChildrenShouldBeCountInParentMetrics.st b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenSomeNotSatisfiedObjectSpecAndChildrenShouldBeCountInParentMetrics.st new file mode 100644 index 0000000..7584fea --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWhenSomeNotSatisfiedObjectSpecAndChildrenShouldBeCountInParentMetrics.st @@ -0,0 +1,24 @@ +tests +testObjectsAccumulationWhenSomeNotSatisfiedObjectSpecAndChildrenShouldBeCountInParentMetrics + + | slice stat stop dim | + stat := ObjectStatistics new. + stat countAllAs: 'sends'. + stop := thisContext sender sender. + dim := stat + dimension: [ :context | context ] named: 'calls' + recursionUpTo: [:context |context == stop ifTrue: [ nil ] ifFalse: [ context sender ] ]. + dim objectsSpec: (Identical to: thisContext sender) not. + dim shouldCountChildrenInParentMetrics: true. + + stat accumulate: thisContext sender sender. + stat accumulate: thisContext sender. + stat accumulate: thisContext. + stat accumulate: thisContext. + + stat mainMetric value should be: 4. + slice := (stat dimensionNamed: 'calls') sliceFor: thisContext sender sender. + slice mainMetric value should be: 3. + (slice dimensionNamed: 'calls') should not be hasSliceFor: thisContext sender. + slice := (slice dimensionNamed: 'calls') sliceFor: thisContext. + slice mainMetric value should be: 2 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWithFullStackRecursion.st b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWithFullStackRecursion.st new file mode 100644 index 0000000..b7ccb2f --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testObjectsAccumulationWithFullStackRecursion.st @@ -0,0 +1,16 @@ +tests +testObjectsAccumulationWithFullStackRecursion + + | stat dim | + stat := ObjectStatistics new. + stat countAllAs: 'sends'. + dim := stat + dimension: [ :context | context ] named: 'calls' + recursionUpTo: [:context | context sender ]. + + stat accumulate: thisContext sender sender. + stat accumulate: thisContext sender. + stat accumulate: thisContext. + stat accumulate: thisContext. + + stat mainMetric value should be: 4 \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testShouldNotCountChildrenInParentMetricsByDefault.st b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testShouldNotCountChildrenInParentMetricsByDefault.st new file mode 100644 index 0000000..a8bba0a --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/instance/testShouldNotCountChildrenInParentMetricsByDefault.st @@ -0,0 +1,7 @@ +tests +testShouldNotCountChildrenInParentMetricsByDefault + + | dimension | + dimension := ObjectStatRecursiveDimension new. + + dimension should not be shouldCountChildrenInParentMetrics \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/properties.json b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/properties.json new file mode 100644 index 0000000..3688691 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatRecursiveDimensionTests.class/properties.json @@ -0,0 +1,14 @@ +{ + "commentStamp" : "", + "super" : "TestCase", + "category" : "ObjectStatistics-Tests", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ + "childCall1", + "childCall2" + ], + "name" : "ObjectStatRecursiveDimensionTests", + "type" : "normal" +} \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/README.md b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/README.md new file mode 100644 index 0000000..e69de29 diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAccumulationAllObjects.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAccumulationAllObjects.st new file mode 100644 index 0000000..9aa0420 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAccumulationAllObjects.st @@ -0,0 +1,15 @@ +tests +testAccumulationAllObjects + + | stat | + [:metric1 :metric2 | + stat := ObjectStatistics new. + stat metrics: { metric1. metric2 }. + + stat accumulateAll: #(#object1 #object2). + + [ metric1 accumulate: #object1. + metric2 accumulate: #object1. + metric1 accumulate: #object2. + metric2 accumulate: #object2 ] should beDone + ] runWithMocks \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAccumulationObjects.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAccumulationObjects.st new file mode 100644 index 0000000..2db1954 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAccumulationObjects.st @@ -0,0 +1,16 @@ +tests +testAccumulationObjects + + | stat | + [:metric1 :metric2 :dimension1 :dimension2 | + stat := ObjectStatistics new. + stat metrics: { metric1. metric2 }. + stat dimensions: { dimension1. dimension2 }. + + stat accumulate: #object. + + [ metric1 accumulate: #object. + metric2 accumulate: #object. + dimension1 accumulate: #object. + dimension2 accumulate: #object ] should beDone + ] runWithMocks \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddNewDimension.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddNewDimension.st new file mode 100644 index 0000000..9e38f4a --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddNewDimension.st @@ -0,0 +1,11 @@ +tests +testAddNewDimension + + | dimension actual stat | + dimension := Mock new. + stat := ObjectStatistics new. + stat addDimension: dimension. + + actual := stat dimensions first. + actual should beReturnedFrom: [ dimension asObjectStatDimension ]. + actual should receive overallStatistics: stat \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddNewDimensionByBlock.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddNewDimensionByBlock.st new file mode 100644 index 0000000..3188837 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddNewDimensionByBlock.st @@ -0,0 +1,11 @@ +tests +testAddNewDimensionByBlock + + | stat actual block | + block := [:o | o class]. + stat := ObjectStatistics new. + stat addDimension: block. + + actual := stat dimensions first. + actual should beInstanceOf: ObjectStatDimension. + actual where coordinatesBlock should be: block \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddNewDimensionWithName.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddNewDimensionWithName.st new file mode 100644 index 0000000..f085957 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddNewDimensionWithName.st @@ -0,0 +1,12 @@ +tests +testAddNewDimensionWithName + + | dimension stat actual result | + dimension := Mock new. + stat := ObjectStatistics new. + result := stat dimension: dimension named: 'test dimension'. + + actual := stat dimensions first. + actual should receive name: 'test dimension'. + result should be: actual + \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddNewMetric.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddNewMetric.st new file mode 100644 index 0000000..e9ed3d2 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddNewMetric.st @@ -0,0 +1,11 @@ +tests +testAddNewMetric + + | metric actual stat returned | + metric := Mock new. + stat := ObjectStatistics new. + returned := stat addMetric: metric. + + actual := stat metrics first. + actual should beReturnedFrom: [ metric asObjectStatMetric ]. + actual should be: returned \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddNewMetricByBlock.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddNewMetricByBlock.st new file mode 100644 index 0000000..2a60bac --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddNewMetricByBlock.st @@ -0,0 +1,11 @@ +tests +testAddNewMetricByBlock + + | stat actual block | + block := [:o | 2]. + stat := ObjectStatistics new. + stat addMetric: block. + + actual := stat metrics first. + actual should beInstanceOf: ObjectStatFunctionMetric. + actual where functionBlock should be: block \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddNewMetricWithName.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddNewMetricWithName.st new file mode 100644 index 0000000..5d8e375 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddNewMetricWithName.st @@ -0,0 +1,12 @@ +tests +testAddNewMetricWithName + + | metric stat actual returned | + metric := Mock new. + stat := ObjectStatistics new. + returned := stat addMetric: metric named: 'test dimension'. + + actual := stat metrics first. + actual should receive name: 'test dimension'. + returned should be: actual + \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingCounterMetric.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingCounterMetric.st new file mode 100644 index 0000000..0a535c1 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingCounterMetric.st @@ -0,0 +1,12 @@ +tests +testAddingCounterMetric + + | stat actual | + stat := ObjectStatistics new. + + stat countAllAs: 'objects name'. + + actual := stat metrics first. + actual should beInstanceOf: ObjectStatCounter. + actual name should equal: 'objects name' + \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingCounterMetricForSetOfObjects.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingCounterMetricForSetOfObjects.st new file mode 100644 index 0000000..896062d --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingCounterMetricForSetOfObjects.st @@ -0,0 +1,13 @@ +tests +testAddingCounterMetricForSetOfObjects + + | stat actual | + stat := ObjectStatistics new. + + stat countAllSuch: [:number | number even ] as: 'objects name'. + + actual := stat metrics first. + actual should beInstanceOf: ObjectStatCounter. + actual name should equal: 'objects name'. + actual objectsSpec should beInstanceOf: SpecOfObjectStateByPredicate + \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingDifferentPropertiesCountMetric.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingDifferentPropertiesCountMetric.st new file mode 100644 index 0000000..f647a4e --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingDifferentPropertiesCountMetric.st @@ -0,0 +1,12 @@ +tests +testAddingDifferentPropertiesCountMetric + + | stat actual | + stat := ObjectStatistics new. + + stat countDifferent: [ :o | o class ] as: 'classes'. + + actual := stat metrics first. + actual should beInstanceOf: ObjectStatDifferentPropertiesCounter. + actual name should equal: 'classes' + \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingDifferentPropertiesCountMetricForSetOfObjects.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingDifferentPropertiesCountMetricForSetOfObjects.st new file mode 100644 index 0000000..94967be --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingDifferentPropertiesCountMetricForSetOfObjects.st @@ -0,0 +1,13 @@ +tests +testAddingDifferentPropertiesCountMetricForSetOfObjects + + | stat actual objectsSpec | + stat := ObjectStatistics new. + objectsSpec := Kind of: Rectangle. + stat countDifferent: [ :o | o class ] as: 'classes' for: objectsSpec. + + actual := stat metrics first. + actual should beInstanceOf: ObjectStatDifferentPropertiesCounter. + actual name should equal: 'classes'. + actual objectsSpec should be: objectsSpec. + \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingDimensionWithIgnoreMetricsByFluentAPI.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingDimensionWithIgnoreMetricsByFluentAPI.st new file mode 100644 index 0000000..20af3f7 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingDimensionWithIgnoreMetricsByFluentAPI.st @@ -0,0 +1,14 @@ +tests +testAddingDimensionWithIgnoreMetricsByFluentAPI + + | stat dimension | + dimension := ObjectStatDimension new. + + stat := ObjectStatistics new. + + stat + dimension: dimension named: 'dim1'; + with: [ stat ignoreMetrics: #ignoredMetricNames]. + + stat dimensions where first should be: dimension. + stat dimensions where first ignoreMetricNames should be: #ignoredMetricNames \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingDimensionsForSetOfObjectsByFluentAPI.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingDimensionsForSetOfObjectsByFluentAPI.st new file mode 100644 index 0000000..d2cf2dd --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingDimensionsForSetOfObjectsByFluentAPI.st @@ -0,0 +1,18 @@ +tests +testAddingDimensionsForSetOfObjectsByFluentAPI + + | stat dimension subDimension objectsSpec | + dimension := ObjectStatDimension new. + subDimension := ObjectStatDimension new. + objectsSpec := Kind of: Point. + + stat := ObjectStatistics new. + stat + dimension: dimension named: 'dim1'; + for: objectsSpec with: [ + stat dimension: subDimension named: 'dim2']. + + stat dimensions should haveSize: 1. + stat dimensions where first should be: dimension. + stat dimensions where first subDimensions first should be: subDimension. + subDimension objectsSpec should be: objectsSpec \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingDimensionsTreeByFluentAPI.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingDimensionsTreeByFluentAPI.st new file mode 100644 index 0000000..d7fecfa --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingDimensionsTreeByFluentAPI.st @@ -0,0 +1,23 @@ +tests +testAddingDimensionsTreeByFluentAPI + + | stat dimension1 dimension2 dimension3 dimension4 | + dimension1 := ObjectStatDimension new. + dimension2 := ObjectStatDimension new. + dimension3 := ObjectStatDimension new. + dimension4 := ObjectStatDimension new. + + stat := ObjectStatistics new. + + stat + dimension: dimension1 named: 'dim1'; + with: [ + stat + dimension: dimension2 named: 'dim2'; + dimension: dimension3 named: 'dim3' ]; + dimension: dimension4 named: 'dim4'. + + stat dimensions where first should be: dimension1. + stat dimensions where last should be: dimension4. + stat dimensions where first subDimensions first should be: dimension2. + stat dimensions where first subDimensions last should be: dimension3. \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingFunctionCountMetric.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingFunctionCountMetric.st new file mode 100644 index 0000000..9cb6d29 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingFunctionCountMetric.st @@ -0,0 +1,12 @@ +tests +testAddingFunctionCountMetric + + | stat actual | + stat := ObjectStatistics new. + + stat countFunction: [ :o | o count: #isVowel ] as: 'vowels'. + + actual := stat metrics first. + actual should beInstanceOf: ObjectStatFunctionMetric. + actual name should equal: 'vowels' + \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingRecursiveDimension.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingRecursiveDimension.st new file mode 100644 index 0000000..4ab0371 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testAddingRecursiveDimension.st @@ -0,0 +1,13 @@ +tests +testAddingRecursiveDimension + + | stat dimension | + stat := ObjectStatistics new. + stat dimension: #coordinatesBlock named: 'dim1' recursionUpTo: #parentPropertyBlock. + + stat dimensions should haveSize: 1. + dimension := stat dimensions first. + dimension should beInstanceOf: ObjectStatRecursiveDimension. + dimension coordinatesBlock should be: #coordinatesBlock. + dimension parentRecursionBlock should be: #parentPropertyBlock. + dimension name should equal: 'dim1' \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testCreationNewStatForDimension.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testCreationNewStatForDimension.st new file mode 100644 index 0000000..bea2436 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testCreationNewStatForDimension.st @@ -0,0 +1,18 @@ +tests +testCreationNewStatForDimension + + | stat actual | + [:metric1 :metric2 :dimension | + stat := ObjectStatistics new. + stat metrics: { metric1. metric2 }. + stat dimensions: #currentDimensions. + + actual := stat newForDimension: dimension. + + actual should beInstanceOf: ObjectStatistics. + dimension should receive prepareStatistics: actual. + actual metrics should haveSize: 2. + actual metrics first should beReturnedFrom: [ metric1 newForDimension ]. + actual metrics last should beReturnedFrom: [ metric2 newForDimension ] + + ] runWithMocks \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testCreationNewStatForDimensionShouldNotAddIgnoredMetrics.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testCreationNewStatForDimensionShouldNotAddIgnoredMetrics.st new file mode 100644 index 0000000..25a23f2 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testCreationNewStatForDimensionShouldNotAddIgnoredMetrics.st @@ -0,0 +1,19 @@ +tests +testCreationNewStatForDimensionShouldNotAddIgnoredMetrics + + | stat actual | + [:metric1 :metric2 :dimension | + stat := ObjectStatistics new. + stat metrics: { metric1. metric2 }. + stat dimensions: #currentDimensions. + (dimension stub isIgnoreMetric: metric2) willReturn: true. + + actual := stat newForDimension: dimension. + + actual should beInstanceOf: ObjectStatistics. + dimension should receive prepareStatistics: actual. + actual metrics should haveSize: 1. + actual metrics first should beReturnedFrom: [ metric1 newForDimension ]. + metric2 should not receive newForDimension. + + ] runWithMocks \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testHasEmptyDimensionsByDefault.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testHasEmptyDimensionsByDefault.st new file mode 100644 index 0000000..8ede6c3 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testHasEmptyDimensionsByDefault.st @@ -0,0 +1,7 @@ +tests +testHasEmptyDimensionsByDefault + + | stat | + stat := ObjectStatistics new. + + stat where dimensions should be isEmpty \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testHasEmptyMetricsByDefault.st b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testHasEmptyMetricsByDefault.st new file mode 100644 index 0000000..eeb23fc --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/instance/testHasEmptyMetricsByDefault.st @@ -0,0 +1,7 @@ +tests +testHasEmptyMetricsByDefault + + | stat | + stat := ObjectStatistics new. + + stat where metrics should be isEmpty \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/properties.json b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/properties.json new file mode 100644 index 0000000..40573f3 --- /dev/null +++ b/ObjectStatistics-Tests.package/ObjectStatisticsTests.class/properties.json @@ -0,0 +1,11 @@ +{ + "commentStamp" : "", + "super" : "TestCase", + "category" : "ObjectStatistics-Tests", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ ], + "name" : "ObjectStatisticsTests", + "type" : "normal" +} \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/monticello.meta/categories.st b/ObjectStatistics-Tests.package/monticello.meta/categories.st new file mode 100644 index 0000000..3d62fef --- /dev/null +++ b/ObjectStatistics-Tests.package/monticello.meta/categories.st @@ -0,0 +1 @@ +SystemOrganization addCategory: #'ObjectStatistics-Tests'! diff --git a/ObjectStatistics-Tests.package/monticello.meta/initializers.st b/ObjectStatistics-Tests.package/monticello.meta/initializers.st new file mode 100644 index 0000000..e69de29 diff --git a/ObjectStatistics-Tests.package/monticello.meta/package b/ObjectStatistics-Tests.package/monticello.meta/package new file mode 100644 index 0000000..b1383bf --- /dev/null +++ b/ObjectStatistics-Tests.package/monticello.meta/package @@ -0,0 +1 @@ +(name 'ObjectStatistics-Tests') \ No newline at end of file diff --git a/ObjectStatistics-Tests.package/properties.json b/ObjectStatistics-Tests.package/properties.json new file mode 100644 index 0000000..6f31cf5 --- /dev/null +++ b/ObjectStatistics-Tests.package/properties.json @@ -0,0 +1 @@ +{ } \ No newline at end of file diff --git a/ObjectStatistics.package/.filetree b/ObjectStatistics.package/.filetree new file mode 100644 index 0000000..57a6797 --- /dev/null +++ b/ObjectStatistics.package/.filetree @@ -0,0 +1,5 @@ +{ + "separateMethodMetaAndSource" : false, + "noMethodMetaData" : true, + "useCypressPropertiesFile" : true +} \ No newline at end of file diff --git a/ObjectStatistics.package/BlockClosure.extension/instance/asObjectStatDimension.st b/ObjectStatistics.package/BlockClosure.extension/instance/asObjectStatDimension.st new file mode 100644 index 0000000..945e6c9 --- /dev/null +++ b/ObjectStatistics.package/BlockClosure.extension/instance/asObjectStatDimension.st @@ -0,0 +1,3 @@ +*ObjectStatistics +asObjectStatDimension + ^ObjectStatDimension by: self \ No newline at end of file diff --git a/ObjectStatistics.package/BlockClosure.extension/instance/asObjectStatMetric.st b/ObjectStatistics.package/BlockClosure.extension/instance/asObjectStatMetric.st new file mode 100644 index 0000000..108de00 --- /dev/null +++ b/ObjectStatistics.package/BlockClosure.extension/instance/asObjectStatMetric.st @@ -0,0 +1,3 @@ +*ObjectStatistics +asObjectStatMetric + ^ObjectStatFunctionMetric by: self \ No newline at end of file diff --git a/ObjectStatistics.package/BlockClosure.extension/properties.json b/ObjectStatistics.package/BlockClosure.extension/properties.json new file mode 100644 index 0000000..2190e5e --- /dev/null +++ b/ObjectStatistics.package/BlockClosure.extension/properties.json @@ -0,0 +1,3 @@ +{ + "name" : "BlockClosure" +} \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatBuilder.class/README.md b/ObjectStatistics.package/ObjectStatBuilder.class/README.md new file mode 100644 index 0000000..158795a --- /dev/null +++ b/ObjectStatistics.package/ObjectStatBuilder.class/README.md @@ -0,0 +1,7 @@ +I am helper objects to define statistics dimensions tree by fluent api. + +Internal Representation and Key Implementation Points. + + Instance Variables + dimensions: + objectsSpec: \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatBuilder.class/class/for..st b/ObjectStatistics.package/ObjectStatBuilder.class/class/for..st new file mode 100644 index 0000000..e8f79f5 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatBuilder.class/class/for..st @@ -0,0 +1,7 @@ +instance creation +for: anObjectStatistics + + | builder | + builder := self new. + builder statistics: anObjectStatistics. + ^builder \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatBuilder.class/instance/addDimension..st b/ObjectStatistics.package/ObjectStatBuilder.class/instance/addDimension..st new file mode 100644 index 0000000..b1503ce --- /dev/null +++ b/ObjectStatistics.package/ObjectStatBuilder.class/instance/addDimension..st @@ -0,0 +1,6 @@ +accessing +addDimension: anObjectStatDimension + | dimension | + dimension := self currentDimension addDimension: anObjectStatDimension. + dimension objectsSpec: objectsSpec. + ^dimension \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatBuilder.class/instance/buildDimensionsBy..st b/ObjectStatistics.package/ObjectStatBuilder.class/instance/buildDimensionsBy..st new file mode 100644 index 0000000..3639325 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatBuilder.class/instance/buildDimensionsBy..st @@ -0,0 +1,6 @@ +building +buildDimensionsBy: aBlock + + self buildLastDimension. + aBlock value. + self buildPreviousDimension \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatBuilder.class/instance/buildLastDimension.st b/ObjectStatistics.package/ObjectStatBuilder.class/instance/buildLastDimension.st new file mode 100644 index 0000000..16726f8 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatBuilder.class/instance/buildLastDimension.st @@ -0,0 +1,4 @@ +building +buildLastDimension + + dimensions add: self currentDimension lastDimension \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatBuilder.class/instance/buildPreviousDimension.st b/ObjectStatistics.package/ObjectStatBuilder.class/instance/buildPreviousDimension.st new file mode 100644 index 0000000..24d64ee --- /dev/null +++ b/ObjectStatistics.package/ObjectStatBuilder.class/instance/buildPreviousDimension.st @@ -0,0 +1,4 @@ +building +buildPreviousDimension + + dimensions removeLast \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatBuilder.class/instance/currentDimension.st b/ObjectStatistics.package/ObjectStatBuilder.class/instance/currentDimension.st new file mode 100644 index 0000000..b739eef --- /dev/null +++ b/ObjectStatistics.package/ObjectStatBuilder.class/instance/currentDimension.st @@ -0,0 +1,3 @@ +accessing +currentDimension + ^dimensions last \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatBuilder.class/instance/dimensions..st b/ObjectStatistics.package/ObjectStatBuilder.class/instance/dimensions..st new file mode 100644 index 0000000..d496295 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatBuilder.class/instance/dimensions..st @@ -0,0 +1,3 @@ +accessing +dimensions: anObject + dimensions := anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatBuilder.class/instance/dimensions.st b/ObjectStatistics.package/ObjectStatBuilder.class/instance/dimensions.st new file mode 100644 index 0000000..a855475 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatBuilder.class/instance/dimensions.st @@ -0,0 +1,3 @@ +accessing +dimensions + ^ dimensions \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatBuilder.class/instance/for.buildDimensionsBy..st b/ObjectStatistics.package/ObjectStatBuilder.class/instance/for.buildDimensionsBy..st new file mode 100644 index 0000000..db2d86a --- /dev/null +++ b/ObjectStatistics.package/ObjectStatBuilder.class/instance/for.buildDimensionsBy..st @@ -0,0 +1,8 @@ +building +for: aStateSpec buildDimensionsBy: aBlock + + | currentObjectsSpec | + currentObjectsSpec := objectsSpec. + objectsSpec := aStateSpec. + self buildDimensionsBy: aBlock. + objectsSpec := currentObjectsSpec \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatBuilder.class/instance/ignoreMetrics..st b/ObjectStatistics.package/ObjectStatBuilder.class/instance/ignoreMetrics..st new file mode 100644 index 0000000..5a9544d --- /dev/null +++ b/ObjectStatistics.package/ObjectStatBuilder.class/instance/ignoreMetrics..st @@ -0,0 +1,3 @@ +accessing +ignoreMetrics: metricNames + self currentDimension ignoreMetrics: metricNames \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatBuilder.class/instance/initialize.st b/ObjectStatistics.package/ObjectStatBuilder.class/instance/initialize.st new file mode 100644 index 0000000..b971e06 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatBuilder.class/instance/initialize.st @@ -0,0 +1,5 @@ +initialization +initialize + super initialize. + + objectsSpec := Any \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatBuilder.class/instance/objectsSpec..st b/ObjectStatistics.package/ObjectStatBuilder.class/instance/objectsSpec..st new file mode 100644 index 0000000..adfc7ba --- /dev/null +++ b/ObjectStatistics.package/ObjectStatBuilder.class/instance/objectsSpec..st @@ -0,0 +1,3 @@ +accessing +objectsSpec: anObject + objectsSpec := anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatBuilder.class/instance/objectsSpec.st b/ObjectStatistics.package/ObjectStatBuilder.class/instance/objectsSpec.st new file mode 100644 index 0000000..d2f1104 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatBuilder.class/instance/objectsSpec.st @@ -0,0 +1,3 @@ +accessing +objectsSpec + ^ objectsSpec \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatBuilder.class/instance/statistics..st b/ObjectStatistics.package/ObjectStatBuilder.class/instance/statistics..st new file mode 100644 index 0000000..cb884cf --- /dev/null +++ b/ObjectStatistics.package/ObjectStatBuilder.class/instance/statistics..st @@ -0,0 +1,3 @@ +accessing +statistics: anObjectStatistics + dimensions := OrderedCollection with: anObjectStatistics \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatBuilder.class/properties.json b/ObjectStatistics.package/ObjectStatBuilder.class/properties.json new file mode 100644 index 0000000..51f7c4d --- /dev/null +++ b/ObjectStatistics.package/ObjectStatBuilder.class/properties.json @@ -0,0 +1,14 @@ +{ + "commentStamp" : "DenisKudryashov 6/1/2016 16:45", + "super" : "Object", + "category" : "ObjectStatistics", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ + "dimensions", + "objectsSpec" + ], + "name" : "ObjectStatBuilder", + "type" : "normal" +} \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatCounter.class/README.md b/ObjectStatistics.package/ObjectStatCounter.class/README.md new file mode 100644 index 0000000..26b0e24 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatCounter.class/README.md @@ -0,0 +1 @@ +I am metric which count all objects \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatCounter.class/instance/measure..st b/ObjectStatistics.package/ObjectStatCounter.class/instance/measure..st new file mode 100644 index 0000000..d2bf91f --- /dev/null +++ b/ObjectStatistics.package/ObjectStatCounter.class/instance/measure..st @@ -0,0 +1,3 @@ +measuring +measure: anObject + ^1 \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatCounter.class/properties.json b/ObjectStatistics.package/ObjectStatCounter.class/properties.json new file mode 100644 index 0000000..f1efd6e --- /dev/null +++ b/ObjectStatistics.package/ObjectStatCounter.class/properties.json @@ -0,0 +1,11 @@ +{ + "commentStamp" : "DenisKudryashov 6/1/2016 16:17", + "super" : "ObjectStatMetric", + "category" : "ObjectStatistics", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ ], + "name" : "ObjectStatCounter", + "type" : "normal" +} \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/README.md b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/README.md new file mode 100644 index 0000000..9442976 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/README.md @@ -0,0 +1,8 @@ +I am metric which count how many different properties objects have. +For example I could be used to count receivers of messages set. + +Internal Representation and Key Implementation Points. + + Instance Variables + measuredProperties: + propertyBlock: diff --git a/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/class/for..st b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/class/for..st new file mode 100644 index 0000000..71fd3f7 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/class/for..st @@ -0,0 +1,4 @@ +instance creation +for: aBlockClosure + ^self new + propertyBlock: aBlockClosure \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/initialize.st b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/initialize.st new file mode 100644 index 0000000..b29a62b --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/initialize.st @@ -0,0 +1,5 @@ +initialization +initialize + super initialize. + + measuredProperties := IdentitySet new \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/measure..st b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/measure..st new file mode 100644 index 0000000..cd52eb3 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/measure..st @@ -0,0 +1,11 @@ +measuring +measure: anObject + | currentSize propertyValue | + currentSize := measuredProperties size. + + propertyValue := propertyBlock value: anObject. + propertyValue isArray + ifTrue: [ measuredProperties addAll: propertyValue ] + ifFalse: [ measuredProperties add: propertyValue]. + + ^measuredProperties size - currentSize \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/measuredProperties..st b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/measuredProperties..st new file mode 100644 index 0000000..a5697b2 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/measuredProperties..st @@ -0,0 +1,3 @@ +accessing +measuredProperties: anObject + measuredProperties := anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/measuredProperties.st b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/measuredProperties.st new file mode 100644 index 0000000..ebb4694 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/measuredProperties.st @@ -0,0 +1,3 @@ +accessing +measuredProperties + ^ measuredProperties \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/prepareForDimensionOf..st b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/prepareForDimensionOf..st new file mode 100644 index 0000000..20f35ea --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/prepareForDimensionOf..st @@ -0,0 +1,6 @@ +accessing +prepareForDimensionOf: anObjectStatDimension + super prepareForDimensionOf: anObjectStatDimension. + + measuredProperties := IdentitySet new + \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/propertyBlock..st b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/propertyBlock..st new file mode 100644 index 0000000..ae9ac09 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/propertyBlock..st @@ -0,0 +1,3 @@ +accessing +propertyBlock: anObject + propertyBlock := anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/propertyBlock.st b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/propertyBlock.st new file mode 100644 index 0000000..d500481 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/instance/propertyBlock.st @@ -0,0 +1,3 @@ +accessing +propertyBlock + ^ propertyBlock \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/properties.json b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/properties.json new file mode 100644 index 0000000..384ef83 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDifferentPropertiesCounter.class/properties.json @@ -0,0 +1,14 @@ +{ + "commentStamp" : "DenisKudryashov 6/1/2016 16:19", + "super" : "ObjectStatMetric", + "category" : "ObjectStatistics", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ + "measuredProperties", + "propertyBlock" + ], + "name" : "ObjectStatDifferentPropertiesCounter", + "type" : "normal" +} \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/README.md b/ObjectStatistics.package/ObjectStatDimension.class/README.md new file mode 100644 index 0000000..901a859 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/README.md @@ -0,0 +1,30 @@ +I represent dimension in space of objects. +You can think about me as dimension of object classes, dimension of object packages and etc. + +During statistics accumulation I receive measured objects. For every object I retrive concrete coordinate in object space. It calculated by my coordinatesBlock. In this coordinate I create new statistics and add given object into it. Coordinate value and statistics are incapsulated in ObjectStatSlice instance. At the end of objects analysis I contain set of slices where each slice includes own statistics in particular dimension coordinate. + +I have own sub dimensions which play same role as dimensions inside statistics. Each statistics in my slices will include my sub dimensions. +It allows to define hierarchy of dimension for statistics analysis. + +I have also objectsSpec which specified set of objects which could be accumulated by me. It allows to define dimensions for subset of objects space. + +For more information look at ObjectStatistics comment. + +Public API and Key Messages + +- accumulate: anObject +it adds given object into statistics which defined for corresponding coordinate in objects space + +- accumulateAll: aCollection +it accumulates all collection items + +Internal Representation and Key Implementation Points. + + Instance Variables + ignoreMetricNames: > + name: + objectsSpec: + overallStatistics: + slices: > + coordinatesBlock: + subDimensions: > \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/class/by..st b/ObjectStatistics.package/ObjectStatDimension.class/class/by..st new file mode 100644 index 0000000..b1a5a68 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/class/by..st @@ -0,0 +1,4 @@ +instance creation +by: aBlockClosure + ^self new + coordinatesBlock: aBlockClosure \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/class/named..st b/ObjectStatistics.package/ObjectStatDimension.class/class/named..st new file mode 100644 index 0000000..1c93667 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/class/named..st @@ -0,0 +1,4 @@ +instance creation +named: aString + ^self new + name: aString \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/class/of..st b/ObjectStatistics.package/ObjectStatDimension.class/class/of..st new file mode 100644 index 0000000..28d45d7 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/class/of..st @@ -0,0 +1,4 @@ +instance creation +of: anObjectStatistics + ^self new + overallStatistics: anObjectStatistics \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/accumulate..st b/ObjectStatistics.package/ObjectStatDimension.class/instance/accumulate..st new file mode 100644 index 0000000..4bfef25 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/accumulate..st @@ -0,0 +1,9 @@ +measuring +accumulate: anObject + + | slice | + (objectsSpec matches: anObject) ifFalse: [ ^self ]. + + slice := self sliceFor: anObject. + + slice accumulate: anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/accumulateAll..st b/ObjectStatistics.package/ObjectStatDimension.class/instance/accumulateAll..st new file mode 100644 index 0000000..d35c36d --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/accumulateAll..st @@ -0,0 +1,4 @@ +measuring +accumulateAll: aCollection + + ^aCollection do: [ :each | self accumulate: each ] \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/addDimension..st b/ObjectStatistics.package/ObjectStatDimension.class/instance/addDimension..st new file mode 100644 index 0000000..a5184ce --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/addDimension..st @@ -0,0 +1,5 @@ +accessing +addDimension: anObjectStatDimension + + subDimensions add: anObjectStatDimension. + ^anObjectStatDimension \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/asObjectStatDimension.st b/ObjectStatistics.package/ObjectStatDimension.class/instance/asObjectStatDimension.st new file mode 100644 index 0000000..3bbc5df --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/asObjectStatDimension.st @@ -0,0 +1,3 @@ +converting +asObjectStatDimension + ^self \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/coordinateFor..st b/ObjectStatistics.package/ObjectStatDimension.class/instance/coordinateFor..st new file mode 100644 index 0000000..65adf72 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/coordinateFor..st @@ -0,0 +1,3 @@ +measuring +coordinateFor: anObject + ^coordinatesBlock value: anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/coordinatesBlock..st b/ObjectStatistics.package/ObjectStatDimension.class/instance/coordinatesBlock..st new file mode 100644 index 0000000..f253ad3 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/coordinatesBlock..st @@ -0,0 +1,3 @@ +accessing +coordinatesBlock: anObject + coordinatesBlock := anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/coordinatesBlock.st b/ObjectStatistics.package/ObjectStatDimension.class/instance/coordinatesBlock.st new file mode 100644 index 0000000..c9e9144 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/coordinatesBlock.st @@ -0,0 +1,3 @@ +accessing +coordinatesBlock + ^ coordinatesBlock \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/copyForSubDimension.st b/ObjectStatistics.package/ObjectStatDimension.class/instance/copyForSubDimension.st new file mode 100644 index 0000000..14a222d --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/copyForSubDimension.st @@ -0,0 +1,7 @@ +accessing +copyForSubDimension + + | copy | + copy := self copy. + copy slices: Dictionary new. + ^copy \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/dimension.named..st b/ObjectStatistics.package/ObjectStatDimension.class/instance/dimension.named..st new file mode 100644 index 0000000..6bc127c --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/dimension.named..st @@ -0,0 +1,10 @@ +accessing +dimension: aDimensionOrBlock named: aString + + | dimension | + dimension := aDimensionOrBlock asObjectStatDimension. + dimension name: aString. + + subDimensions add: dimension. + ^dimension + \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/hasSliceFor..st b/ObjectStatistics.package/ObjectStatDimension.class/instance/hasSliceFor..st new file mode 100644 index 0000000..ebe4838 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/hasSliceFor..st @@ -0,0 +1,7 @@ +testing +hasSliceFor: anObject + + | coordinateObject | + coordinateObject := self coordinateFor: anObject. + + ^slices includesKey: coordinateObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/ignoreMetricNames.st b/ObjectStatistics.package/ObjectStatDimension.class/instance/ignoreMetricNames.st new file mode 100644 index 0000000..0566dc6 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/ignoreMetricNames.st @@ -0,0 +1,3 @@ +accessing +ignoreMetricNames + ^ignoreMetricNames \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/ignoreMetrics..st b/ObjectStatistics.package/ObjectStatDimension.class/instance/ignoreMetrics..st new file mode 100644 index 0000000..5a3fac1 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/ignoreMetrics..st @@ -0,0 +1,3 @@ +accessing +ignoreMetrics: metricNames + ignoreMetricNames := metricNames \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/initialize.st b/ObjectStatistics.package/ObjectStatDimension.class/instance/initialize.st new file mode 100644 index 0000000..e872d26 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/initialize.st @@ -0,0 +1,8 @@ +initialization +initialize + super initialize. + + slices := Dictionary new. + subDimensions := OrderedCollection new. + ignoreMetricNames := Array empty. + objectsSpec := Any \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/isEmpty.st b/ObjectStatistics.package/ObjectStatDimension.class/instance/isEmpty.st new file mode 100644 index 0000000..65b3426 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/isEmpty.st @@ -0,0 +1,3 @@ +testing +isEmpty + ^slices isEmpty \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/isIgnoreMetric..st b/ObjectStatistics.package/ObjectStatDimension.class/instance/isIgnoreMetric..st new file mode 100644 index 0000000..a9115b8 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/isIgnoreMetric..st @@ -0,0 +1,3 @@ +testing +isIgnoreMetric: anObjectStatMetric + ^ignoreMetricNames includes: anObjectStatMetric name \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/lastDimension.st b/ObjectStatistics.package/ObjectStatDimension.class/instance/lastDimension.st new file mode 100644 index 0000000..ba2e921 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/lastDimension.st @@ -0,0 +1,3 @@ +accessing +lastDimension + ^subDimensions last \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/name..st b/ObjectStatistics.package/ObjectStatDimension.class/instance/name..st new file mode 100644 index 0000000..5a27110 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/name..st @@ -0,0 +1,3 @@ +accessing +name: anObject + name := anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/name.st b/ObjectStatistics.package/ObjectStatDimension.class/instance/name.st new file mode 100644 index 0000000..22077c2 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/name.st @@ -0,0 +1,3 @@ +accessing +name + ^ name \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/objectsSpec..st b/ObjectStatistics.package/ObjectStatDimension.class/instance/objectsSpec..st new file mode 100644 index 0000000..076d1ab --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/objectsSpec..st @@ -0,0 +1,3 @@ +accessing +objectsSpec: anObject + objectsSpec := anObject asStateSpec \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/objectsSpec.st b/ObjectStatistics.package/ObjectStatDimension.class/instance/objectsSpec.st new file mode 100644 index 0000000..d2f1104 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/objectsSpec.st @@ -0,0 +1,3 @@ +accessing +objectsSpec + ^ objectsSpec \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/overallStatistics..st b/ObjectStatistics.package/ObjectStatDimension.class/instance/overallStatistics..st new file mode 100644 index 0000000..6a9a54b --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/overallStatistics..st @@ -0,0 +1,3 @@ +accessing +overallStatistics: anObject + overallStatistics := anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/overallStatistics.st b/ObjectStatistics.package/ObjectStatDimension.class/instance/overallStatistics.st new file mode 100644 index 0000000..61e3938 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/overallStatistics.st @@ -0,0 +1,3 @@ +accessing +overallStatistics + ^ overallStatistics \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/prepareStatistics..st b/ObjectStatistics.package/ObjectStatDimension.class/instance/prepareStatistics..st new file mode 100644 index 0000000..9cee68b --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/prepareStatistics..st @@ -0,0 +1,5 @@ +accessing +prepareStatistics: anObjectStatistics + + subDimensions do: [ :each | + anObjectStatistics addDimension: each copyForSubDimension] \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/printOn..st b/ObjectStatistics.package/ObjectStatDimension.class/instance/printOn..st new file mode 100644 index 0000000..4cab02d --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/printOn..st @@ -0,0 +1,5 @@ +printing +printOn: aStream + name ifNil: [ ^super printOn: aStream ]. + + aStream << slices size << ' ' << name \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/sliceFor..st b/ObjectStatistics.package/ObjectStatDimension.class/instance/sliceFor..st new file mode 100644 index 0000000..930ff08 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/sliceFor..st @@ -0,0 +1,8 @@ +accessing +sliceFor: anObject + + | coordinateObject | + coordinateObject := self coordinateFor: anObject. + + ^slices at: coordinateObject ifAbsentPut: [ + ObjectStatSlice at: coordinateObject statistics: (overallStatistics newForDimension: self) ] \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/slices..st b/ObjectStatistics.package/ObjectStatDimension.class/instance/slices..st new file mode 100644 index 0000000..e0b3dfe --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/slices..st @@ -0,0 +1,3 @@ +accessing +slices: anObject + slices := anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/slices.st b/ObjectStatistics.package/ObjectStatDimension.class/instance/slices.st new file mode 100644 index 0000000..2d1bd42 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/slices.st @@ -0,0 +1,3 @@ +accessing +slices + ^ slices \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/sortedSlices.st b/ObjectStatistics.package/ObjectStatDimension.class/instance/sortedSlices.st new file mode 100644 index 0000000..6899728 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/sortedSlices.st @@ -0,0 +1,4 @@ +accessing +sortedSlices + + ^slices asSortedCollection: [ :a :b | a mainMetric > b mainMetric] \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/subDimensions..st b/ObjectStatistics.package/ObjectStatDimension.class/instance/subDimensions..st new file mode 100644 index 0000000..064c353 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/subDimensions..st @@ -0,0 +1,3 @@ +accessing +subDimensions: anObject + subDimensions := anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/instance/subDimensions.st b/ObjectStatistics.package/ObjectStatDimension.class/instance/subDimensions.st new file mode 100644 index 0000000..e3b1a25 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/instance/subDimensions.st @@ -0,0 +1,3 @@ +accessing +subDimensions + ^ subDimensions \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatDimension.class/properties.json b/ObjectStatistics.package/ObjectStatDimension.class/properties.json new file mode 100644 index 0000000..b4ff714 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatDimension.class/properties.json @@ -0,0 +1,19 @@ +{ + "commentStamp" : "DenisKudryashov 6/3/2016 12:20", + "super" : "Object", + "category" : "ObjectStatistics", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ + "name", + "overallStatistics", + "slices", + "subDimensions", + "ignoreMetricNames", + "objectsSpec", + "coordinatesBlock" + ], + "name" : "ObjectStatDimension", + "type" : "normal" +} \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatFunctionMetric.class/README.md b/ObjectStatistics.package/ObjectStatFunctionMetric.class/README.md new file mode 100644 index 0000000..b4e4539 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatFunctionMetric.class/README.md @@ -0,0 +1,6 @@ +I am metric which accumulate given function value over all objects set. + +Internal Representation and Key Implementation Points. + + Instance Variables + functionBlock: diff --git a/ObjectStatistics.package/ObjectStatFunctionMetric.class/class/by..st b/ObjectStatistics.package/ObjectStatFunctionMetric.class/class/by..st new file mode 100644 index 0000000..a2d46ff --- /dev/null +++ b/ObjectStatistics.package/ObjectStatFunctionMetric.class/class/by..st @@ -0,0 +1,4 @@ +instance creation +by: aBlockClosure + ^self new + functionBlock: aBlockClosure \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatFunctionMetric.class/class/named.by..st b/ObjectStatistics.package/ObjectStatFunctionMetric.class/class/named.by..st new file mode 100644 index 0000000..7dbd431 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatFunctionMetric.class/class/named.by..st @@ -0,0 +1,5 @@ +instance creation +named: aString by: aBlockClosure + ^(self named: aString) + functionBlock: aBlockClosure + \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatFunctionMetric.class/instance/functionBlock..st b/ObjectStatistics.package/ObjectStatFunctionMetric.class/instance/functionBlock..st new file mode 100644 index 0000000..e4987d3 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatFunctionMetric.class/instance/functionBlock..st @@ -0,0 +1,3 @@ +accessing +functionBlock: anObject + functionBlock := anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatFunctionMetric.class/instance/functionBlock.st b/ObjectStatistics.package/ObjectStatFunctionMetric.class/instance/functionBlock.st new file mode 100644 index 0000000..b05379f --- /dev/null +++ b/ObjectStatistics.package/ObjectStatFunctionMetric.class/instance/functionBlock.st @@ -0,0 +1,3 @@ +accessing +functionBlock + ^ functionBlock \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatFunctionMetric.class/instance/measure..st b/ObjectStatistics.package/ObjectStatFunctionMetric.class/instance/measure..st new file mode 100644 index 0000000..5938aee --- /dev/null +++ b/ObjectStatistics.package/ObjectStatFunctionMetric.class/instance/measure..st @@ -0,0 +1,3 @@ +measuring +measure: anObject + ^functionBlock value: anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatFunctionMetric.class/properties.json b/ObjectStatistics.package/ObjectStatFunctionMetric.class/properties.json new file mode 100644 index 0000000..175a75c --- /dev/null +++ b/ObjectStatistics.package/ObjectStatFunctionMetric.class/properties.json @@ -0,0 +1,13 @@ +{ + "commentStamp" : "DenisKudryashov 6/1/2016 16:21", + "super" : "ObjectStatMetric", + "category" : "ObjectStatistics", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ + "functionBlock" + ], + "name" : "ObjectStatFunctionMetric", + "type" : "normal" +} \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/README.md b/ObjectStatistics.package/ObjectStatMetric.class/README.md new file mode 100644 index 0000000..9550f11 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/README.md @@ -0,0 +1,26 @@ +I represent metric which should be calculated over objects set. I accumulate only objects which satisfy my objects spec (which is any object by default). + +My subclasses should implement #measure: method which compute metric value for single object. + +Public API and Key Messages + +- accumulate: anObject +it measures given object and adds computed result into whole value +- accumulateAll: aCollection +it accumulates all collection items. +- measure: anObject +it should compute metric on single object +- percentage +returns percentage of value comparing to parent +- value +returns currently accumulated value of metric + +I am a magnitude which means that different metrics could be compared. + +Internal Representation and Key Implementation Points. + + Instance Variables + name: + objectsSpec: + parent: + value: diff --git a/ObjectStatistics.package/ObjectStatMetric.class/class/asObjectStatMetric.st b/ObjectStatistics.package/ObjectStatMetric.class/class/asObjectStatMetric.st new file mode 100644 index 0000000..a6bb395 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/class/asObjectStatMetric.st @@ -0,0 +1,3 @@ +converting +asObjectStatMetric + ^self new \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/class/named..st b/ObjectStatistics.package/ObjectStatMetric.class/class/named..st new file mode 100644 index 0000000..9bf08d6 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/class/named..st @@ -0,0 +1,3 @@ +instance creation +named: aString + ^self new name: aString \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/^equals.st b/ObjectStatistics.package/ObjectStatMetric.class/instance/^equals.st new file mode 100644 index 0000000..6acb38e --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/^equals.st @@ -0,0 +1,5 @@ +testing += anObjectStatMatric + self class == anObjectStatMatric class ifFalse: [ ^false ]. + + ^value = anObjectStatMatric value \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/^less.st b/ObjectStatistics.package/ObjectStatMetric.class/instance/^less.st new file mode 100644 index 0000000..483c289 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/^less.st @@ -0,0 +1,4 @@ +testing +< anObjectStatMatric + + ^value < anObjectStatMatric value \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/accumulate..st b/ObjectStatistics.package/ObjectStatMetric.class/instance/accumulate..st new file mode 100644 index 0000000..72bdf13 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/accumulate..st @@ -0,0 +1,9 @@ +measuring +accumulate: anObject + + | result | + (objectsSpec matches: anObject) ifFalse: [ ^value ]. + + result := self measure: anObject. + + ^value := value + result \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/accumulateAll..st b/ObjectStatistics.package/ObjectStatMetric.class/instance/accumulateAll..st new file mode 100644 index 0000000..231a541 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/accumulateAll..st @@ -0,0 +1,6 @@ +measuring +accumulateAll: aCollection + + aCollection do: [ :each | self accumulate: each ]. + + ^value \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/asObjectStatMetric.st b/ObjectStatistics.package/ObjectStatMetric.class/instance/asObjectStatMetric.st new file mode 100644 index 0000000..46106fc --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/asObjectStatMetric.st @@ -0,0 +1,3 @@ +converting +asObjectStatMetric + ^self \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/defaultValue.st b/ObjectStatistics.package/ObjectStatMetric.class/instance/defaultValue.st new file mode 100644 index 0000000..57b2ac4 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/defaultValue.st @@ -0,0 +1,3 @@ +initialization +defaultValue + ^0 \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/hash.st b/ObjectStatistics.package/ObjectStatMetric.class/instance/hash.st new file mode 100644 index 0000000..100966e --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/hash.st @@ -0,0 +1,3 @@ +hash +hash + ^value hash \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/initialize.st b/ObjectStatistics.package/ObjectStatMetric.class/instance/initialize.st new file mode 100644 index 0000000..8695ee5 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/initialize.st @@ -0,0 +1,6 @@ +initialization +initialize + super initialize. + + value := self defaultValue. + objectsSpec := Any \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/isMeaningful.st b/ObjectStatistics.package/ObjectStatMetric.class/instance/isMeaningful.st new file mode 100644 index 0000000..2ca0c65 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/isMeaningful.st @@ -0,0 +1,5 @@ +testing +isMeaningful + parent ifNil: [ ^true ]. + + ^parent value isZero not \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/measure..st b/ObjectStatistics.package/ObjectStatMetric.class/instance/measure..st new file mode 100644 index 0000000..f2d2d36 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/measure..st @@ -0,0 +1,3 @@ +measuring +measure: anObject + self subclassResponsibility \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/name..st b/ObjectStatistics.package/ObjectStatMetric.class/instance/name..st new file mode 100644 index 0000000..5a27110 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/name..st @@ -0,0 +1,3 @@ +accessing +name: anObject + name := anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/name.st b/ObjectStatistics.package/ObjectStatMetric.class/instance/name.st new file mode 100644 index 0000000..22077c2 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/name.st @@ -0,0 +1,3 @@ +accessing +name + ^ name \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/newForDimension.st b/ObjectStatistics.package/ObjectStatMetric.class/instance/newForDimension.st new file mode 100644 index 0000000..927814e --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/newForDimension.st @@ -0,0 +1,7 @@ +accessing +newForDimension + | newMetric | + newMetric := self copy. + newMetric prepareForDimensionOf: self. + + ^newMetric \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/objectsSpec..st b/ObjectStatistics.package/ObjectStatMetric.class/instance/objectsSpec..st new file mode 100644 index 0000000..19b52f0 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/objectsSpec..st @@ -0,0 +1,6 @@ +accessing +objectsSpec: valuableOrSpec + + objectsSpec := valuableOrSpec isStateSpec + ifTrue: [ valuableOrSpec ] + ifFalse: [ SpecOfObjectStateByPredicate from: valuableOrSpec ] \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/objectsSpec.st b/ObjectStatistics.package/ObjectStatMetric.class/instance/objectsSpec.st new file mode 100644 index 0000000..d2f1104 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/objectsSpec.st @@ -0,0 +1,3 @@ +accessing +objectsSpec + ^ objectsSpec \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/parent..st b/ObjectStatistics.package/ObjectStatMetric.class/instance/parent..st new file mode 100644 index 0000000..d52064f --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/parent..st @@ -0,0 +1,3 @@ +accessing +parent: anObject + parent := anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/parent.st b/ObjectStatistics.package/ObjectStatMetric.class/instance/parent.st new file mode 100644 index 0000000..eface7d --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/parent.st @@ -0,0 +1,3 @@ +accessing +parent + ^ parent \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/percentage.st b/ObjectStatistics.package/ObjectStatMetric.class/instance/percentage.st new file mode 100644 index 0000000..fde6e7f --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/percentage.st @@ -0,0 +1,7 @@ +accessing +percentage + + parent ifNil: [ ^100 ]. + parent value isZero ifTrue: [ ^0 ]. + + ^value * 100 / parent value \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/prepareForDimensionOf..st b/ObjectStatistics.package/ObjectStatMetric.class/instance/prepareForDimensionOf..st new file mode 100644 index 0000000..5505162 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/prepareForDimensionOf..st @@ -0,0 +1,5 @@ +initialization +prepareForDimensionOf: parentMetric + + value := self defaultValue. + parent := parentMetric. \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/printOn..st b/ObjectStatistics.package/ObjectStatMetric.class/instance/printOn..st new file mode 100644 index 0000000..7251b6f --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/printOn..st @@ -0,0 +1,11 @@ +printing +printOn: aStream + + aStream << self value. + + name ifNotNil: [ aStream << ' ' << name ]. + + parent ifNotNil: [ + aStream << ' ('. + self percentage printOn: aStream showingDecimalPlaces: 2. + aStream << '%)'] \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/value..st b/ObjectStatistics.package/ObjectStatMetric.class/instance/value..st new file mode 100644 index 0000000..d10f5f2 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/value..st @@ -0,0 +1,3 @@ +accessing +value: aNumber + value := aNumber \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/instance/value.st b/ObjectStatistics.package/ObjectStatMetric.class/instance/value.st new file mode 100644 index 0000000..3a90afa --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/instance/value.st @@ -0,0 +1,3 @@ +accessing +value + ^value \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatMetric.class/properties.json b/ObjectStatistics.package/ObjectStatMetric.class/properties.json new file mode 100644 index 0000000..2e19b6b --- /dev/null +++ b/ObjectStatistics.package/ObjectStatMetric.class/properties.json @@ -0,0 +1,16 @@ +{ + "commentStamp" : "DenisKudryashov 6/1/2016 16:20", + "super" : "Magnitude", + "category" : "ObjectStatistics", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ + "name", + "value", + "parent", + "objectsSpec" + ], + "name" : "ObjectStatMetric", + "type" : "normal" +} \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatRecursiveDimension.class/README.md b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/README.md new file mode 100644 index 0000000..b9ff11d --- /dev/null +++ b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/README.md @@ -0,0 +1,14 @@ +I am special dimension of object space which unfold separate subdimensions for children of given objects. I implement this unfolding logic by propagating parents of given objects which I detect by my parentRecursionBlock. + +For example I allow implement classic profiler tree statistics where we see number of message sends inside each call in tree view. +Look at my tests ObjectStatRecursiveDimensionTests or profiler example: + ObjectStatistics exampleTreeProfiler + +My ownerObjects is all objects which are folded by same coordinate and all their children together should belongs to me. + +Internal Representation and Key Implementation Points. + + Instance Variables + ownerObjects > + parentRecursionBlock: + shouldCountChildrenInParentMetrics: \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatRecursiveDimension.class/class/by.recursion..st b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/class/by.recursion..st new file mode 100644 index 0000000..d6f31b4 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/class/by.recursion..st @@ -0,0 +1,4 @@ +instance creation +by: slicesBlock recursion: propertyBlock + ^(self by: slicesBlock) + parentRecursionBlock: propertyBlock \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/accumulate..st b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/accumulate..st new file mode 100644 index 0000000..ae9a017 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/accumulate..st @@ -0,0 +1,6 @@ +measuring +accumulate: anObject + + (objectsSpec matches: anObject ) ifFalse: [ ^self ]. + + self accumulateParentsOf: anObject whichIsLowermostChild: true diff --git a/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/accumulateParentsOf.whichIsLowermostChild..st b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/accumulateParentsOf.whichIsLowermostChild..st new file mode 100644 index 0000000..a969493 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/accumulateParentsOf.whichIsLowermostChild..st @@ -0,0 +1,15 @@ +private +accumulateParentsOf: anObject whichIsLowermostChild: isLowermostChild + + | currentParent sliceForParent slice | + currentParent := self findParentOf: anObject. + + (ownerObjects includes: currentParent) ifTrue: [ + slice := self sliceFor: anObject. + shouldCountChildrenInParentMetrics | isLowermostChild ifTrue: [ + slice accumulate: anObject exceptingDimension: name]. + ^slice]. + + sliceForParent := self accumulateParentsOf: currentParent whichIsLowermostChild: false. + ^(sliceForParent dimensionNamed: name) + accumulateParentsOf: anObject whichIsLowermostChild: isLowermostChild \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/addOwnerObject..st b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/addOwnerObject..st new file mode 100644 index 0000000..a10cbc1 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/addOwnerObject..st @@ -0,0 +1,3 @@ +accessing +addOwnerObject: anObject + ownerObjects add: anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/copyForSubDimension.st b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/copyForSubDimension.st new file mode 100644 index 0000000..c09f4a8 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/copyForSubDimension.st @@ -0,0 +1,6 @@ +accessing +copyForSubDimension + | copy | + copy := super copyForSubDimension. + copy ownerObjects: Set new. + ^copy \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/findParentOf..st b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/findParentOf..st new file mode 100644 index 0000000..ee7927c --- /dev/null +++ b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/findParentOf..st @@ -0,0 +1,10 @@ +private +findParentOf: anObject + + | parent | + parent := parentRecursionBlock value: anObject. + + [objectsSpec matches: parent] whileFalse: [ + parent := parentRecursionBlock value: parent]. + + ^parent \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/initialize.st b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/initialize.st new file mode 100644 index 0000000..cf2d6b1 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/initialize.st @@ -0,0 +1,6 @@ +initialization +initialize + super initialize. + ownerObjects := Set new. + ownerObjects add: nil. + shouldCountChildrenInParentMetrics := false \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/ownerObjects..st b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/ownerObjects..st new file mode 100644 index 0000000..545d4f4 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/ownerObjects..st @@ -0,0 +1,3 @@ +accessing +ownerObjects: aSet + ownerObjects := aSet \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/ownerObjects.st b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/ownerObjects.st new file mode 100644 index 0000000..2e17ebd --- /dev/null +++ b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/ownerObjects.st @@ -0,0 +1,3 @@ +accessing +ownerObjects + ^ ownerObjects \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/parentRecursionBlock..st b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/parentRecursionBlock..st new file mode 100644 index 0000000..c8aa8c0 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/parentRecursionBlock..st @@ -0,0 +1,3 @@ +accessing +parentRecursionBlock: anObject + parentRecursionBlock := anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/parentRecursionBlock.st b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/parentRecursionBlock.st new file mode 100644 index 0000000..ed81b81 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/parentRecursionBlock.st @@ -0,0 +1,3 @@ +accessing +parentRecursionBlock + ^ parentRecursionBlock \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/prepareStatistics..st b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/prepareStatistics..st new file mode 100644 index 0000000..b39bb1b --- /dev/null +++ b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/prepareStatistics..st @@ -0,0 +1,6 @@ +private +prepareStatistics: anObjectStatistics + + super prepareStatistics: anObjectStatistics. + + anObjectStatistics addDimension: self copyForSubDimension \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/shouldCountChildrenInParentMetrics..st b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/shouldCountChildrenInParentMetrics..st new file mode 100644 index 0000000..ec3ca2b --- /dev/null +++ b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/shouldCountChildrenInParentMetrics..st @@ -0,0 +1,3 @@ +accessing +shouldCountChildrenInParentMetrics: anObject + shouldCountChildrenInParentMetrics := anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/shouldCountChildrenInParentMetrics.st b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/shouldCountChildrenInParentMetrics.st new file mode 100644 index 0000000..8460be4 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/shouldCountChildrenInParentMetrics.st @@ -0,0 +1,3 @@ +accessing +shouldCountChildrenInParentMetrics + ^ shouldCountChildrenInParentMetrics \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/sliceFor..st b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/sliceFor..st new file mode 100644 index 0000000..283dd2f --- /dev/null +++ b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/instance/sliceFor..st @@ -0,0 +1,9 @@ +accessing +sliceFor: anObject + + | slice | + slice := super sliceFor: anObject. + + (slice dimensionNamed: name) addOwnerObject: anObject. + + ^slice \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatRecursiveDimension.class/properties.json b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/properties.json new file mode 100644 index 0000000..62774b7 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatRecursiveDimension.class/properties.json @@ -0,0 +1,15 @@ +{ + "commentStamp" : "DenisKudryashov 6/6/2016 12:16", + "super" : "ObjectStatDimension", + "category" : "ObjectStatistics", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ + "shouldCountChildrenInParentMetrics", + "parentRecursionBlock", + "ownerObjects" + ], + "name" : "ObjectStatRecursiveDimension", + "type" : "normal" +} \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatSlice.class/README.md b/ObjectStatistics.package/ObjectStatSlice.class/README.md new file mode 100644 index 0000000..4a2d4c6 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatSlice.class/README.md @@ -0,0 +1,16 @@ +I represent slice of overall objects statistics. +I am created by dimensions for every objects coordinate to maintain own sub statistics.. + +Public API and Key Messages + +- accumulate: anObject +it adds given object to my own statistics. + +Internal Representation and Key Implementation Points. + + Instance Variables + coordinate: + statistics: + + + Implementation Points \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatSlice.class/class/at.statistics..st b/ObjectStatistics.package/ObjectStatSlice.class/class/at.statistics..st new file mode 100644 index 0000000..362c243 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatSlice.class/class/at.statistics..st @@ -0,0 +1,5 @@ +instance creation +at: coordinateObject statistics: anObjectStatistics + ^self new + coordinate: coordinateObject; + statistics: anObjectStatistics \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatSlice.class/instance/accumulate..st b/ObjectStatistics.package/ObjectStatSlice.class/instance/accumulate..st new file mode 100644 index 0000000..1d37008 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatSlice.class/instance/accumulate..st @@ -0,0 +1,3 @@ +measuring +accumulate: anObject + ^statistics accumulate: anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatSlice.class/instance/accumulate.exceptingDimension..st b/ObjectStatistics.package/ObjectStatSlice.class/instance/accumulate.exceptingDimension..st new file mode 100644 index 0000000..72af593 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatSlice.class/instance/accumulate.exceptingDimension..st @@ -0,0 +1,3 @@ +measuring +accumulate: anObject exceptingDimension: dimensionName + ^statistics accumulate: anObject exceptingDimension: dimensionName \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatSlice.class/instance/coordinate..st b/ObjectStatistics.package/ObjectStatSlice.class/instance/coordinate..st new file mode 100644 index 0000000..78e0e7c --- /dev/null +++ b/ObjectStatistics.package/ObjectStatSlice.class/instance/coordinate..st @@ -0,0 +1,3 @@ +accessing +coordinate: anObject + coordinate := anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatSlice.class/instance/coordinate.st b/ObjectStatistics.package/ObjectStatSlice.class/instance/coordinate.st new file mode 100644 index 0000000..eee4477 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatSlice.class/instance/coordinate.st @@ -0,0 +1,3 @@ +accessing +coordinate + ^ coordinate \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatSlice.class/instance/dimensionNamed..st b/ObjectStatistics.package/ObjectStatSlice.class/instance/dimensionNamed..st new file mode 100644 index 0000000..d1a10d8 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatSlice.class/instance/dimensionNamed..st @@ -0,0 +1,3 @@ +accessing +dimensionNamed: aString + ^statistics dimensionNamed: aString \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatSlice.class/instance/mainMetric.st b/ObjectStatistics.package/ObjectStatSlice.class/instance/mainMetric.st new file mode 100644 index 0000000..c027f0b --- /dev/null +++ b/ObjectStatistics.package/ObjectStatSlice.class/instance/mainMetric.st @@ -0,0 +1,3 @@ +accessing +mainMetric + ^statistics mainMetric \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatSlice.class/instance/printOn..st b/ObjectStatistics.package/ObjectStatSlice.class/instance/printOn..st new file mode 100644 index 0000000..710028e --- /dev/null +++ b/ObjectStatistics.package/ObjectStatSlice.class/instance/printOn..st @@ -0,0 +1,6 @@ +printing +printOn: aStream + + coordinate printOn: aStream. + aStream << ': '. + statistics printMetricsOn: aStream \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatSlice.class/instance/statistics..st b/ObjectStatistics.package/ObjectStatSlice.class/instance/statistics..st new file mode 100644 index 0000000..f450d35 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatSlice.class/instance/statistics..st @@ -0,0 +1,3 @@ +accessing +statistics: anObject + statistics := anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatSlice.class/instance/statistics.st b/ObjectStatistics.package/ObjectStatSlice.class/instance/statistics.st new file mode 100644 index 0000000..f25eb02 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatSlice.class/instance/statistics.st @@ -0,0 +1,3 @@ +accessing +statistics + ^ statistics \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatSlice.class/properties.json b/ObjectStatistics.package/ObjectStatSlice.class/properties.json new file mode 100644 index 0000000..9aa1f39 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatSlice.class/properties.json @@ -0,0 +1,14 @@ +{ + "commentStamp" : "DenisKudryashov 6/1/2016 16:49", + "super" : "Object", + "category" : "ObjectStatistics", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ + "statistics", + "coordinate" + ], + "name" : "ObjectStatSlice", + "type" : "normal" +} \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/README.md b/ObjectStatistics.package/ObjectStatistics.class/README.md new file mode 100644 index 0000000..fd7eef8 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/README.md @@ -0,0 +1,51 @@ +I calculate set of metrics over given objects collection to analyse them from different dimensions. + +Imaging that we have collection of message sends and we want to know number of message sends in dimension of receiver, receiver class and message selector. We have different angles to look at this data: from receiver class to selector and receiver or from selector to receiver class and receiver or any other combination. +We also could analyze different kind of metrics which could be computed on given objects. It could be number of unique receivers, execution time, executed lines of code, etc. + +To add object into statistics use accumulation messages: +- accumulate: anObject +- accumulateAll: aCollection + +To declare metrics and dimensions look at "fluent api" protocol: +- countAllAs: 'objects' +it adds simple objects count metric. + +- countAllSuch: [ o: | true ] as: 'special objects' +it adds count metric for all objects which satisfy given spec + +- countDifferent: [ :o | o property ] as: 'properties' +it will count number of different properties over full objects set + +- countDifferent: [ :point | point x ] as: 'properties' for: (Kind of: Point) +it will measure only Point instances for count of different x coordinate. + +- countFunction: [ :rectangle | rectangle area ] as: 'area' +it will calculate sumary area of given rectangles set. + +- dimention: [ :o | o class ] as: 'classes' +it adds dimention of classes (in this case) into statistics which will calculate all metrics for every class of given objects set. + +To define hierarchy of dimensions there is two messages: +- with: dimensionsDefinitionBlock +All dimensions inside block will be added into previously defined dimension. For example: + + stat + dimension: [ :o | o class package] as: 'packages'; + with: [ + stat dimension: [ :o | o class ] as: 'classes'] + +- for: [:o | o > 10|] with: dimensionsDefinitionBlock +It is same #with: message. But it will add sub dimensions only for objects which satisfy given spec + +In the level of subdimensions some of metrics could be not needed. They can be disabled by: + stat ignoreMetrics: #('classes') + +Look at class side examples to play in live. + +Internal Representation and Key Implementation Points. + + Instance Variables + dimensions: > + dimensionsBuilder: + metrics: > \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/class/exampleFlatProfiler.st b/ObjectStatistics.package/ObjectStatistics.class/class/exampleFlatProfiler.st new file mode 100644 index 0000000..5d32be4 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/class/exampleFlatProfiler.st @@ -0,0 +1,23 @@ +examples +exampleFlatProfiler + | stat prev | + stat := ObjectStatistics new. + stat countAllAs: 'sends'. + stat countDifferent: [:context | context receiver ] as: 'receivers'. + + stat + dimension: [ :context | context receiver class ] named: 'classes'; with: [ + stat dimension: [ :context | context selector ] named: 'msgs' ]; + dimension: [ :context | context selector ] named: 'msgs'; with: [ + stat dimension: [ :context | context receiver class ] named: 'classes' ]; + dimension: [ :context | context receiver class -> context selector ] named: 'leaves'; with: [ + stat dimension: [ :context | context sender method ] named: 'sender' ]. + + prev := nil. + thisContext sender + runSimulated: [3 printString] + contextAtEachStep: [:current | + current ~~ prev & (current sender == prev ) ifTrue: [stat accumulate: current]. + prev := current]. + + ^stat inspect \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/class/exampleMethods.st b/ObjectStatistics.package/ObjectStatistics.class/class/exampleMethods.st new file mode 100644 index 0000000..ff5663d --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/class/exampleMethods.st @@ -0,0 +1,19 @@ +examples +exampleMethods + | stat | + stat := ObjectStatistics new. + stat countAllAs: 'methods'. + stat countFunction: [:m | m linesOfCode ] as: 'lines of code'. + + stat + dimension: [ :m | m methodClass package name ] named: 'pckgs'; with: [ + stat dimension: [ :m | m methodClass ] named: 'classes'; with: [ + stat dimension: [ :m | m selector] named: 'methods']]; + dimension: [ :m | m methodClass package mcWorkingCopy versionInfo author ] named: 'authors'; with: [ + stat dimension: [ :m | m methodClass ] named: 'pcks'; with: [ + stat dimension: [ :m | m methodClass ] named: 'classes'; with: [ + stat dimension: [ :m | m selector] named: 'methods']]]. + + stat accumulateAll: ((RPackage allInstances + select: [ :each | each name beginsWith: 'Athens']) gather: #methods). + ^stat inspect \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/class/exampleStringsWithSingleDimension.st b/ObjectStatistics.package/ObjectStatistics.class/class/exampleStringsWithSingleDimension.st new file mode 100644 index 0000000..2eff059 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/class/exampleStringsWithSingleDimension.st @@ -0,0 +1,11 @@ +examples +exampleStringsWithSingleDimension + | stat | + stat := ObjectStatistics new. + stat countAllAs: 'strs'. + stat countFunction: [:s | s count: #isVowel] as: 'vowels'. + + stat dimension: [ :s | s size ] named: 'size'. + + stat accumulateAll: ByteSymbol allInstances. + ^stat inspect \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/class/exampleStringsWithTwoDimensions.st b/ObjectStatistics.package/ObjectStatistics.class/class/exampleStringsWithTwoDimensions.st new file mode 100644 index 0000000..c2eba06 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/class/exampleStringsWithTwoDimensions.st @@ -0,0 +1,12 @@ +examples +exampleStringsWithTwoDimensions + | stat | + stat := ObjectStatistics new. + stat countAllAs: 'strs'. + stat countFunction: [:s | s count: #isVowel] as: 'vowels'. + + stat dimension: [ :s | s ifEmpty: [ #empty ] ifNotEmpty: [ s first] ] named: 'first char'. + stat dimension: [ :s | s size ] named: 'sizes'. + + stat accumulateAll: ByteSymbol allInstances. + ^stat inspect \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/class/exampleTreeProfiler.st b/ObjectStatistics.package/ObjectStatistics.class/class/exampleTreeProfiler.st new file mode 100644 index 0000000..4739fcb --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/class/exampleTreeProfiler.st @@ -0,0 +1,19 @@ +examples +exampleTreeProfiler + | stat prev | + stat := ObjectStatistics new. + stat countAllAs: 'sends'. + stat countDifferent: [:context | context receiver ] as: 'receivers'. + + stat + dimension: [ :context | context receiver class -> context selector] + named: 'calls' recursionUpTo: [:context | context sender]. + + prev := nil. + thisContext sender + runSimulated: [3 printString] + contextAtEachStep: [:current | + current ~~ prev & (current sender == prev ) ifTrue: [stat accumulate: current]. + prev := current]. + + ^stat inspect \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/class/exampleTreeProfilerWithOnlyBlockStack.st b/ObjectStatistics.package/ObjectStatistics.class/class/exampleTreeProfilerWithOnlyBlockStack.st new file mode 100644 index 0000000..759f4ce --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/class/exampleTreeProfilerWithOnlyBlockStack.st @@ -0,0 +1,30 @@ +examples +exampleTreeProfilerWithOnlyBlockStack + | stat prev block blockContext insideBlock | + stat := ObjectStatistics new. + stat countAllAs: 'sends'. + stat countDifferent: [:context | context receiver ] as: 'receivers'. + + block := [3.14159 printString]. + stat + dimension: [ :context | context receiver class -> context selector] + named: 'calls' + recursionUpTo: [:context | context sender ifNotNil: [:sender | + sender closure == block ifTrue: [ nil ] ifFalse: [ sender home]]]. + + blockContext := nil. + insideBlock := false. + prev := nil. + thisContext + runSimulated: block + contextAtEachStep: [:current | + current closure == block ifTrue: [ (blockContext := current). ]. + blockContext ifNotNil: [ + current sender == blockContext ifTrue: [ insideBlock := true ]. + current == blockContext sender ifTrue: [ insideBlock := false ]]. + current selector == thisContext selector ifTrue: [ insideBlock := false ]. + insideBlock ifTrue: [ + current ~~ prev & (current sender == prev ) ifTrue: [stat accumulate: current home]]. + prev := current]. + + ^stat inspect \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/accumulate..st b/ObjectStatistics.package/ObjectStatistics.class/instance/accumulate..st new file mode 100644 index 0000000..7dd75d8 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/accumulate..st @@ -0,0 +1,5 @@ +measuring +accumulate: anObject + + metrics do: [ :each | each accumulate: anObject ]. + dimensions do: [ :each | each accumulate: anObject ] \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/accumulate.exceptingDimension..st b/ObjectStatistics.package/ObjectStatistics.class/instance/accumulate.exceptingDimension..st new file mode 100644 index 0000000..44082bb --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/accumulate.exceptingDimension..st @@ -0,0 +1,6 @@ +measuring +accumulate: anObject exceptingDimension: dimensionName + + metrics do: [ :each | each accumulate: anObject ]. + dimensions do: [ :each | + each name = dimensionName ifFalse: [ each accumulate: anObject ]] \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/accumulateAll..st b/ObjectStatistics.package/ObjectStatistics.class/instance/accumulateAll..st new file mode 100644 index 0000000..72025eb --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/accumulateAll..st @@ -0,0 +1,4 @@ +measuring +accumulateAll: aCollection + + aCollection do: [ :each | self accumulate: each ] \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/addDimension..st b/ObjectStatistics.package/ObjectStatistics.class/instance/addDimension..st new file mode 100644 index 0000000..1e657c5 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/addDimension..st @@ -0,0 +1,9 @@ +accessing +addDimension: aDimensionOrBlock + + | dimension | + dimension := aDimensionOrBlock asObjectStatDimension. + dimension overallStatistics: self. + + dimensions add: dimension. + ^dimension \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/addMetric..st b/ObjectStatistics.package/ObjectStatistics.class/instance/addMetric..st new file mode 100644 index 0000000..2c93c7c --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/addMetric..st @@ -0,0 +1,8 @@ +accessing +addMetric: metricSource + | metric | + metric := metricSource asObjectStatMetric. + + metrics add: metric. + + ^metric \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/addMetric.named..st b/ObjectStatistics.package/ObjectStatistics.class/instance/addMetric.named..st new file mode 100644 index 0000000..68aa0d1 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/addMetric.named..st @@ -0,0 +1,6 @@ +accessing +addMetric: metricSource named: aString + | metric | + metric := self addMetric: metricSource. + metric name: aString. + ^metric \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/countAllAs..st b/ObjectStatistics.package/ObjectStatistics.class/instance/countAllAs..st new file mode 100644 index 0000000..a00d91b --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/countAllAs..st @@ -0,0 +1,3 @@ +fluent api +countAllAs: objectsName + ^self addMetric: ObjectStatCounter named: objectsName \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/countAllSuch.as..st b/ObjectStatistics.package/ObjectStatistics.class/instance/countAllSuch.as..st new file mode 100644 index 0000000..db181cb --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/countAllSuch.as..st @@ -0,0 +1,5 @@ +fluent api +countAllSuch: valuableOrSpec as: objectsName + | metric | + metric := self countAllAs: objectsName. + metric objectsSpec: valuableOrSpec \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/countDifferent.as..st b/ObjectStatistics.package/ObjectStatistics.class/instance/countDifferent.as..st new file mode 100644 index 0000000..7cf3e4d --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/countDifferent.as..st @@ -0,0 +1,3 @@ +fluent api +countDifferent: propertyBlock as: objectsName + self addMetric: (ObjectStatDifferentPropertiesCounter for: propertyBlock) named: objectsName \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/countDifferent.as.for..st b/ObjectStatistics.package/ObjectStatistics.class/instance/countDifferent.as.for..st new file mode 100644 index 0000000..378808b --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/countDifferent.as.for..st @@ -0,0 +1,6 @@ +fluent api +countDifferent: propertyBlock as: objectsName for: valuableOrSpec + | metric | + metric := self addMetric: (ObjectStatDifferentPropertiesCounter for: propertyBlock) named: objectsName. + metric objectsSpec: valuableOrSpec. + ^metric \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/countFunction.as..st b/ObjectStatistics.package/ObjectStatistics.class/instance/countFunction.as..st new file mode 100644 index 0000000..a4de5a4 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/countFunction.as..st @@ -0,0 +1,3 @@ +fluent api +countFunction: functionBlock as: objectsName + self addMetric: functionBlock named: objectsName \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/dimension.named..st b/ObjectStatistics.package/ObjectStatistics.class/instance/dimension.named..st new file mode 100644 index 0000000..4fd8f8c --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/dimension.named..st @@ -0,0 +1,6 @@ +fluent api +dimension: aDimensionOrBlock named: aString + | dimension | + dimension := dimensionsBuilder addDimension: aDimensionOrBlock asObjectStatDimension. + dimension name: aString. + ^dimension \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/dimension.named.recursionUpTo..st b/ObjectStatistics.package/ObjectStatistics.class/instance/dimension.named.recursionUpTo..st new file mode 100644 index 0000000..0619077 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/dimension.named.recursionUpTo..st @@ -0,0 +1,7 @@ +fluent api +dimension: sliceBlock named: aString recursionUpTo: parentPropertyBlock + | dimension | + dimension := ObjectStatRecursiveDimension by: sliceBlock recursion: parentPropertyBlock. + dimension name: aString. + dimensionsBuilder addDimension: dimension. + ^dimension \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/dimensionNamed..st b/ObjectStatistics.package/ObjectStatistics.class/instance/dimensionNamed..st new file mode 100644 index 0000000..3edbf8f --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/dimensionNamed..st @@ -0,0 +1,3 @@ +accessing +dimensionNamed: aString + ^dimensions detect: [ :each | each name = aString ] \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/dimensions..st b/ObjectStatistics.package/ObjectStatistics.class/instance/dimensions..st new file mode 100644 index 0000000..d496295 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/dimensions..st @@ -0,0 +1,3 @@ +accessing +dimensions: anObject + dimensions := anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/dimensions.st b/ObjectStatistics.package/ObjectStatistics.class/instance/dimensions.st new file mode 100644 index 0000000..a855475 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/dimensions.st @@ -0,0 +1,3 @@ +accessing +dimensions + ^ dimensions \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/for.with..st b/ObjectStatistics.package/ObjectStatistics.class/instance/for.with..st new file mode 100644 index 0000000..eed2551 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/for.with..st @@ -0,0 +1,4 @@ +fluent api +for: aStateSpec with: dimensionsCreationBlock + + dimensionsBuilder for: aStateSpec buildDimensionsBy: dimensionsCreationBlock \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/hasDimensions.st b/ObjectStatistics.package/ObjectStatistics.class/instance/hasDimensions.st new file mode 100644 index 0000000..0dd880b --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/hasDimensions.st @@ -0,0 +1,3 @@ +testing +hasDimensions + ^dimensions notEmpty \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/ignoreMetrics..st b/ObjectStatistics.package/ObjectStatistics.class/instance/ignoreMetrics..st new file mode 100644 index 0000000..b79b994 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/ignoreMetrics..st @@ -0,0 +1,3 @@ +fluent api +ignoreMetrics: metricNames + dimensionsBuilder ignoreMetrics: metricNames \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/initialize.st b/ObjectStatistics.package/ObjectStatistics.class/instance/initialize.st new file mode 100644 index 0000000..85b45df --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/initialize.st @@ -0,0 +1,7 @@ +initialization +initialize + super initialize. + + metrics := OrderedCollection new. + dimensions := OrderedCollection new. + dimensionsBuilder := ObjectStatBuilder for: self \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/lastDimension.st b/ObjectStatistics.package/ObjectStatistics.class/instance/lastDimension.st new file mode 100644 index 0000000..f376b92 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/lastDimension.st @@ -0,0 +1,3 @@ +accessing +lastDimension + ^dimensions last \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/mainMetric.st b/ObjectStatistics.package/ObjectStatistics.class/instance/mainMetric.st new file mode 100644 index 0000000..2315733 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/mainMetric.st @@ -0,0 +1,3 @@ +accessing +mainMetric + ^metrics first \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/metrics..st b/ObjectStatistics.package/ObjectStatistics.class/instance/metrics..st new file mode 100644 index 0000000..55519a6 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/metrics..st @@ -0,0 +1,3 @@ +accessing +metrics: anObject + metrics := anObject \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/metrics.st b/ObjectStatistics.package/ObjectStatistics.class/instance/metrics.st new file mode 100644 index 0000000..51f8e89 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/metrics.st @@ -0,0 +1,3 @@ +accessing +metrics + ^ metrics \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/newForDimension..st b/ObjectStatistics.package/ObjectStatistics.class/instance/newForDimension..st new file mode 100644 index 0000000..d10c76a --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/newForDimension..st @@ -0,0 +1,10 @@ +accessing +newForDimension: anObjectStatDimension + | newStat newMetrics | + newStat := self class new. + newMetrics := metrics + reject: [ :each | anObjectStatDimension isIgnoreMetric: each] + thenCollect: [ :each | each newForDimension ]. + newStat metrics: newMetrics. + anObjectStatDimension prepareStatistics: newStat. + ^newStat \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/objectsSpec.st b/ObjectStatistics.package/ObjectStatistics.class/instance/objectsSpec.st new file mode 100644 index 0000000..d165631 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/objectsSpec.st @@ -0,0 +1,3 @@ +accessing +objectsSpec + ^Any \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/printMetricsOn..st b/ObjectStatistics.package/ObjectStatistics.class/instance/printMetricsOn..st new file mode 100644 index 0000000..0ca8dc0 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/printMetricsOn..st @@ -0,0 +1,10 @@ +printing +printMetricsOn: aStream + + metrics ifEmpty: [ ^self ]. + + metrics first printOn: aStream. + metrics allButFirstDo: [ :each | + each isMeaningful ifTrue: [ + aStream << ', '. + each printOn: aStream]] \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/printOn..st b/ObjectStatistics.package/ObjectStatistics.class/instance/printOn..st new file mode 100644 index 0000000..2de7235 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/printOn..st @@ -0,0 +1,7 @@ +printing +printOn: aStream + super printOn: aStream. + + aStream << '('. + self printMetricsOn: aStream. + aStream << ')'. \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/instance/with..st b/ObjectStatistics.package/ObjectStatistics.class/instance/with..st new file mode 100644 index 0000000..589cbfa --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/instance/with..st @@ -0,0 +1,4 @@ +fluent api +with: dimensionsCreationBlock + + dimensionsBuilder buildDimensionsBy: dimensionsCreationBlock \ No newline at end of file diff --git a/ObjectStatistics.package/ObjectStatistics.class/properties.json b/ObjectStatistics.package/ObjectStatistics.class/properties.json new file mode 100644 index 0000000..2b4cfa5 --- /dev/null +++ b/ObjectStatistics.package/ObjectStatistics.class/properties.json @@ -0,0 +1,15 @@ +{ + "commentStamp" : "DenisKudryashov 6/1/2016 16:11", + "super" : "Object", + "category" : "ObjectStatistics", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ + "metrics", + "dimensions", + "dimensionsBuilder" + ], + "name" : "ObjectStatistics", + "type" : "normal" +} \ No newline at end of file diff --git a/ObjectStatistics.package/monticello.meta/categories.st b/ObjectStatistics.package/monticello.meta/categories.st new file mode 100644 index 0000000..994bc07 --- /dev/null +++ b/ObjectStatistics.package/monticello.meta/categories.st @@ -0,0 +1 @@ +SystemOrganization addCategory: #ObjectStatistics! diff --git a/ObjectStatistics.package/monticello.meta/initializers.st b/ObjectStatistics.package/monticello.meta/initializers.st new file mode 100644 index 0000000..e69de29 diff --git a/ObjectStatistics.package/monticello.meta/package b/ObjectStatistics.package/monticello.meta/package new file mode 100644 index 0000000..73a0a1f --- /dev/null +++ b/ObjectStatistics.package/monticello.meta/package @@ -0,0 +1 @@ +(name 'ObjectStatistics') \ No newline at end of file diff --git a/ObjectStatistics.package/properties.json b/ObjectStatistics.package/properties.json new file mode 100644 index 0000000..6f31cf5 --- /dev/null +++ b/ObjectStatistics.package/properties.json @@ -0,0 +1 @@ +{ } \ No newline at end of file