package gw.rating.flow.domain uses gw.lang.reflect.IType uses java.math.BigDecimal uses java.util.List uses gw.api.extension.ExtensionInterfaces class RoundingMethodOperand extends CalcStepValueOperand { var _roundMode : RoundingModeType as readonly RoundingMode var _scale : RoundingScaleType as readonly RoundingScale var _generatedValueCode : String as readonly GeneratedValueCode var _isTermAmount : boolean as IsTermAmountAssignment var _calculationOperands : List as CalculationOperands construct( mode : RoundingModeType, scale : RoundingScaleType, opType : CalcStepOperatorType, numLeft: int, numRight: int) { this(mode, scale, opType, numLeft, numRight, null) } construct( mode : RoundingModeType, scale : RoundingScaleType, opType : CalcStepOperatorType, numLeft: int, numRight: int, aHighlightElement: RateRoutineHighlightElement) { super(opType, numLeft, numRight) _roundMode = mode _scale = scale _highlightElement = aHighlightElement } override function getDataType(context: GenerationContext) : IType { return BigDecimal } override property get OperandType() : CalcStepOperandType { return CalcStepOperandType.TC_ROUNDING } override protected function generateValue(context: GenerationContext) { context.append(" ${ExtensionInterfaces.ICalcRoutineRoundingMethodExtensions.RoundingMethodType.Name}.setScale(") context.append("\n") generateSub(CalculationOperands, context) context.append(", ") context.append("\n") context.WorksheetHelper.wrapFunctionArgument("Scale", \ -> { context.append("typekey.RoundingScaleType.get(\"${RoundingScale.Code}\")") }) context.append(", ") context.WorksheetHelper.wrapFunctionArgument("Mode", \ -> { context.append("typekey.RoundingModeType.get(\"${RoundingMode.Code}\"))") }) } private function generateSub(operandList : List, context: GenerationContext){ var code : block() = \ -> { operandList.each(\ op -> { if (op.OperatorType != TC_STORE) { context.append("\n ") context.append(op.OperatorType.ExpressionOperator) context.append(" ") } op.generate(context) }) } context.WorksheetHelper.wrapFunctionArgument("Value", code) } }