public SAIFFInitializeBuilder constant(String name, Object value) { if (value instanceof CodegenExpression) { throw new IllegalArgumentException("Expected a non-expression value, received " + value); } return setValue(name, value == null ? constantNull() : CodegenExpressionBuilder.constant(value)); }
public CodegenExpression eventBeanFragmentCodegen(CodegenExpression beanExpression, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { if (eventType == null) { return constantNull(); } return underlyingFragmentCodegen(castUnderlying(Map.class, beanExpression), codegenMethodScope, codegenClassScope); }
public CodegenExpression underlyingFragmentCodegen(CodegenExpression underlyingExpression, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { if (fragmentFactory == null) { return constantNull(); } return localMethod(getFragmentCodegen(codegenMethodScope, codegenClassScope), underlyingExpression); } }
public CodegenExpression underlyingFragmentCodegen(CodegenExpression underlyingExpression, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { if (fragmentEventType == null) { return constantNull(); } return localMethod(getAvroFragmentCodegen(codegenMethodScope, codegenClassScope), underlyingExpression); } }
public final CodegenExpression eventBeanFragmentCodegen(CodegenExpression beanExpression, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { determineFragmentable(); if (!isFragmentable) { return constantNull(); } return underlyingFragmentCodegen(castUnderlying(getTargetType(), beanExpression), codegenMethodScope, codegenClassScope); }
protected CodegenExpression handleCreateFragmentCodegen(CodegenExpression value, CodegenClassScope codegenClassScope) { if (fragmentEventType == null) { return constantNull(); } CodegenExpressionField mSvc = codegenClassScope.addOrGetFieldSharable(EventBeanTypedEventFactoryCodegenField.INSTANCE); CodegenExpressionField mType = codegenClassScope.addFieldUnshared(true, EventType.class, EventTypeUtility.resolveTypeCodegen(fragmentEventType, EPStatementInitServices.REF)); return staticMethod(BaseNestableEventUtil.class, "handleBNCreateFragmentObjectArray", value, mType, mSvc); } }
public CodegenExpression initCtorScoped() { if (mathContext == null) { return constantNull(); } return newInstance(MathContext.class, constant(mathContext.getPrecision()), enumValue(RoundingMode.class, mathContext.getRoundingMode().name())); }
public static CodegenExpression expressionMayVoid(Class requiredType, ExprForge forge, CodegenMethod parentNode, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { if (forge.getEvaluationType() != void.class) { return forge.evaluateCodegen(requiredType, parentNode, exprSymbol, codegenClassScope); } CodegenMethod methodNode = parentNode.makeChild(Object.class, CodegenLegoMayVoid.class, codegenClassScope); methodNode.getBlock().expression(forge.evaluateCodegen(requiredType, methodNode, exprSymbol, codegenClassScope)) .methodReturn(constantNull()); return localMethod(methodNode); } }
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 CodegenExpression getLastValueCodegen(CodegenClassScope classScope, CodegenMethod parent) { CodegenMethod method = parent.makeChildWithScope(EventBean.class, this.getClass(), CodegenSymbolProviderEmpty.INSTANCE, classScope); method.getBlock().ifCondition(exprDotMethod(sorted, "isEmpty")) .blockReturn(constantNull()) .declareVar(Map.Entry.class, "min", exprDotMethod(sorted, "lastEntry")) .methodReturn(staticMethod(AggregatorAccessSortedImpl.class, "checkedPayloadMayDeque", exprDotMethod(ref("min"), "getValue"))); return localMethod(method); }
@Override public CodegenExpression evaluateCodegen(CodegenMethodScope parent, ExprSubselectEvalMatchSymbol symbols, CodegenClassScope classScope) { CodegenExpressionField eventToPublic = TableDeployTimeResolver.makeTableEventToPublicField(table, classScope, this.getClass()); CodegenMethod method = parent.makeChild(subselect.getEvaluationType(), this.getClass(), classScope); method.getBlock() .ifCondition(relational(exprDotMethod(symbols.getAddMatchingEvents(method), "size"), CodegenExpressionRelational.CodegenRelational.GT, constant(1))) .blockReturn(constantNull()) .declareVar(EventBean.class, "event", staticMethod(EventBeanUtility.class, "getNonemptyFirstEvent", symbols.getAddMatchingEvents(method))) .methodReturn(exprDotMethod(eventToPublic, "convertToUnd", ref("event"), symbols.getAddEPS(method), symbols.getAddIsNewData(method), symbols.getAddExprEvalCtx(method))); return localMethod(method); } }
protected void inlineCodegen(CodegenMethod method, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { method.getBlock() .exprDotMethod(ref("node"), "setChildNode", localMethod(getChildNodes().get(0).makeCodegen(method, symbols, classScope))) .exprDotMethod(ref("node"), "setDistinctExpression", ExprNodeUtilityCodegen.codegenEvaluatorMayMultiKeyWCoerce(ExprNodeUtilityQuery.getForges(ExprNodeUtilityQuery.toArray(distinctExpressions)), null, method, this.getClass(), classScope)) .exprDotMethod(ref("node"), "setDistinctTypes", constant(ExprNodeUtilityQuery.getExprResultTypes(distinctExpressions))) .exprDotMethod(ref("node"), "setConvertor", convertor.makeAnonymous(method, classScope)) .exprDotMethod(ref("node"), "setTimePeriodCompute", timePeriodComputeForge == null ? constantNull() : timePeriodComputeForge.makeEvaluator(method, classScope)); }
public static void processViewResultCodegen(ResultSetProcessorRowPerEventForge forge, CodegenClassScope classScope, CodegenMethod method, CodegenInstanceAux instance) { method.getBlock().declareVar(EventBean[].class, "selectOldEvents", constantNull()) .declareVarNoInit(EventBean[].class, "selectNewEvents") .declareVar(EventBean[].class, "eventsPerStream", newArrayByLength(EventBean.class, constant(1))) .staticMethod(ResultSetProcessorUtil.class, METHOD_APPLYAGGVIEWRESULT, REF_AGGREGATIONSVC, REF_AGENTINSTANCECONTEXT, REF_NEWDATA, REF_OLDDATA, ref("eventsPerStream")); ResultSetProcessorUtil.processViewResultCodegen(method, classScope, instance, forge.getOptionalHavingNode() != null, forge.isSelectRStream(), forge.isSorting(), true); }
public static void continueOutputLimitedLastAllNonBufferedJoinCodegen(ResultSetProcessorRowPerEventForge forge, CodegenMethod method) { if (forge.isOutputAll()) { method.getBlock().methodReturn(exprDotMethod(ref(NAME_OUTPUTALLUNORDHELPER), "output")); } else if (forge.isOutputLast()) { method.getBlock().methodReturn(exprDotMethod(ref(NAME_OUTPUTLASTUNORDHELPER), "output")); } else { method.getBlock().methodReturn(constantNull()); } }
public static void continueOutputLimitedLastAllNonBufferedJoinCodegen(ResultSetProcessorRowPerGroupRollupForge forge, CodegenMethod method) { if (forge.getOutputLimitSpec().getDisplayLimit() == OutputLimitLimitType.ALL) { method.getBlock().methodReturn(exprDotMethod(ref(NAME_OUTPUTALLHELPER), "outputJoin", REF_ISSYNTHESIZE)); } else if (forge.getOutputLimitSpec().getDisplayLimit() == OutputLimitLimitType.LAST) { method.getBlock().methodReturn(exprDotMethod(ref(NAME_OUTPUTLASTHELPER), "outputJoin", REF_ISSYNTHESIZE)); } else { method.getBlock().methodReturn(constantNull()); } }
protected void inlineInitializeOnTriggerSpecific(CodegenExpressionRef saiff, CodegenMethod method, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { method.getBlock() .exprDotMethod(saiff, "setResultSetProcessorFactoryProvider", CodegenExpressionBuilder.newInstance(resultSetProcessorProviderClassName, symbols.getAddInitSvc(method))) .exprDotMethod(saiff, "setInsertInto", constant(insertInto)) .exprDotMethod(saiff, "setAddToFront", constant(addToFront)) .exprDotMethod(saiff, "setSelectAndDelete", constant(selectAndDelete)) .exprDotMethod(saiff, "setDistinct", constant(distinct)) .exprDotMethod(saiff, "setOptionalInsertIntoTable", optionalInsertIntoTable == null ? constantNull() : TableDeployTimeResolver.makeResolveTable(optionalInsertIntoTable, symbols.getAddInitSvc(method))); } }
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 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"))); }
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()))); }