Class CouplingTracker
java.lang.Object
org.ek9lang.compiler.phase5.CouplingTracker
Tracks efferent coupling (Ce) - the number of external types a construct depends on.
Based on CBO (Coupling Between Objects) from Chidamber & Kemerer (1994).
Uses a stack to handle nested constructs (e.g., inner classes). Built-in types from org.ek9.lang are excluded from the count as they are universal primitives that don't contribute to meaningful coupling.
Complexity: O(T) where T = total type references - linear, not N-squared.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) booleanisEmpty()Check if there are any scopes being tracked.(package private) intPop the current scope and return the coupling count.(package private) voidPush a new scope for tracking coupling of a construct.(package private) voidrecordDependency(ISymbol type) Record a type dependency.
-
Constructor Details
-
CouplingTracker
CouplingTracker()
-
-
Method Details
-
pushScope
void pushScope()Push a new scope for tracking coupling of a construct. -
recordDependency
Record a type dependency. Filters out built-in types.- Parameters:
type- the symbol representing the dependent type
-
popAndGetCouplingCount
int popAndGetCouplingCount()Pop the current scope and return the coupling count.- Returns:
- the number of unique external type dependencies
-
isEmpty
boolean isEmpty()Check if there are any scopes being tracked.- Returns:
- true if no scopes are on the stack
-