Class InputVarietyDenominatorCalculator
java.lang.Object
org.ek9lang.compiler.support.inputvariety.InputVarietyDenominatorCalculator
Computes a public construct's input-variation
InputVarietyDenominator — the pairwise
opportunity space of its parameters (design §4.1). Cheap: O(k²) over already-derived
per-parameter varieties, cheaper than cyclomatic complexity.
This is the static, every-build half of the metric (§2 commitment 1) — the denominator is a
construct-local property cached like COMPLEXITY. The dynamic numerator is a later stage.
Mirrors the Counter → Acceptable*OrError shape of the existing complexity metrics
(§11.2): this is the counter; the phase-5 listener wiring + squirrel + optional gate come next.
-
Constructor Summary
ConstructorsConstructorDescriptionInputVarietyDenominatorCalculator(EquivalenceClassModel equivalenceClassModel) -
Method Summary
Modifier and TypeMethodDescriptionforInstanceMethod(ISymbol receiverType, List<ISymbol> parameterTypes) The figures for an instance method / operator, treating the receiver type as an implicit parameterp0(design §4.5): its leaf dimensions are prepended to the argument leaves, so a no-arg instance method (e.g.forParameterTypes(List<ISymbol> parameterTypes) The denominator for a construct whose parameters have the given resolved type symbols, in declaration order.pairwise(List<TypeVariety> leafVarieties) The figures over a flattened list of leaf varieties.
-
Constructor Details
-
InputVarietyDenominatorCalculator
public InputVarietyDenominatorCalculator() -
InputVarietyDenominatorCalculator
-
-
Method Details
-
forParameterTypes
The denominator for a construct whose parameters have the given resolved type symbols, in declaration order. Each type is mapped to its variety viaEquivalenceClassModel, then combined pairwise. -
forInstanceMethod
public InputVarietyDenominator forInstanceMethod(ISymbol receiverType, List<ISymbol> parameterTypes) The figures for an instance method / operator, treating the receiver type as an implicit parameterp0(design §4.5): its leaf dimensions are prepended to the argument leaves, so a no-arg instance method (e.g.pop()) is scored against its receiver's states rather than being exempt. Constructors and functions have no receiver and useforParameterTypes(List). Both sides flatten viaEquivalenceClassModel.leavesOf(ISymbol)so a record contributes leaves, never a product — this is what stops thereceiver 81 × arg 81compounding structurally. -
pairwise
The figures over a flattened list of leaf varieties. Pure — unit-testable without symbols.k == 0→ exempt. The floor is always Σ leaf class-counts (1-wise each-choice). The ceiling (pairwiseDenominator) is:k == 1→ the single leaf's class count;k >= 2→ Σ over leaf pairs(i<j)ofclassCount(li) × classCount(lj).
-