public CodegenExpression makeCopyMethodClassScoped(CodegenClassScope classScope) { CodegenExpressionField factory = classScope.addOrGetFieldSharable(EventBeanTypedEventFactoryCodegenField.INSTANCE); return newInstance(WrapperEventBeanMapCopyMethod.class, cast(WrapperEventType.class, EventTypeUtility.resolveTypeCodegen(wrapperEventType, EPStatementInitServices.REF)), factory); }
private CodegenMethod getObjectArrayCodegen(CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { return codegenMethodScope.makeChild(Object.class, this.getClass(), codegenClassScope).addParam(Object[].class, "array").getBlock() .declareVar(Object.class, "value", arrayAtIndex(ref("array"), constant(propertyIndex))) .ifRefNullReturnNull("value") .ifInstanceOf("value", EventBean.class) .blockReturn(entryGetter.eventBeanGetCodegen(castRef(EventBean.class, "value"), codegenMethodScope, codegenClassScope)) .methodReturn(entryGetter.underlyingGetCodegen(cast(entryGetter.getTargetType(), ref("value")), codegenMethodScope, codegenClassScope)); }
public CodegenExpression eventBeanGetMappedCodegen(CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope, CodegenExpression beanExpression, CodegenExpression key) { CodegenMethod method = codegenMethodScope.makeChild(Object.class, AvroEventBeanGetterMappedRuntimeKeyed.class, codegenClassScope).addParam(EventBean.class, "event").addParam(String.class, "key").getBlock() .declareVar(GenericData.Record.class, "record", castUnderlying(GenericData.Record.class, ref("event"))) .declareVar(Map.class, "values", cast(Map.class, exprDotMethod(ref("record"), "get", constant(pos)))) .methodReturn(staticMethod(AvroEventBeanGetterMapped.class, "getAvroMappedValueWNullCheck", ref("values"), ref("key"))); return localMethodBuild(method).pass(beanExpression).pass(key).call(); } }
public CodegenExpression make(CodegenMethodScope parent, CodegenClassScope classScope) { CodegenExpressionField factory = classScope.addOrGetFieldSharable(EventBeanTypedEventFactoryCodegenField.INSTANCE); CodegenExpression xmlType = cast(BaseXMLEventType.class, EventTypeUtility.resolveTypeCodegen(xmlEventType, EPStatementInitServices.REF)); return newInstance(FragmentFactoryDOMGetter.class, factory, xmlType, constant(propertyExpression)); } }
private CodegenMethod getMapCodegen(CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { return codegenMethodScope.makeChild(underlyingType, this.getClass(), codegenClassScope).addParam(Map.class, "map").getBlock() .declareVar(Object.class, "eventBean", exprDotMethod(ref("map"), "get", constant(propertyName))) .ifRefNullReturnNull("eventBean") .methodReturn(cast(underlyingType, exprDotMethod(cast(EventBean.class, ref("eventBean")), "getUnderlying"))); }
public CodegenExpression makeCopyMethodClassScoped(CodegenClassScope classScope) { CodegenExpressionField factory = classScope.addOrGetFieldSharable(EventBeanTypedEventFactoryCodegenField.INSTANCE); return newInstance(MapEventBeanCopyMethodWithArrayMap.class, cast(MapEventType.class, EventTypeUtility.resolveTypeCodegen(mapEventType, EPStatementInitServices.REF)), factory, constant(mapPropertiesToCopy), constant(arrayPropertiesToCopy)); }
public static void processOutputLimitedViewCodegen(ResultSetProcessorSimpleForge forge, CodegenMethod method) { if (!forge.isOutputLast()) { method.getBlock().declareVar(UniformPair.class, "pair", staticMethod(EventBeanUtility.class, METHOD_FLATTENBATCHSTREAM, REF_VIEWEVENTSLIST)) .methodReturn(exprDotMethod(ref("this"), "processViewResult", cast(EventBean[].class, exprDotMethod(ref("pair"), "getFirst")), cast(EventBean[].class, exprDotMethod(ref("pair"), "getSecond")), REF_ISSYNTHESIZE)); return; } method.getBlock().methodThrowUnsupported(); } }
private CodegenMethod getObjectArrayCodegen(CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { return codegenMethodScope.makeChild(Object.class, this.getClass(), codegenClassScope).addParam(Object[].class, "array").getBlock() .declareVar(Object.class, "valueTopObj", arrayAtIndex(ref("array"), constant(index))) .ifRefNotTypeReturnConst("valueTopObj", Map.class, null) .methodReturn(getter.underlyingGetCodegen(cast(Map.class, ref("valueTopObj")), codegenMethodScope, codegenClassScope)); }
private CodegenMethod isObjectArrayExistsPropertyCodegen(CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { return codegenMethodScope.makeChild(boolean.class, this.getClass(), codegenClassScope).addParam(Object[].class, "array").getBlock() .declareVar(Object.class, "valueTopObj", arrayAtIndex(ref("array"), constant(index))) .ifRefNotTypeReturnConst("valueTopObj", Map.class, false) .methodReturn(getter.underlyingExistsCodegen(cast(Map.class, ref("valueTopObj")), codegenMethodScope, codegenClassScope)); }
public CodegenExpression evaluateCodegen(Class requiredType, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { CodegenMethod methodNode = codegenMethodScope.makeChild(resultType, this.getClass(), codegenClassScope); CodegenExpressionRef refEPS = exprSymbol.getAddEPS(methodNode); methodNode.getBlock().ifRefNullReturnNull(refEPS) .declareVar(EventBean.class, "event", arrayAtIndex(refEPS, constant(streamNum))) .ifRefNullReturnNull("event") .methodReturn(cast(requiredType, exprDotMethod(ref("event"), "getUnderlying"))); return localMethod(methodNode); }
private CodegenMethod getAvroFieldValueCodegen(CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { return codegenMethodScope.makeChild(Object.class, this.getClass(), codegenClassScope).addParam(GenericData.Record.class, "record").getBlock() .declareVar(Map.class, "values", cast(Map.class, exprDotMethod(ref("record"), "get", constant(pos)))) .ifRefNullReturnNull("values") .methodReturn(exprDotMethod(ref("values"), "get", constant(key))); }
protected void applyEvalEnterNonNull(CodegenExpressionRef value, Class valueType, CodegenMethod method, ExprForgeCodegenSymbol symbols, ExprForge[] forges, CodegenClassScope classScope) { if (valueType == BigInteger.class) { method.getBlock().assignRef(sum, exprDotMethod(sum, "add", newInstance(BigDecimal.class, value))); } else { method.getBlock().assignRef(sum, exprDotMethod(sum, "add", valueType == BigDecimal.class ? value : cast(BigDecimal.class, value))); } method.getBlock().increment(cnt); }
private CodegenMethod getFragmentCodegen(CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { return codegenMethodScope.makeChild(Object.class, this.getClass(), codegenClassScope).addParam(Map.class, "map").getBlock() .declareVar(Object.class, "value", exprDotMethod(ref("map"), "get", constant(propertyMap))) .ifRefNullReturnNull("value") .declareVar(EventBean.class, "theEvent", cast(EventBean.class, ref("value"))) .methodReturn(eventBeanEntryGetter.eventBeanFragmentCodegen(ref("theEvent"), codegenMethodScope, codegenClassScope)); }
public void readCodegen(CodegenExpressionRef row, int col, CodegenExpressionRef input, CodegenMethod method, CodegenExpressionRef unitKey, CodegenClassScope classScope) { method.getBlock() .apply(readInt(row, size, input)) .assignRef(rowDotRef(row, sorted), newInstance(TreeMap.class, comparator)) .exprDotMethod(sortedSerde, "read", rowDotRef(row, sorted), input, unitKey); if (joinRefs != null) { method.getBlock().assignRef(rowDotRef(row, joinRefs), cast(RefCountedSetAtomicInteger.class, exprDotMethod(joinRefsSerde, "read", input, unitKey))); } }
public CodegenExpression evaluateCodegenUninstrumented(Class requiredType, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { CodegenMethod methodNode = codegenMethodScope.makeChild(eventType.getUnderlyingType(), ExprStreamUnderlyingNodeImpl.class, codegenClassScope); CodegenExpressionRef refEPS = exprSymbol.getAddEPS(methodNode); methodNode.getBlock() .declareVar(EventBean.class, "event", arrayAtIndex(refEPS, constant(streamNum))) .ifRefNullReturnNull("event") .methodReturn(cast(eventType.getUnderlyingType(), exprDotMethod(ref("event"), "getUnderlying"))); return localMethod(methodNode); }
private static CodegenMethod generateOutputBatchedAddToListCodegen(ResultSetProcessorAggregateGroupedForge forge, CodegenClassScope classScope, CodegenInstanceAux instance) { CodegenMethod generateOutputBatchedAddToListSingle = generateOutputBatchedAddToListSingleCodegen(forge, classScope, instance); Consumer<CodegenMethod> code = methodNode -> { methodNode.getBlock().forEach(Map.Entry.class, "entry", exprDotMethod(ref("keysAndEvents"), "entrySet")) .localMethod(generateOutputBatchedAddToListSingle, exprDotMethod(ref("entry"), "getKey"), cast(EventBean[].class, exprDotMethod(ref("entry"), "getValue")), REF_ISNEWDATA, REF_ISSYNTHESIZE, ref("resultEvents"), ref("optSortKeys")); }; return instance.getMethods().addMethod(void.class, "generateOutputBatchedAddToList", CodegenNamedParam.from(Map.class, "keysAndEvents", boolean.class, NAME_ISNEWDATA, boolean.class, NAME_ISSYNTHESIZE, List.class, "resultEvents", List.class, "optSortKeys"), ResultSetProcessorAggregateGroupedImpl.class, classScope, code); }
public CodegenExpression eventBeanGetMappedCodegen(CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope, CodegenExpression beanExpression, CodegenExpression key) { CodegenMethod method = codegenMethodScope.makeChild(Object.class, WrapperGetterMapped.class, codegenClassScope).addParam(EventBean.class, "event").addParam(String.class, "key").getBlock() .declareVar(DecoratingEventBean.class, "wrapper", cast(DecoratingEventBean.class, ref("event"))) .declareVar(EventBean.class, "wrapped", exprDotMethod(ref("wrapper"), "getUnderlyingEvent")) .ifRefNullReturnNull("wrapped") .methodReturn(undMapped.eventBeanGetMappedCodegen(codegenMethodScope, codegenClassScope, ref("wrapped"), ref("key"))); return localMethodBuild(method).pass(beanExpression).pass(key).call(); } };
public CodegenExpression eventBeanGetIndexedCodegen(CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope, CodegenExpression beanExpression, CodegenExpression key) { CodegenMethod method = codegenMethodScope.makeChild(Object.class, WrapperGetterIndexed.class, codegenClassScope).addParam(EventBean.class, "event").addParam(int.class, "index").getBlock() .declareVar(DecoratingEventBean.class, "wrapper", cast(DecoratingEventBean.class, ref("event"))) .declareVar(EventBean.class, "wrapped", exprDotMethod(ref("wrapper"), "getUnderlyingEvent")) .ifRefNullReturnNull("wrapped") .methodReturn(undIndexed.eventBeanGetIndexedCodegen(codegenMethodScope, codegenClassScope, ref("wrapped"), ref("index"))); return localMethodBuild(method).pass(beanExpression).pass(key).call(); } }
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 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()))); }