public CodegenExpression codegenCreateReader(CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { CodegenMethod method = parent.makeChild(AgregationMethodCountMinSketchTopK.class, this.getClass(), classScope); method.getBlock() .declareVar(AgregationMethodCountMinSketchTopK.class, "strat", newInstance(AgregationMethodCountMinSketchTopK.class)) .methodReturn(ref("strat")); return localMethod(method); } }
public CodegenExpression codegenCreateReader(CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { CodegenMethod method = parent.makeChild(AgregationMethodCountMinSketchFreq.class, this.getClass(), classScope); method.getBlock() .declareVar(AgregationMethodCountMinSketchFreq.class, "strat", newInstance(AgregationMethodCountMinSketchFreq.class)) .exprDotMethod(ref("strat"), "setFrequencyEval", ExprNodeUtilityCodegen.codegenEvaluator(frequencyEval.getForge(), method, this.getClass(), classScope)) .methodReturn(ref("strat")); return localMethod(method); } }
public CodegenExpression makeCodegen(CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { CodegenMethod method = parent.makeChild(ViewableActivatorHistorical.class, this.getClass(), classScope); method.getBlock().declareVar(ViewableActivatorHistorical.class, "hist", newInstance(ViewableActivatorHistorical.class)) .exprDotMethod(ref("hist"), "setFactory", viewableForge.make(method, symbols, classScope)) .methodReturn(ref("hist")); return localMethod(method); } }
public CodegenExpression codegenCreateReader(CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { CodegenMethod method = parent.makeChild(AggregationMethodSortedMinMaxBy.class, this.getClass(), classScope); method.getBlock() .declareVar(AggregationMethodSortedMinMaxBy.class, "strat", newInstance(AggregationMethodSortedMinMaxBy.class)) .exprDotMethod(ref("strat"), "setMax", constant(max)) .methodReturn(ref("strat")); return localMethod(method); } }
public CodegenExpression iteratorCodegen(CodegenClassScope classScope, CodegenMethod parentMethod, CodegenNamedMethods namedMethods) { CodegenMethod initArray = initArrayCodegen(namedMethods, classScope); CodegenMethod method = parentMethod.makeChildWithScope(Iterator.class, AggregatorAccessLinearJoin.class, CodegenSymbolProviderEmpty.INSTANCE, classScope); method.getBlock().ifRefNull(array) .localMethod(initArray) .blockEnd() .methodReturn(newInstance(ArrayEventIterator.class, array)); return localMethod(method); }
public CodegenExpression collectionReadOnlyCodegen(CodegenMethod parentMethod, CodegenClassScope classScope, CodegenNamedMethods namedMethods) { CodegenMethod initArray = initArrayCodegen(namedMethods, classScope); CodegenMethod method = parentMethod.makeChildWithScope(Collection.class, AggregatorAccessLinearJoin.class, CodegenSymbolProviderEmpty.INSTANCE, classScope); method.getBlock().ifRefNull(array) .localMethod(initArray) .blockEnd() .methodReturn(staticMethod(Arrays.class, "asList", array)); return localMethod(method); }
public static CodegenExpression codegen(DTLocalLocalDateTimeOpsReformatForge forge, CodegenExpression inner, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { CodegenMethod methodNode = codegenMethodScope.makeChild(forge.reformatForge.getReturnType(), DTLocalLocalDateTimeOpsReformatEval.class, codegenClassScope).addParam(LocalDateTime.class, "ldt"); CodegenBlock block = methodNode.getBlock(); DTLocalUtil.evaluateCalOpsLDTCodegen(block, "ldt", forge.calendarForges, methodNode, exprSymbol, codegenClassScope); block.methodReturn(forge.reformatForge.codegenLDT(ref("ldt"), methodNode, exprSymbol, codegenClassScope)); return localMethod(methodNode, inner); } }
public static void getEnumerableEventCodegen(AggregationAccessorFirstLastIndexWEvalForge forge, AggregationAccessorForgeGetCodegenContext context) { AggregationStateLinearForge stateForge = (AggregationStateLinearForge) context.getAccessStateForge(); CodegenMethod getBeanFirstLastIndex = getBeanFirstLastIndexCodegen(forge, context.getColumn(), context.getClassScope(), stateForge, context.getMethod(), context.getNamedMethods()); context.getMethod().getBlock().methodReturn(localMethod(getBeanFirstLastIndex)); }
private static CodegenExpression makeOpBuildOrder(Set<Integer> operatorBuildOrder, CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { CodegenMethod method = parent.makeChild(LinkedHashSet.class, DataflowDescForge.class, classScope); method.getBlock().declareVar(LinkedHashSet.class, "order", newInstance(LinkedHashSet.class, constant(CollectionUtil.capacityHashMap(operatorBuildOrder.size())))); for (Integer entry : operatorBuildOrder) { method.getBlock().exprDotMethod(ref("order"), "add", constant(entry)); } method.getBlock().methodReturn(ref("order")); return localMethod(method); }
public CodegenExpression initCtorScoped() { SAIFFInitializeSymbol symbols = new SAIFFInitializeSymbol(); CodegenMethod init = classScope.getPackageScope().getInitMethod().makeChildWithScope(AggregationMultiFunctionAggregationMethod.class, generator, symbols, classScope).addParam(EPStatementInitServices.class, EPStatementInitServices.REF.getRef()); init.getBlock().methodReturn(readerForge.codegenCreateReader(init, symbols, classScope)); return localMethod(init, EPStatementInitServices.REF); }
public static CodegenExpression codegen(DTLocalDateIntervalForge forge, CodegenExpression start, CodegenExpression end, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { CodegenMethod methodNode = codegenMethodScope.makeChild(Boolean.class, DTLocalDateIntervalEval.class, codegenClassScope).addParam(Date.class, "start").addParam(Date.class, "end"); methodNode.getBlock().methodReturn(forge.intervalForge.codegen(exprDotMethod(ref("start"), "getTime"), exprDotMethod(ref("end"), "getTime"), methodNode, exprSymbol, codegenClassScope)); return localMethod(methodNode, start, end); } }
public CodegenExpression evaluateCodegen(Class requiredType, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { CodegenMethod methodNode = codegenMethodScope.makeChild(getterReturnTypeBoxed, ExprEvaluatorStreamDTProp.class, codegenClassScope); CodegenExpressionRef refEPS = exprSymbol.getAddEPS(methodNode); methodNode.getBlock() .declareVar(EventBean.class, "event", arrayAtIndex(refEPS, constant(streamId))) .ifRefNullReturnNull("event") .methodReturn(CodegenLegoCast.castSafeFromObjectType(getterReturnTypeBoxed, getter.eventBeanGetCodegen(ref("event"), methodNode, codegenClassScope))); return localMethod(methodNode); }
public static void getEnumerableEventsCodegen(AggregationAccessorFirstLastIndexWEvalForge forge, AggregationAccessorForgeGetCodegenContext context) { AggregationStateLinearForge stateForge = (AggregationStateLinearForge) context.getAccessStateForge(); CodegenMethod getBeanFirstLastIndex = getBeanFirstLastIndexCodegen(forge, context.getColumn(), context.getClassScope(), stateForge, context.getMethod(), context.getNamedMethods()); context.getMethod().getBlock().declareVar(EventBean.class, "bean", localMethod(getBeanFirstLastIndex)) .ifRefNullReturnNull("bean") .methodReturn(staticMethod(Collections.class, "singletonList", ref("bean"))); }
private CodegenExpression getGroupKeyCountCodegen(CodegenMethodScope parent, CodegenClassScope classScope) { CodegenMethod method = parent.makeChild(int.class, AggSvcGroupByRollupForge.class, classScope); method.getBlock().declareVar(int.class, "size", constant(1)); for (int i = 0; i < rollupDesc.getNumLevelsAggregation(); i++) { method.getBlock().assignCompound("size", "+", exprDotMethod(arrayAtIndex(REF_AGGREGATORSPERGROUP, constant(i)), "size")); } method.getBlock().methodReturn(ref("size")); return localMethod(method); }
public static CodegenExpression codegen(IntervalOpDateForge forge, CodegenExpression start, CodegenExpression end, CodegenExpression parameter, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { CodegenMethod methodNode = codegenMethodScope.makeChild(Boolean.class, IntervalOpDateEval.class, codegenClassScope).addParam(long.class, "startTs").addParam(long.class, "endTs").addParam(Date.class, "parameter"); methodNode.getBlock() .declareVar(long.class, "time", exprDotMethod(ref("parameter"), "getTime")) .methodReturn(forge.intervalComputer.codegen(ref("startTs"), ref("endTs"), ref("time"), ref("time"), methodNode, exprSymbol, codegenClassScope)); return localMethod(methodNode, start, end, parameter); } }
public static CodegenExpression codegenLDT(CalendarSetForge forge, CodegenExpression ldt, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { ChronoField chronoField = forge.fieldName.getChronoField(); CodegenMethod methodNode = codegenMethodScope.makeChild(LocalDateTime.class, CalendarSetForgeOp.class, codegenClassScope).addParam(LocalDateTime.class, "ldt"); Class evaluationType = forge.valueExpr.getEvaluationType(); methodNode.getBlock() .declareVar(Integer.class, "value", SimpleNumberCoercerFactory.SimpleNumberCoercerInt.coerceCodegenMayNull(forge.valueExpr.evaluateCodegen(evaluationType, methodNode, exprSymbol, codegenClassScope), evaluationType, methodNode, codegenClassScope)) .ifRefNull("value").blockReturn(ref("ldt")) .methodReturn(exprDotMethod(ref("ldt"), "with", enumValue(ChronoField.class, chronoField.name()), ref("value"))); return localMethod(methodNode, ldt); }
public CodegenExpression evaluateCodegen(Class requiredType, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { CodegenMethod methodNode = codegenMethodScope.makeChild(Long.class, ExprEvaluatorStreamDTPropFragment.class, codegenClassScope); CodegenExpressionRef refEPS = exprSymbol.getAddEPS(methodNode); methodNode.getBlock() .declareVar(EventBean.class, "theEvent", arrayAtIndex(refEPS, constant(streamId))) .ifRefNullReturnNull("theEvent") .declareVar(Object.class, "event", getterFragment.eventBeanFragmentCodegen(ref("theEvent"), methodNode, codegenClassScope)) .ifCondition(not(instanceOf(ref("event"), EventBean.class))) .blockReturn(constantNull()) .methodReturn(CodegenLegoCast.castSafeFromObjectType(Long.class, getterTimestamp.eventBeanGetCodegen(cast(EventBean.class, ref("event")), methodNode, codegenClassScope))); return localMethod(methodNode); }
public static void getValueCodegen(AggregationAccessorFirstWEvalForge forge, AggregationStateLinearForge accessStateFactory, AggregationAccessorForgeGetCodegenContext context) { CodegenMethod childExpr = CodegenLegoMethodExpression.codegenExpression(forge.getChildNode(), context.getMethod(), context.getClassScope()); context.getMethod().getBlock().declareVar(EventBean.class, "bean", accessStateFactory.getAggregatorLinear().getFirstValueCodegen(context.getClassScope(), context.getMethod())) .ifRefNullReturnNull("bean") .declareVar(EventBean[].class, "eventsPerStreamBuf", newArrayByLength(EventBean.class, constant(forge.getStreamNum() + 1))) .assignArrayElement("eventsPerStreamBuf", constant(forge.getStreamNum()), ref("bean")) .methodReturn(localMethod(childExpr, ref("eventsPerStreamBuf"), constant(true), constantNull())); }
public CodegenExpression getFirstNthValueCodegen(CodegenExpressionRef index, CodegenMethod parentMethod, CodegenClassScope classScope, CodegenNamedMethods namedMethods) { CodegenMethod initArray = initArrayCodegen(namedMethods, classScope); CodegenMethod method = parentMethod.makeChildWithScope(EventBean.class, AggregatorAccessLinearJoin.class, CodegenSymbolProviderEmpty.INSTANCE, classScope).addParam(int.class, "index"); method.getBlock().ifCondition(relational(ref("index"), LT, constant(0))).blockReturn(constantNull()) .ifCondition(exprDotMethod(refSet, "isEmpty")).blockReturn(constantNull()) .ifCondition(relational(ref("index"), GE, exprDotMethod(refSet, "size"))).blockReturn(constantNull()) .ifCondition(equalsNull(array)).localMethod(initArray).blockEnd() .methodReturn(arrayAtIndex(array, ref("index"))); return localMethod(method, index); }
public static void getEnumerableScalarCodegen(AggregationAccessorFirstWEvalForge forge, AggregationStateLinearForge accessStateFactory, AggregationAccessorForgeGetCodegenContext context) { CodegenMethod childExpr = CodegenLegoMethodExpression.codegenExpression(forge.getChildNode(), context.getMethod(), context.getClassScope()); context.getMethod().getBlock().declareVar(EventBean.class, "bean", accessStateFactory.getAggregatorLinear().getFirstValueCodegen(context.getClassScope(), context.getMethod())) .ifRefNullReturnNull("bean") .declareVar(EventBean[].class, "eventsPerStreamBuf", newArrayByLength(EventBean.class, constant(forge.getStreamNum() + 1))) .assignArrayElement("eventsPerStreamBuf", constant(forge.getStreamNum()), ref("bean")) .declareVar(Object.class, "value", localMethod(childExpr, ref("eventsPerStreamBuf"), constant(true), constantNull())) .ifRefNullReturnNull("value") .methodReturn(staticMethod(Collections.class, "singletonList", ref("value"))); }