Class WeightedNameDistance
java.lang.Object
org.ek9lang.compiler.phase5.WeightedNameDistance
- All Implemented Interfaces:
ToIntBiFunction<String,String>
THE distance E11030 reports (
ConfusinglySimilarNamesOrError) - the weighted edit distance its rich message
describes, and nothing else: a character inserted, removed or changed costs 2 wherever it is (the first and last
positions included), two ADJACENT characters swapped cost 2 (one edit, as Damerau counts it -
title/titel) except at the FIRST letter (positions 0-1), where a swap is two changes
(latitude/altitude, 4 - Steve, 2026-10-12), and a change of case alone costs 1.
Deliberately NOT org.ek9.lang.Levenshtein.costOfMatch: that is the runtime's fuzzy match, which charges
an insertion at the START 1 (so zqname/name came out at 2, one edit) and has no swap. Its
asymmetry made the message untrue (lane lang-syntax, fix round 1). Was
ConfusinglySimilarNamesOrError.weightedDistance (no-statics lane P2, 2026-10-29).
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
EDIT_COST
static final int EDIT_COSTThe cost of one edit: a character inserted, removed or changed, or two adjacent characters swapped.- See Also:
-
CASE_COST
static final int CASE_COSTThe cost of a change of case alone (t/T).- See Also:
-
-
Constructor Details
-
WeightedNameDistance
WeightedNameDistance()
-
-
Method Details
-
applyAsInt
- Specified by:
applyAsIntin interfaceToIntBiFunction<String,String>
-