package gw.rating.rtm.matchop /** * This is a not-very-nice fix to a problem: The rate tables store coverage.patterncode (publicid). When we query the * tables we query using the pattern code. The worksheets that log this query also record this query with the * patterncode. There was a PC-wide push to hide the pattern code from UI elements and instead display codeIdentifier. * Patterncodes are derived from publicIds which may be something obscure and not convey very clearly what the coverage * is. The codeIdentifier does convey clearly though. At the time of this writing, showing the publicId on the worksheet * is considered a critical bug. *
* With this fix, the intent is to let rate query use pattern code (publicId) and worksheets use the code identifier * The rate query wants the parameter as a comparable and so the pattern code is the comparable value representation. * The worksheet wants the string representation and so the string representation is the code identifier. */ @ReadOnly class CoverageParam implements Comparable { private var _codeIdentifier : String private var _patternCode : Comparable as readonly Value construct(codeIdentifier : String, patternCode : Comparable) { // best to not wrap null as this is a comparable, comparison with native comparables like int, string and bd are // likely preceded by null checks. Also, null comparable will just throw a null pointer exception in the compareTo // and i don't want to make assumptions about null values in the compareTo method if (codeIdentifier == null || patternCode == null) { throw new IllegalArgumentException("Coverage Param cannot wrap null. PatternCode: ${patternCode}, CodeIdentifier: ${codeIdentifier}") } this._codeIdentifier = codeIdentifier this._patternCode = patternCode } override function compareTo(o : Object) : int { return _patternCode.compareTo(o) } override function toString() : String { return _codeIdentifier; } }