Skip to content

Commit

Permalink
Refactoring of custom visualizations.
Browse files Browse the repository at this point in the history
  • Loading branch information
luque committed Nov 27, 2018
1 parent 4ed3725 commit 47887fe
Show file tree
Hide file tree
Showing 65 changed files with 313 additions and 292 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"instvars" : [
"package"
],
"name" : "DMMAbstractMetrics",
"name" : "DMMAbstractPackageMetrics",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"commentStamp" : "RafaelLuque 11/21/2018 17:56",
"super" : "DMMAbstractMetrics",
"super" : "DMMAbstractPackageMetrics",
"category" : "DMM-Core",
"classinstvars" : [ ],
"pools" : [ ],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
public - api
public - metrics
mainSequenceDistance
"Distance which measures how far away a package is from the ideal main sequence in the I/A graph.
The metric ranges from [0, ~0.707]"

^ self normalizedMainSequenceDistance / 2 sqrt.
^ self normalizedMainSequenceDistance / 2 sqrt

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public - api
public - metrics
normalizedMainSequenceDistance
"This metric is much more convenient than the mainSequenceDistance since it ranges from [0, 1].
Zero indicates that the package is directly on the main sequence.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"commentStamp" : "RafaelLuque 11/21/2018 18:38",
"super" : "DMMAbstractMetrics",
"super" : "DMMAbstractPackageMetrics",
"category" : "DMM-Core",
"classinstvars" : [ ],
"pools" : [ ],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
instance creation
defaultExcludedSystemPackages
^ {#'Kernel-Objects'} asOrderedCollection
^ {#'Kernel-Objects' . #'Collections-Abstract' . #'Collections-Unordered' . #'System-Support'} asOrderedCollection
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
public - relationships
afferentAssocs
"Associations from the classes outside the package that depend on classes within the package to the dependent classes inside the package"

^ afferentAssocs ifNil: [
afferentAssocs := OrderedCollection new.
self package definedClasses
inject: afferentAssocs
into: [ :assocs :aClassInPackage |
assocs
addAll:
((self referingClassesFor: aClassInPackage excluding: self excludedPackages)
collect: [ :afferentClass | afferentClass -> aClassInPackage ]);
yourself ].
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public - relationships
afferentAssocsFrom: outsidePackage
"the afferent associations between classes from the specified outside package that depend on classes within this package"

^ self afferentAssocs select: [ :assoc | assoc key package = outsidePackage ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public - relationships
afferentClasses
"the classes outside the package that depend on classes within the package"


^ self afferentAssocs collect: #key as: Set
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
public - relationships
afferentClassesDict
^ self afferentAssocs
inject: Dictionary new
into: [ :dict :assoc |
dict
at: assoc value
ifPresent: [ :afferentClasses | afferentClasses add: assoc key ]
ifAbsentPut: [ {assoc key} asOrderedCollection ]; yourself ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public - relationships
afferentClassesFrom: outsidePackage
"the classes in the specified outside package that depend on classes within this package"

^ (self afferentAssocsFrom: outsidePackage) collect: #key as: Set
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ public - metrics
afferentCoupling
"the number of classes outside the package that depend on classes within the package"

| outsideClassesReferingThisPackage |
outsideClassesReferingThisPackage := self package definedClasses flatCollect: [ :aClass | self referingClassesFor: aClass excluding: self excludedPackages ] as: Set.
^ outsideClassesReferingThisPackage size
^ self afferentClasses size
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public - relationships
afferentCouplingFrom: outsidePackage
"the afferent coupling taking into account only the specified outside package"

^ (self afferentClassesFrom: outsidePackage) size
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
public - relationships
afferentCouplingPerClass: aClass

^ self afferentClassesDict at: aClass ifPresent: [ :afferentClasses | afferentClasses size ] ifAbsent: [ 0 ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
public - relationships
afferentPackageAssocs
"Associations from the outside packages that depend on classes within the package to this package"


^ self afferentAssocs collect: [ :assoc | assoc key package -> assoc value package ]

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public - relationships
afferentPackages
"the packages that depend on classes within the package"

^ self afferentClasses collect: #package
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public - relationships
dependentClasses
"the classes outside the package on which depend the classes inside the package"

^ self efferentAssocs collect: #value as: Set
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
private - util
dependentClassesFor: aClass excluding: aCollection
^ aClass dependentClasses asOrderedCollection select: [ :aDependentClass | (aCollection includes: aDependentClass category) not ]

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public - relationships
dependentPackages
"the packages that depend on classes within the package"

^ self dependentClasses collect: #package as: Set
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
public - relationships
efferentAssocs
"Associations from the classes inside the package that depend on classes outside the package"

^ efferentAssocs ifNil: [
efferentAssocs := OrderedCollection new.
self package definedClasses
inject: efferentAssocs
into: [ :assocs :aClassInPackage |
assocs
addAll:
((self dependentClassesFor: aClassInPackage excluding: self excludedPackages)
collect: [ :dependentClass | aClassInPackage -> dependentClass ]);
yourself ].
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public - relationships
efferentAssocsToward: outsidePackage
"the efferent associations between classes depending on the specified outside package"

^ self efferentAssocs select: [ :assoc | assoc value package = outsidePackage ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public - relationships
efferentClasses
"the classes inside the package that depend on classes outside the package"

^ self efferentAssocs collect: #key as: Set
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public - relationships
efferentClassesDict
^ self efferentAssocs
inject: Dictionary new
into: [ :dict :assoc |
dict
at: assoc key
ifPresent: [ :efferentClasses | efferentClasses add: assoc value ]
ifAbsentPut: [ {assoc value} asOrderedCollection ];
yourself ]

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public - relationships
efferentClassesToward: outsidePackage
"the efferent classes in this package depending on classes in the specified outside package"

^ (self efferentAssocsToward: outsidePackage) collect: #key as: Set
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@ public - metrics
efferentCoupling
"the number of classes inside the package that depend on classes outside the package"

| classesWithOutsideDependencies |
classesWithOutsideDependencies := self package definedClasses
select: [ :aClassInPackage | (self dependentClassesFor: aClassInPackage exluding: (self excludedPackages)) isNotEmpty ].
^ classesWithOutsideDependencies size
^ self efferentClasses size
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public - relationships
efferentCouplingPerClass: aClass
^ self efferentClassesDict at: aClass ifPresent: [ :efferentClasses | efferentClasses size ] ifAbsent: [ 0 ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public - relationships
efferentCouplingToward: outsidePackage
"the efferent coupling toward the specified outside package"

^ (self efferentClassesToward: outsidePackage) size
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public - relationships
efferentPackageAssocs
"Associations from the package to the outside pacakge containing dependant classes"


^ self efferentAssocs collect: [ :assoc | assoc key package -> assoc value package ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
private - util
printString
^ self package packageName , '(I=' , (self instability round: 3) asString , ')'
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"commentStamp" : "RafaelLuque 11/21/2018 17:27",
"super" : "DMMAbstractMetrics",
"super" : "DMMAbstractPackageMetrics",
"category" : "DMM-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"excludedNonVolatilePackages"
"excludedNonVolatilePackages",
"afferentAssocs",
"efferentAssocs"
],
"name" : "DMMStabilityMetrics",
"type" : "normal"
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 47887fe

Please sign in to comment.