public CodegenExpression codegen(CodegenExpression input, Class inputType, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { if (inputType.isPrimitive() || JavaClassHelper.isSubclassOrImplementsInterface(inputType, Number.class)) { return SimpleNumberCoercerFactory.SimpleNumberCoercerBigDecDouble.codegenBigDec(input, inputType); } return staticMethod(BigDecimal.class, "valueOf", exprDotMethod(CodegenExpressionBuilder.cast(Number.class, input), "doubleValue")); } }
protected void readWODistinct(CodegenExpressionRef row, int col, CodegenExpressionRef input, CodegenExpressionRef unitKey, CodegenMethod method, CodegenClassScope classScope) { method.getBlock() .apply(readBoolean(row, hasLeave, input)) .assignRef(rowDotRef(row, points), staticMethod(this.getClass(), "readPoints", input)); }
public void readCodegen(CodegenExpressionRef row, int col, CodegenExpressionRef input, CodegenMethod method, CodegenExpressionRef unitKey, CodegenClassScope classScope) { if (mode.isHasHA()) { method.getBlock().assignRef(rowDotRef(row, state), staticMethod(mode.getSerde(), "read", input)); } }
public CodegenExpression codegenCreateReader(CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { CodegenMethod method = parent.makeChild(AggregationMultiFunctionAggregationMethod.class, this.getClass(), classScope); method.getBlock() .methodReturn(staticMethod(AggregationMethodSortedNoParamFactory.class, "makeSortedAggregationNoParam", enumValue(AggregationMethodSortedEnum.class, aggMethod.name()), constant(underlyingClass))); return localMethod(method); }
static void processViewResultCodegen(ResultSetProcessorHandThroughFactoryForge prototype, CodegenMethod method) { CodegenExpression oldEvents = constantNull(); if (prototype.isSelectRStream()) { oldEvents = staticMethod(ResultSetProcessorHandThroughUtil.class, METHOD_GETSELECTEVENTSNOHAVINGHANDTHRUVIEW, REF_SELECTEXPRPROCESSOR, REF_OLDDATA, constant(false), REF_ISSYNTHESIZE, REF_AGENTINSTANCECONTEXT); } CodegenExpression newEvents = staticMethod(ResultSetProcessorHandThroughUtil.class, METHOD_GETSELECTEVENTSNOHAVINGHANDTHRUVIEW, REF_SELECTEXPRPROCESSOR, REF_NEWDATA, constant(true), REF_ISSYNTHESIZE, REF_AGENTINSTANCECONTEXT); method.getBlock() .declareVar(EventBean[].class, "selectOldEvents", oldEvents) .declareVar(EventBean[].class, "selectNewEvents", newEvents) .methodReturn(newInstance(UniformPair.class, ref("selectNewEvents"), ref("selectOldEvents"))); }
public static CodegenExpression codegen(DTLocalLDTIntervalForge forge, CodegenExpressionRef start, CodegenExpressionRef end, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { CodegenExpression timeZoneField = codegenClassScope.addOrGetFieldSharable(RuntimeSettingsTimeZoneField.INSTANCE); CodegenMethod methodNode = codegenMethodScope.makeChild(Boolean.class, DTLocalLDTIntervalEval.class, codegenClassScope).addParam(LocalDateTime.class, "startTimestamp").addParam(LocalDateTime.class, "endTimestamp"); methodNode.getBlock() .declareVar(long.class, "start", staticMethod(DatetimeLongCoercerLocalDateTime.class, "coerceLDTToMilliWTimezone", ref("startTimestamp"), timeZoneField)) .declareVar(long.class, "end", staticMethod(DatetimeLongCoercerLocalDateTime.class, "coerceLDTToMilliWTimezone", ref("endTimestamp"), timeZoneField)) .methodReturn(forge.intervalForge.codegen(ref("start"), ref("end"), methodNode, exprSymbol, codegenClassScope)); return localMethod(methodNode, start, end); } }
public CodegenExpression initCtorScoped() { return staticMethod(VariableDeployTimeResolver.class, "resolveVariableReaderPerCP", constant(metaWVisibility.getVariableName()), constant(metaWVisibility.getVariableVisibility()), constant(metaWVisibility.getVariableModuleName()), constant(metaWVisibility.getOptionalContextName()), EPStatementInitServices.REF); }
private CodegenMethod navigateMethodCodegen(CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { CodegenMethod navigateRecordMethod = navigateRecordMethodCodegen(codegenMethodScope, codegenClassScope); return codegenMethodScope.makeChild(GenericData.Record.class, this.getClass(), codegenClassScope).addParam(GenericData.Record.class, "record").getBlock() .declareVar(Object.class, "value", staticMethod(AvroEventBeanGetterNestedIndexRooted.class, "getAtIndex", ref("record"), constant(posTop), constant(index))) .ifRefNullReturnNull("value") .methodReturn(CodegenExpressionBuilder.localMethod(navigateRecordMethod, castRef(GenericData.Record.class, "value"))); }
protected static CodegenExpression codegenWidenArrayAsListMayNull(CodegenExpression expression, Class arrayType, CodegenMethodScope codegenMethodScope, Class generator, CodegenClassScope codegenClassScope) { CodegenMethod method = codegenMethodScope.makeChild(Collection.class, generator, codegenClassScope).addParam(Object.class, "input").getBlock() .ifRefNullReturnNull("input") .methodReturn(staticMethod(Arrays.class, "asList", cast(arrayType, ref("input")))); return localMethodBuild(method).pass(expression).call(); } }
public static CodegenExpression codegen(DTLocalZDTIntervalForge forge, CodegenExpression inner, Class innerType, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { CodegenMethod methodNode = codegenMethodScope.makeChild(Boolean.class, DTLocalZDTIntervalEval.class, codegenClassScope).addParam(ZonedDateTime.class, "target"); methodNode.getBlock() .declareVar(long.class, "time", staticMethod(DatetimeLongCoercerZonedDateTime.class, "coerceZDTToMillis", ref("target"))) .methodReturn(forge.intervalForge.codegen(ref("time"), ref("time"), methodNode, exprSymbol, codegenClassScope)); return localMethod(methodNode, inner); }
public static CodegenExpression codegenZDT(CalendarWithDateForge forge, CodegenExpression zdt, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { CodegenMethod methodNode = codegenMethodScope.makeChild(ZonedDateTime.class, CalendarWithDateForgeOp.class, codegenClassScope).addParam(ZonedDateTime.class, "value"); CodegenBlock block = methodNode.getBlock(); codegenDeclareInts(block, forge, methodNode, exprSymbol, codegenClassScope); block.methodReturn(staticMethod(CalendarWithDateForgeOp.class, "actionSetYMDZonedDateTime", ref("value"), ref("year"), ref("month"), ref("day"))); return localMethod(methodNode, zdt); }
static void getIteratorJoinCodegen(CodegenMethod method) { method.getBlock() .declareVar(UniformPair.class, EventBean[].class, "result", exprDotMethod(ref("this"), "processJoinResult", REF_JOINSET, staticMethod(Collections.class, "emptySet"), constant(true))) .methodReturn(newInstance(ArrayEventIterator.class, cast(EventBean[].class, exprDotMethod(ref("result"), "getFirst")))); } }
public static CodegenExpression codegen(EnumTakeForge forge, EnumForgeCodegenParams args, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { ExprForgeCodegenSymbol scope = new ExprForgeCodegenSymbol(false, null); CodegenMethod methodNode = codegenMethodScope.makeChildWithScope(Collection.class, EnumTakeForgeEval.class, scope, codegenClassScope).addParam(EnumForgeCodegenNames.PARAMS); Class sizeType = forge.sizeEval.getEvaluationType(); CodegenBlock block = methodNode.getBlock().declareVar(sizeType, "size", forge.sizeEval.evaluateCodegen(sizeType, methodNode, scope, codegenClassScope)); if (!sizeType.isPrimitive()) { block.ifRefNullReturnNull("size"); } block.methodReturn(staticMethod(EnumTakeForgeEval.class, "evaluateEnumTakeMethod", EnumForgeCodegenNames.REF_ENUMCOLL, SimpleNumberCoercerFactory.SimpleNumberCoercerInt.codegenInt(ref("size"), sizeType))); return localMethod(methodNode, args.getEps(), args.getEnumcoll(), args.getIsNewData(), args.getExprCtx()); }
private CodegenMethod getCodegen(CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { return codegenMethodScope.makeChild(Object.class, this.getClass(), codegenClassScope).addParam(GenericData.Record.class, "record").getBlock() .declareVar(GenericData.Record.class, "inner", cast(GenericData.Record.class, exprDotMethod(ref("record"), "get", constant(top)))) .ifRefNullReturnNull("inner") .declareVar(Collection.class, "collection", cast(Collection.class, exprDotMethod(ref("inner"), "get", constant(pos)))) .methodReturn(staticMethod(AvroEventBeanGetterIndexed.class, "getAvroIndexedValue", ref("collection"), constant(index))); }
public CodegenExpression eventBeanGetCodegen(CodegenExpression beanExpression, CodegenMethodScope parent, CodegenClassScope classScope) { CodegenMethod method = parent.makeChild(Object.class, this.getClass(), classScope).addParam(EventBean.class, "eventBean"); CodegenMethod methodExpr = CodegenLegoMethodExpression.codegenExpression(eval.getForge(), method, classScope); method.getBlock() .declareVar(EventBean[].class, "events", newArrayWithInit(EventBean.class, ref("eventBean"))) .declareVar(Object.class, "code", localMethod(methodExpr, ref("events"), constantTrue(), constantNull())) .methodReturn(staticMethod(ContextControllerHashedGetterHashSingleForge.class, "objectToNativeHash", ref("code"), constant(granularity))); return localMethod(method, beanExpression); } }
public CodegenExpression evaluateCodegenUninstrumented(Class requiredType, CodegenMethodScope parent, ExprForgeCodegenSymbol symbols, CodegenClassScope codegenClassScope) { CodegenMethod method = parent.makeChild(requiredType, this.getClass(), codegenClassScope); method.getBlock().declareVar(Object.class, "result", staticMethod(ExprTableIdentNode.class, "tableColumnAggValue", constant(streamNum), constant(columnNum), symbols.getAddEPS(method), symbols.getAddIsNewData(method), symbols.getAddExprEvalCtx(method))); if (requiredType == Object.class) { method.getBlock().methodReturn(ref("result")); } else { method.getBlock().methodReturn(cast(JavaClassHelper.getBoxedType(requiredType), ref("result"))); } return localMethod(method); }
protected void apply(CodegenMethod method, CodegenClassScope classScope) { CodegenExpression timeProvider = classScope.addOrGetFieldSharable(TimeProviderField.INSTANCE); method.getBlock().declareVar(long.class, "timestamp", exprDotMethod(timeProvider, "getTime")) .exprDotMethod(points, "add", ref("timestamp")) .declareVar(boolean.class, "leave", staticMethod(AggregatorRateEver.class, "removeFromHead", points, ref("timestamp"), constant(factory.getIntervalTime()))) .assignCompound(hasLeave, "|", ref("leave")); }
public CodegenExpression codegenDate(CodegenExpression inner, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { CodegenExpression timeZoneField = codegenClassScope.addOrGetFieldSharable(RuntimeSettingsTimeZoneField.INSTANCE); CodegenMethod methodNode = codegenMethodScope.makeChild(int.class, ReformatEvalForge.class, codegenClassScope).addParam(Date.class, "d"); methodNode.getBlock() .declareVar(Calendar.class, "cal", staticMethod(Calendar.class, "getInstance", timeZoneField)) .expression(exprDotMethod(ref("cal"), "setTimeInMillis", exprDotMethod(ref("d"), "getTime"))) .methodReturn(calendarEval.codegen(ref("cal"))); return localMethod(methodNode, inner); }
public static CodegenExpression codegen(DTLocalLongOpsReformatForge forge, CodegenExpression inner, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { CodegenExpression timeZoneField = codegenClassScope.addOrGetFieldSharable(RuntimeSettingsTimeZoneField.INSTANCE); CodegenMethod methodNode = codegenMethodScope.makeChild(forge.reformatForge.getReturnType(), DTLocalLongOpsReformatEval.class, codegenClassScope).addParam(long.class, "target"); CodegenBlock block = methodNode.getBlock() .declareVar(Calendar.class, "cal", staticMethod(Calendar.class, "getInstance", timeZoneField)) .expression(forge.timeAbacus.calendarSetCodegen(ref("target"), ref("cal"), methodNode, codegenClassScope)); DTLocalUtil.evaluateCalOpsCalendarCodegen(block, forge.calendarForges, ref("cal"), methodNode, exprSymbol, codegenClassScope); block.methodReturn(forge.reformatForge.codegenCal(ref("cal"), methodNode, exprSymbol, codegenClassScope)); return localMethod(methodNode, inner); } }
public static CodegenExpression codegen(DTLocalDateOpsReformatForge forge, CodegenExpression inner, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { CodegenMethod methodNode = codegenMethodScope.makeChild(forge.reformatForge.getReturnType(), DTLocalDateOpsReformatEval.class, codegenClassScope).addParam(Date.class, "target"); CodegenExpression timeZoneField = codegenClassScope.addOrGetFieldSharable(RuntimeSettingsTimeZoneField.INSTANCE); CodegenBlock block = methodNode.getBlock() .declareVar(Calendar.class, "cal", staticMethod(Calendar.class, "getInstance", timeZoneField)) .expression(exprDotMethod(ref("cal"), "setTimeInMillis", exprDotMethod(ref("target"), "getTime"))); DTLocalUtil.evaluateCalOpsCalendarCodegen(block, forge.calendarForges, ref("cal"), methodNode, exprSymbol, codegenClassScope); block.methodReturn(forge.reformatForge.codegenCal(ref("cal"), methodNode, exprSymbol, codegenClassScope)); return localMethod(methodNode, inner); } }