public SAIFFInitializeBuilder eventtypes(String name, EventType[] types) { return setValue(name, types == null ? constantNull() : EventTypeUtility.resolveTypeArrayCodegen(types, symbols.getAddInitSvc(method))); }
public CodegenMethod makeCodegen(CodegenClassScope classScope, CodegenMethodScope parent, SAIFFInitializeSymbol symbols) { CodegenMethod method = parent.makeChild(MatchedEventMapMeta.class, this.getClass(), classScope); method.getBlock().declareVar(String[].class, "tagsPerIndex", constant(tagsPerIndex)) .declareVar(EventType[].class, "eventTypes", EventTypeUtility.resolveTypeArrayCodegen(eventTypes, symbols.getAddInitSvc(method))) .methodReturn(newInstance(MatchedEventMapMeta.class, ref("tagsPerIndex"), ref("eventTypes"), constant(arrayTags))); return method; }
public CodegenExpression make(CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { CodegenMethod method = parent.makeChild(implementation(), this.getClass(), classScope); method.getBlock() .declareVar(implementation(), "impl", newInstance(implementation())) .exprDotMethod(ref("impl"), "setStreamTypes", EventTypeUtility.resolveTypeArrayCodegen(streamTypes, symbols.getAddInitSvc(method))) .exprDotMethod(ref("impl"), "setOuterJoins", constant(outerJoins)); if (postJoinEvaluator != null) { method.getBlock().exprDotMethod(ref("impl"), "setPostJoinFilterEvaluator", ExprNodeUtilityCodegen.codegenEvaluatorNoCoerce(postJoinEvaluator.getForge(), method, this.getClass(), classScope)); } populateInline(ref("impl"), method, symbols, classScope); method.getBlock().methodReturn(ref("impl")); return localMethod(method); } }
private static void processOutputLimitedLastAllNonBufferedCodegen(ResultSetProcessorSimpleForge forge, String methodName, CodegenClassScope classScope, CodegenMethod method, CodegenInstanceAux instance) { CodegenExpressionField factory = classScope.addOrGetFieldSharable(ResultSetProcessorHelperFactoryField.INSTANCE); CodegenExpression eventTypes = classScope.addFieldUnshared(true, EventType[].class, EventTypeUtility.resolveTypeArrayCodegen(forge.getEventTypes(), EPStatementInitServices.REF)); if (forge.isOutputAll()) { instance.addMember(NAME_OUTPUTALLHELPER, ResultSetProcessorSimpleOutputAllHelper.class); instance.getServiceCtor().getBlock().assignRef(NAME_OUTPUTALLHELPER, exprDotMethod(factory, "makeRSSimpleOutputAll", ref("this"), REF_AGENTINSTANCECONTEXT, eventTypes)); method.getBlock().exprDotMethod(ref(NAME_OUTPUTALLHELPER), methodName, REF_NEWDATA, REF_OLDDATA); } else if (forge.isOutputLast()) { instance.addMember(NAME_OUTPUTLASTHELPER, ResultSetProcessorSimpleOutputLastHelper.class); instance.getServiceCtor().getBlock().assignRef(NAME_OUTPUTLASTHELPER, exprDotMethod(factory, "makeRSSimpleOutputLast", ref("this"), REF_AGENTINSTANCECONTEXT, eventTypes)); method.getBlock().exprDotMethod(ref(NAME_OUTPUTLASTHELPER), methodName, REF_NEWDATA, REF_OLDDATA); } }
private static void processOutputLimitedLastAllNonBufferedCodegen(ResultSetProcessorAggregateGroupedForge forge, String methodName, CodegenClassScope classScope, CodegenMethod method, CodegenInstanceAux instance) { CodegenExpressionField factory = classScope.addOrGetFieldSharable(ResultSetProcessorHelperFactoryField.INSTANCE); CodegenExpression groupKeyTypes = constant(forge.getGroupKeyTypes()); if (forge.isOutputAll()) { CodegenExpression eventTypes = classScope.addFieldUnshared(true, EventType[].class, EventTypeUtility.resolveTypeArrayCodegen(forge.getEventTypes(), EPStatementInitServices.REF)); instance.addMember(NAME_OUTPUTALLHELPER, ResultSetProcessorAggregateGroupedOutputAllHelper.class); instance.getServiceCtor().getBlock().assignRef(NAME_OUTPUTALLHELPER, exprDotMethod(factory, "makeRSAggregateGroupedOutputAll", REF_AGENTINSTANCECONTEXT, ref("this"), groupKeyTypes, eventTypes)); method.getBlock().exprDotMethod(ref(NAME_OUTPUTALLHELPER), methodName, REF_NEWDATA, REF_OLDDATA, REF_ISSYNTHESIZE); } else if (forge.isOutputLast()) { instance.addMember(NAME_OUTPUTLASTHELPER, ResultSetProcessorAggregateGroupedOutputLastHelper.class); instance.getServiceCtor().getBlock().assignRef(NAME_OUTPUTLASTHELPER, exprDotMethod(factory, "makeRSAggregateGroupedOutputLastOpt", REF_AGENTINSTANCECONTEXT, ref("this"), groupKeyTypes)); method.getBlock().exprDotMethod(ref(NAME_OUTPUTLASTHELPER), methodName, REF_NEWDATA, REF_OLDDATA, REF_ISSYNTHESIZE); } }
private static void processOutputLimitedLastAllNonBufferedCodegen(ResultSetProcessorRowPerGroupForge forge, String methodName, CodegenClassScope classScope, CodegenMethod method, CodegenInstanceAux instance) { CodegenExpressionField factory = classScope.addOrGetFieldSharable(ResultSetProcessorHelperFactoryField.INSTANCE); CodegenExpression eventTypes = classScope.addFieldUnshared(true, EventType[].class, EventTypeUtility.resolveTypeArrayCodegen(forge.getEventTypes(), EPStatementInitServices.REF)); if (forge.isOutputAll()) { instance.addMember(NAME_OUTPUTALLHELPER, ResultSetProcessorRowPerGroupOutputAllHelper.class); instance.getServiceCtor().getBlock().assignRef(NAME_OUTPUTALLHELPER, exprDotMethod(factory, "makeRSRowPerGroupOutputAllOpt", REF_AGENTINSTANCECONTEXT, ref("this"), constant(forge.getGroupKeyTypes()), eventTypes)); method.getBlock().exprDotMethod(ref(NAME_OUTPUTALLHELPER), methodName, REF_NEWDATA, REF_OLDDATA, REF_ISSYNTHESIZE); } else if (forge.isOutputLast()) { instance.addMember(NAME_OUTPUTLASTHELPER, ResultSetProcessorRowPerGroupOutputLastHelper.class); instance.getServiceCtor().getBlock().assignRef(NAME_OUTPUTLASTHELPER, exprDotMethod(factory, "makeRSRowPerGroupOutputLastOpt", REF_AGENTINSTANCECONTEXT, ref("this"), constant(forge.getGroupKeyTypes()), eventTypes)); method.getBlock().exprDotMethod(ref(NAME_OUTPUTLASTHELPER), methodName, REF_NEWDATA, REF_OLDDATA, REF_ISSYNTHESIZE); } }
private static void processOutputLimitedLastAllNonBufferedCodegen(ResultSetProcessorRowPerGroupRollupForge forge, String methodName, CodegenClassScope classScope, CodegenMethod method, CodegenInstanceAux instance) { CodegenExpressionField factory = classScope.addOrGetFieldSharable(ResultSetProcessorHelperFactoryField.INSTANCE); CodegenExpression eventTypes = classScope.addFieldUnshared(true, EventType[].class, EventTypeUtility.resolveTypeArrayCodegen(forge.getEventTypes(), EPStatementInitServices.REF)); if (forge.getOutputLimitSpec().getDisplayLimit() == OutputLimitLimitType.ALL) { instance.addMember(NAME_OUTPUTALLHELPER, ResultSetProcessorRowPerGroupRollupOutputAllHelper.class); instance.getServiceCtor().getBlock().assignRef(NAME_OUTPUTALLHELPER, exprDotMethod(factory, "makeRSRowPerGroupRollupAll", REF_AGENTINSTANCECONTEXT, ref("this"), constant(forge.getGroupKeyTypes()), eventTypes)); method.getBlock().exprDotMethod(ref(NAME_OUTPUTALLHELPER), methodName, REF_NEWDATA, REF_OLDDATA, REF_ISSYNTHESIZE); } else if (forge.getOutputLimitSpec().getDisplayLimit() == OutputLimitLimitType.LAST) { instance.addMember(NAME_OUTPUTLASTHELPER, ResultSetProcessorRowPerGroupRollupOutputLastHelper.class); instance.getServiceCtor().getBlock().assignRef(NAME_OUTPUTLASTHELPER, exprDotMethod(factory, "makeRSRowPerGroupRollupLast", REF_AGENTINSTANCECONTEXT, ref("this"), constant(forge.getGroupKeyTypes()), eventTypes)); method.getBlock().exprDotMethod(ref(NAME_OUTPUTLASTHELPER), methodName, REF_NEWDATA, REF_OLDDATA, REF_ISSYNTHESIZE); } }
public void provideCodegen(CodegenMethod method, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { CodegenExpressionRef spec = ref("spec"); method.getBlock() .declareVar(OutputProcessViewConditionSpec.class, spec.getRef(), newInstance(OutputProcessViewConditionSpec.class)) .exprDotMethod(spec, "setConditionType", enumValue(ResultSetProcessorOutputConditionType.class, conditionType.name())) .exprDotMethod(spec, "setOutputConditionFactory", outputConditionFactoryForge.make(method, symbols, classScope)) .exprDotMethod(spec, "setStreamCount", constant(streamCount)) .exprDotMethod(spec, "setTerminable", constant(terminable)) .exprDotMethod(spec, "setSelectClauseStreamSelector", enumValue(SelectClauseStreamSelectorEnum.class, selectClauseStreamSelector.name())) .exprDotMethod(spec, "setPostProcessFactory", outputStrategyPostProcessForge == null ? constantNull() : outputStrategyPostProcessForge.make(method, symbols, classScope)) .exprDotMethod(spec, "setHasAfter", constant(hasAfter)) .exprDotMethod(spec, "setDistinct", constant(isDistinct)) .exprDotMethod(spec, "setResultEventType", EventTypeUtility.resolveTypeCodegen(resultEventType, symbols.getAddInitSvc(method))) .exprDotMethod(spec, "setAfterTimePeriod", afterTimePeriodExpr == null ? constantNull() : afterTimePeriodExpr.getTimePeriodComputeForge().makeEvaluator(method, classScope)) .exprDotMethod(spec, "setAfterConditionNumberOfEvents", constant(afterNumberOfEvents)) .exprDotMethod(spec, "setUnaggregatedUngrouped", constant(unaggregatedUngrouped)) .exprDotMethod(spec, "setEventTypes", EventTypeUtility.resolveTypeArrayCodegen(eventTypes, EPStatementInitServices.REF)) .methodReturn(newInstance(OutputProcessViewConditionFactory.class, spec)); }
static void processViewResultUnboundCodegen(ResultSetProcessorRowPerGroupRollupForge forge, CodegenClassScope classScope, CodegenMethod method, CodegenInstanceAux instance) { CodegenExpressionField factory = classScope.addOrGetFieldSharable(ResultSetProcessorHelperFactoryField.INSTANCE); CodegenExpression eventTypes = classScope.addFieldUnshared(true, EventType[].class, EventTypeUtility.resolveTypeArrayCodegen(forge.getEventTypes(), EPStatementInitServices.REF)); instance.addMember(NAME_UNBOUNDHELPER, ResultSetProcessorRowPerGroupRollupUnboundHelper.class); instance.getServiceCtor().getBlock().assignRef(NAME_UNBOUNDHELPER, exprDotMethod(factory, "makeRSRowPerGroupRollupSnapshotUnbound", REF_AGENTINSTANCECONTEXT, ref("this"), constant(forge.getGroupKeyTypes()), constant(forge.getNumStreams()), eventTypes)); CodegenMethod generateGroupKeysView = generateGroupKeysViewCodegen(forge, classScope, instance); CodegenMethod generateOutputEventsView = generateOutputEventsViewCodegen(forge, classScope, instance); method.getBlock() .declareVar(Object[][].class, "newDataMultiKey", localMethod(generateGroupKeysView, REF_NEWDATA, exprDotMethod(ref(NAME_UNBOUNDHELPER), "getBuffer"), constantTrue())) .declareVar(Object[][].class, "oldDataMultiKey", localMethod(generateGroupKeysView, REF_OLDDATA, exprDotMethod(ref(NAME_UNBOUNDHELPER), "getBuffer"), constantFalse())) .declareVar(EventBean[].class, "selectOldEvents", forge.isSelectRStream() ? localMethod(generateOutputEventsView, exprDotMethod(ref(NAME_UNBOUNDHELPER), "getBuffer"), constantFalse(), REF_ISSYNTHESIZE) : constantNull()) .declareVar(EventBean[].class, "eventsPerStream", newArrayByLength(EventBean.class, constant(1))) .staticMethod(ResultSetProcessorGroupedUtil.class, METHOD_APPLYAGGVIEWRESULTKEYEDVIEW, REF_AGGREGATIONSVC, REF_AGENTINSTANCECONTEXT, REF_NEWDATA, ref("newDataMultiKey"), REF_OLDDATA, ref("oldDataMultiKey"), ref("eventsPerStream")) .declareVar(EventBean[].class, "selectNewEvents", localMethod(generateOutputEventsView, exprDotMethod(ref(NAME_UNBOUNDHELPER), "getBuffer"), constantTrue(), REF_ISSYNTHESIZE)) .methodReturn(staticMethod(ResultSetProcessorUtil.class, METHOD_TOPAIRNULLIFALLNULL, ref("selectNewEvents"), ref("selectOldEvents"))); }
VariantEventType variantEventType = (VariantEventType) eventType; method.getBlock().expression(exprDotMethodChain(symbols.getAddInitSvc(method)).add(EPModuleEventTypeInitServices.GETEVENTTYPECOLLECTOR).add("registerVariant", ref("metadata"), EventTypeUtility.resolveTypeArrayCodegen(variantEventType.getVariants(), symbols.getAddInitSvc(method)), constant(variantEventType.isVariantAny()))); } else { throw new IllegalStateException("Event type '" + eventType + "' cannot be registered");
VariantEventType variantEventType = (VariantEventType) eventType; method.getBlock().expression(exprDotMethodChain(symbols.getAddInitSvc(method)).add(EPModuleEventTypeInitServices.GETEVENTTYPECOLLECTOR).add("registerVariant", ref("metadata"), EventTypeUtility.resolveTypeArrayCodegen(variantEventType.getVariants(), symbols.getAddInitSvc(method)), constant(variantEventType.isVariantAny()))); } else { throw new IllegalStateException("Event type '" + eventType + "' cannot be registered");
CodegenExpression eventTypes = classScope.addFieldUnshared(true, EventType[].class, EventTypeUtility.resolveTypeArrayCodegen(forge.getEventTypes(), EPStatementInitServices.REF)); instance.addMember(NAME_OUTPUTALLGROUPREPS, ResultSetProcessorGroupedOutputAllGroupReps.class); instance.getServiceCtor().getBlock().assignRef(NAME_OUTPUTALLGROUPREPS, exprDotMethod(helperFactory, "makeRSGroupedOutputAllNoOpt", REF_AGENTINSTANCECONTEXT, constant(forge.getGroupKeyTypes()), eventTypes));
CodegenExpression eventTypes = classScope.addFieldUnshared(true, EventType[].class, EventTypeUtility.resolveTypeArrayCodegen(forge.getEventTypes(), EPStatementInitServices.REF)); instance.addMember(NAME_OUTPUTALLGROUPREPS, ResultSetProcessorGroupedOutputAllGroupReps.class); instance.getServiceCtor().getBlock().assignRef(NAME_OUTPUTALLGROUPREPS, exprDotMethod(helperFactory, "makeRSGroupedOutputAllNoOpt", REF_AGENTINSTANCECONTEXT, constant(forge.getGroupKeyTypes()), eventTypes));
CodegenExpression eventTypes = classScope.addFieldUnshared(true, EventType[].class, EventTypeUtility.resolveTypeArrayCodegen(forge.getEventTypes(), EPStatementInitServices.REF)); instance.addMember(NAME_OUTPUTALLGROUPREPS, ResultSetProcessorGroupedOutputAllGroupReps.class); instance.getServiceCtor().getBlock().assignRef(NAME_OUTPUTALLGROUPREPS, exprDotMethod(helperFactory, "makeRSGroupedOutputAllNoOpt", REF_AGENTINSTANCECONTEXT, groupKeyTypes, eventTypes));
CodegenExpression eventTypes = classScope.addFieldUnshared(true, EventType[].class, EventTypeUtility.resolveTypeArrayCodegen(forge.getEventTypes(), EPStatementInitServices.REF)); instance.addMember(NAME_OUTPUTALLGROUPREPS, ResultSetProcessorGroupedOutputAllGroupReps.class); instance.getServiceCtor().getBlock().assignRef(NAME_OUTPUTALLGROUPREPS, exprDotMethod(helperFactory, "makeRSGroupedOutputAllNoOpt", REF_AGENTINSTANCECONTEXT, groupKeyTypes, eventTypes));