Class ModuleCouplingTracker
java.lang.Object
org.ek9lang.compiler.phase5.ModuleCouplingTracker
Tracks module-level efferent coupling (Ce) - the number of distinct external modules
that a module depends on. Unlike CouplingTracker which counts external types per construct,
this aggregates external module dependencies across all source files in a module.
Thread-safe: designed to be used during parallel file processing where multiple PreIRListener instances (one per file) share a single ModuleCouplingTracker.
Based on software architecture research (Martin 2002 "Agile Software Development") that recommends limiting dependencies between packages/modules to reduce fragility.
Complexity: O(R) where R = total type references across all files - linear, not N-squared.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) intgetExternalModuleCount(String moduleName) Get the count of external modules referenced by a specific module.getExternalModules(String moduleName) Get all external modules referenced by a specific module (for tooling/diagnostics).Get all tracked module names.(package private) static booleanCheck if a module is exempt from module-level coupling threshold checking.(package private) voidrecordDependency(String sourceModuleName, ISymbol referencedType) Record a type dependency for a specific module.
-
Constructor Details
-
ModuleCouplingTracker
ModuleCouplingTracker()
-
-
Method Details
-
recordDependency
Record a type dependency for a specific module. Extracts the module name from the type and records if it's an external module.- Parameters:
sourceModuleName- the module where the reference occursreferencedType- the type being referenced
-
getExternalModuleCount
Get the count of external modules referenced by a specific module.- Parameters:
moduleName- the module to check- Returns:
- count of distinct external modules
-
getExternalModules
-
getTrackedModules
-
isExempt
Check if a module is exempt from module-level coupling threshold checking. Built-in modules (org.ek9.*) are exempt because they have complex but intentional interdependencies that shouldn't be flagged as quality issues.- Parameters:
moduleName- the module to check- Returns:
- true if exempt (built-in modules)
-