public CodegenBlock assignArrayElement2Dim(String ref, CodegenExpression indexOne, CodegenExpression indexTwo, CodegenExpression assignment) { checkClosed(); statements.add(new CodegenStatementAssignArrayElement2Dim(ref(ref), indexOne, indexTwo, assignment)); return this; }
public CodegenMethod initializeCodegen(CodegenClassScope classScope, CodegenMethodScope parent, SAIFFInitializeSymbol symbols) { CodegenMethod method = parent.makeChild(StatementAgentInstanceFactoryCreateContext.class, this.getClass(), classScope); method.getBlock() .declareVar(StatementAgentInstanceFactoryCreateContext.class, "saiff", newInstance(StatementAgentInstanceFactoryCreateContext.class)) .exprDotMethod(ref("saiff"), "setContextName", constant(contextName)) .exprDotMethod(ref("saiff"), "setStatementEventType", EventTypeUtility.resolveTypeCodegen(statementEventType, symbols.getAddInitSvc(method))) .exprDotMethod(symbols.getAddInitSvc(method), "addReadyCallback", ref("saiff")) .methodReturn(ref("saiff")); return method; } }
public void rowReadMethodCodegen(CodegenMethod method, int level) { if (level != -1) { method.getBlock().assignRef("row.refcount", exprDotMethod(ref("input"), "readInt")); } }
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 void acceptGroupDetailCodegen(CodegenMethod method, CodegenClassScope classScope) { method.getBlock().exprDotMethod(REF_AGGVISITOR, "visitGrouped", getGroupKeyCountCodegen(method, classScope)) .forEach(Map.class, "anAggregatorsPerGroup", REF_AGGREGATORSPERGROUP) .forEach(Map.Entry.class, "entry", exprDotMethod(ref("anAggregatorsPerGroup"), "entrySet")) .exprDotMethod(REF_AGGVISITOR, "visitGroup", exprDotMethod(ref("entry"), "getKey"), exprDotMethod(ref("entry"), "getValue")) .blockEnd() .blockEnd() .exprDotMethod(REF_AGGVISITOR, "visitGroup", publicConstValue(CollectionUtil.class, "OBJECTARRAY_EMPTY"), REF_AGGREGATORTOPGROUP); }
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 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); } }
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 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 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 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); }
private void applyEvalValuePrefix(boolean enter, CodegenMethod method, ExprForgeCodegenSymbol symbols, ExprForge[] forges, CodegenClassScope classScope) { Class type = forges[0].getEvaluationType(); CodegenExpression expr = forges[0].evaluateCodegen(type, method, symbols, classScope); method.getBlock().declareVar(type, "val", expr); if (!type.isPrimitive()) { method.getBlock().ifRefNull("val").blockReturnNoValue(); } if (distinct != null) { method.getBlock().ifCondition(not(exprDotMethod(distinct, enter ? "add" : "remove", ref("val")))).blockReturnNoValue(); } }
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"))); }
protected void applyEnterFiltered(CodegenMethod method, ExprForgeCodegenSymbol symbols, CodegenClassScope classScope, CodegenNamedMethods namedMethods) { CodegenExpressionRef eps = symbols.getAddEPS(method); method.getBlock() .declareVar(EventBean.class, "theEvent", arrayAtIndex(eps, constant(forge.getStreamNum()))) .ifRefNull("theEvent").blockReturnNoValue() .exprDotMethod(events, "add", ref("theEvent")); }
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 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 void getValueCodegen(CodegenMethod method, CodegenClassScope classScope) { method.getBlock().ifCondition(not(exprDotMethod(points, "isEmpty"))) .declareVar(long.class, "newest", cast(Long.class, exprDotMethod(points, "getLast"))) .declareVar(boolean.class, "leave", staticMethod(AggregatorRateEver.class, "removeFromHead", points, ref("newest"), constant(factory.getIntervalTime()))) .assignCompound(hasLeave, "|", ref("leave")) .blockEnd() .ifCondition(not(hasLeave)).blockReturn(constantNull()) .ifCondition(exprDotMethod(points, "isEmpty")).blockReturn(constant(0d)) .methodReturn(op(op(op(exprDotMethod(points, "size"), "*", constant(factory.getTimeAbacus().getOneSecond())), "*", constant(1d)), "/", constant(factory.getIntervalTime()))); }