The notion of density
We introduce in symfinder-2 a density metric which itself relies on the definition of a variability implementation. This represents any variability-related class in a system under study, i.e., a class with some variability, at the class level, and/or at the method level, and/or being a variant of another vp.
Definition 1. (Variability Implementation) A specific variability implementation \(v\) from the set of all identified variability implementations \(\mathcal{V}\) is defined as a tuple
\begin{equation} \langle type, asset, var_{class}, var_{method}, neighbors \rangle \end{equation}
- \(type \in \{\)
CLASS_LEVEL_VP, METHOD_LEVEL_VP, VARIANT
\(\}\) ; - \(asset\) : the class it represents ;
- \(var_{class}\) : the number of variants of \(v\) at class level ;
- \(var_{method}\) : the number of variants of \(v\) at method level ;
- \(neighbors\) : a set of variability implementations to which \(v\) is linked through a usage relationship.
Definition 2. (Density) We define a measure of density \(\Delta: \mathcal{V} \rightarrow \{true,false\}\) which, given a variability implementation \(v\), determines if it is part of a dense zone of variability implementations. This determination is based on two parameters: the first one defines a minimum number of variants for \(v\), and the second one a maximum distance in terms of usage relationships between two such variability implementations (equivalent to edge hops in the usage graph).
\[\Delta_{nbVars,nbHops}(v) = HV_{nbVars}(v) \wedge getHVNeighborsAtLevel_v(nbHops) \neq \emptyset\]with
\[\begin{aligned} HV_{nbVars}(v) = &(type_v = CLASS\_LEVEL\_VP \wedge var_{class_v} \geq nbVars) \vee \\ & (type_v = METHOD\_LEVEL\_VP \wedge var_{method_v} \geq nbVars) \end{aligned}\]and \(getHVNeighborsAtLevel_v(n)\) being a helper function returning the set of variability implementations \(\mathcal{V}'\) such that, for each \(v' \in \mathcal{V}'\) :
- \(HV_{nbVars}(v') = true\) ;
- \(v'\) is distant of maximum \(n\) usage relationships to \(v\).
The set of variability implementations in dense zones for a given couple of parameters \((nbVars,nbHops)\) is thus given by
\[S = \{v \in \mathcal{V} \mid \Delta_{nbVars,nbHops}(v)\}\]The density metric is directly dependent of its two input parameters, i.e., the number of variants and the number of hops on usage edges. Consequently, defining a threshold over each these two parameters enable to filter in and out the variability implementation classes. A dense zone of variability will then been only displayed with classes whose number of variants is equal or above its variant threshold or distant by less or equal usage hops than its usage threshold.