package gw.rating.flow.domain uses gw.api.rating.MultiFactorVariable uses gw.lang.reflect.IType uses gw.rating.RateRoutineExecutionLogger uses gw.rating.flow.util.QueryUtils class RateTableMultiFactorLookupOperand extends RateTableLookupOperand { construct(code : String, opType : CalcStepOperatorType, facs : List, args : List, numLeft: int, numRight: int) { this(code, opType, facs, args, numLeft, numRight, null) } construct(code : String, opType : CalcStepOperatorType, facs : List, args : List, numLeft: int, numRight: int, aHighlightElement: RateRoutineHighlightElement) { super(code, opType, facs, args, numLeft, numRight) _highlightElement = aHighlightElement } override protected function generateValue(context : GenerationContext) { var patternCode = context.PatternCode var definition = QueryUtils.getRateTableDefinitionForCodeAndLine(TableCode, patternCode) if (definition == null) { throw new IllegalStateException("Could not find table ${TableCode}") } var orderTable : Map = {} definition.SortedMatchOps.eachWithIndex(\ op, i -> orderTable.put(op.Name, i)) if(context.WorksheetsEnabled){ context.append("_log.loggedRateQuery>(") context.WorksheetHelper.generateRateQueryConstructor(this) } else { context.append("new gw.rating.flow.MultiFactorRateQuery(") } context.append(CalcRoutine.RATE_BOOK_SYMBOL).append(", \"") context.append(TableCode) context.append("\")") for (arg in _args.orderBy(\ a -> orderTable.get(a.Parameter)) index i) { context.append(arg.genRateQueryParam(i)) } context.append(".getFactors({") context.append(Factors.map(\f -> "\"${f}\"").join(",")) context.append("})") } override function getDataType(context: GenerationContext) : IType { return MultiFactorVariable } }