本文整理汇总了Java中com.espertech.esper.event.arr.ObjectArrayEventType类的典型用法代码示例。如果您正苦于以下问题:Java ObjectArrayEventType类的具体用法?Java ObjectArrayEventType怎么用?Java ObjectArrayEventType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectArrayEventType类属于com.espertech.esper.event.arr包,在下文中一共展示了ObjectArrayEventType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TableMetadata
import com.espertech.esper.event.arr.ObjectArrayEventType; //导入依赖的package包/类
public TableMetadata(String tableName, String eplExpression, String statementName, Class[] keyTypes, Map<String, TableMetadataColumn> tableColumns, TableStateRowFactory rowFactory, int numberMethodAggregations, StatementContext createTableStatementContext, ObjectArrayEventType internalEventType, ObjectArrayEventType publicEventType, TableMetadataInternalEventToPublic eventToPublic, boolean queryPlanLogging)
throws ExprValidationException {
this.tableName = tableName;
this.eplExpression = eplExpression;
this.statementName = statementName;
this.keyTypes = keyTypes;
this.tableColumns = tableColumns;
this.rowFactory = rowFactory;
this.numberMethodAggregations = numberMethodAggregations;
this.statementContextCreateTable = createTableStatementContext;
this.internalEventType = internalEventType;
this.publicEventType = publicEventType;
this.eventToPublic = eventToPublic;
this.queryPlanLogging = queryPlanLogging;
if (keyTypes.length > 0) {
Pair<int[], IndexMultiKey> pair = TableServiceUtil.getIndexMultikeyForKeys(tableColumns, internalEventType);
QueryPlanIndexItem queryPlanIndexItem = QueryPlanIndexItem.fromIndexMultikeyTablePrimaryKey(pair.getSecond());
eventTableIndexMetadataRepo.addIndexExplicit(true, pair.getSecond(), tableName, queryPlanIndexItem, createTableStatementContext.getStatementName());
tableRowKeyFactory = new TableRowKeyFactory(pair.getFirst());
}
}
示例2: addTable
import com.espertech.esper.event.arr.ObjectArrayEventType; //导入依赖的package包/类
public TableMetadata addTable(String tableName, String eplExpression, String statementName, Class[] keyTypes, Map<String, TableMetadataColumn> tableColumns, TableStateRowFactory tableStateRowFactory, int numberMethodAggregations, StatementContext statementContext, ObjectArrayEventType internalEventType, ObjectArrayEventType publicEventType, TableMetadataInternalEventToPublic eventToPublic, boolean queryPlanLogging) throws ExprValidationException {
final TableMetadata metadata = new TableMetadata(tableName, eplExpression, statementName, keyTypes, tableColumns, tableStateRowFactory, numberMethodAggregations, statementContext, internalEventType, publicEventType, eventToPublic, queryPlanLogging);
// determine table state factory
TableStateFactory tableStateFactory;
if (keyTypes.length == 0) { // ungrouped
tableStateFactory = new TableStateFactory() {
public TableStateInstance makeTableState(AgentInstanceContext agentInstanceContext) {
return new TableStateInstanceUngroupedImpl(metadata, agentInstanceContext);
}
};
} else {
tableStateFactory = new TableStateFactory() {
public TableStateInstance makeTableState(AgentInstanceContext agentInstanceContext) {
return new TableStateInstanceGroupedImpl(metadata, agentInstanceContext);
}
};
}
metadata.setTableStateFactory(tableStateFactory);
tables.put(tableName, metadata);
return metadata;
}
示例3: codegen
import com.espertech.esper.event.arr.ObjectArrayEventType; //导入依赖的package包/类
public static CodegenExpression codegen(EnumLastOfPredicateScalarForge forge, EnumForgeCodegenParams args, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) {
CodegenMember typeMember = codegenClassScope.makeAddMember(ObjectArrayEventType.class, forge.type);
Class resultType = JavaClassHelper.getBoxedType(EPTypeHelper.getCodegenReturnType(forge.resultType));
ExprForgeCodegenSymbol scope = new ExprForgeCodegenSymbol(false, null);
CodegenMethodNode methodNode = codegenMethodScope.makeChildWithScope(resultType, EnumLastOfPredicateScalarForgeEval.class, scope, codegenClassScope).addParam(EnumForgeCodegenNames.PARAMS);
CodegenBlock block;
block = methodNode.getBlock()
.declareVar(Object.class, "result", constantNull())
.declareVar(ObjectArrayEventBean.class, "evalEvent", newInstance(ObjectArrayEventBean.class, newArrayByLength(Object.class, constant(1)), member(typeMember.getMemberId())))
.assignArrayElement(EnumForgeCodegenNames.REF_EPS, constant(forge.streamNumLambda), ref("evalEvent"))
.declareVar(Object[].class, "props", exprDotMethod(ref("evalEvent"), "getProperties"));
CodegenBlock forEach = block.forEach(Object.class, "next", EnumForgeCodegenNames.REF_ENUMCOLL)
.assignArrayElement("props", constant(0), ref("next"));
CodegenLegoBooleanExpression.codegenContinueIfNullOrNotPass(forEach, forge.innerExpression.getEvaluationType(), forge.innerExpression.evaluateCodegen(Boolean.class, methodNode, scope, codegenClassScope));
forEach.assignRef("result", ref("next"));
block.methodReturn(cast(resultType, ref("result")));
return localMethod(methodNode, args.getEps(), args.getEnumcoll(), args.getIsNewData(), args.getExprCtx());
}
示例4: codegen
import com.espertech.esper.event.arr.ObjectArrayEventType; //导入依赖的package包/类
public static CodegenExpression codegen(EnumAllOfScalarForge forge, EnumForgeCodegenParams args, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) {
CodegenMember typeMember = codegenClassScope.makeAddMember(ObjectArrayEventType.class, forge.type);
ExprForgeCodegenSymbol scope = new ExprForgeCodegenSymbol(false, null);
CodegenMethodNode methodNode = codegenMethodScope.makeChildWithScope(boolean.class, EnumAllOfScalarForgeEval.class, scope, codegenClassScope).addParam(EnumForgeCodegenNames.PARAMS);
CodegenBlock block = methodNode.getBlock();
block.ifConditionReturnConst(exprDotMethod(EnumForgeCodegenNames.REF_ENUMCOLL, "isEmpty"), true);
block.declareVar(ObjectArrayEventBean.class, "evalEvent", newInstance(ObjectArrayEventBean.class, newArrayByLength(Object.class, constant(1)), member(typeMember.getMemberId())))
.assignArrayElement(EnumForgeCodegenNames.REF_EPS, constant(forge.streamNumLambda), ref("evalEvent"))
.declareVar(Object[].class, "props", exprDotMethod(ref("evalEvent"), "getProperties"));
CodegenBlock forEach = block.forEach(Object.class, "next", EnumForgeCodegenNames.REF_ENUMCOLL)
.assignArrayElement("props", constant(0), ref("next"));
CodegenLegoBooleanExpression.codegenReturnBoolIfNullOrBool(forEach, forge.innerExpression.getEvaluationType(), forge.innerExpression.evaluateCodegen(Boolean.class, methodNode, scope, codegenClassScope), false, null, false, false);
block.methodReturn(constantTrue());
return localMethod(methodNode, args.getEps(), args.getEnumcoll(), args.getIsNewData(), args.getExprCtx());
}
示例5: codegen
import com.espertech.esper.event.arr.ObjectArrayEventType; //导入依赖的package包/类
public static CodegenExpression codegen(EnumGroupByKeySelectorScalarLambdaForge forge, EnumForgeCodegenParams args, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) {
CodegenMember resultTypeMember = codegenClassScope.makeAddMember(ObjectArrayEventType.class, forge.resultEventType);
ExprForgeCodegenSymbol scope = new ExprForgeCodegenSymbol(false, null);
CodegenMethodNode methodNode = codegenMethodScope.makeChildWithScope(Map.class, EnumGroupByKeySelectorScalarLambdaForgeEval.class, scope, codegenClassScope).addParam(EnumForgeCodegenNames.PARAMS);
CodegenBlock block = methodNode.getBlock()
.ifCondition(exprDotMethod(EnumForgeCodegenNames.REF_ENUMCOLL, "isEmpty"))
.blockReturn(staticMethod(Collections.class, "emptyMap"))
.declareVar(Map.class, "result", newInstance(LinkedHashMap.class))
.declareVar(ObjectArrayEventBean.class, "resultEvent", newInstance(ObjectArrayEventBean.class, newArrayByLength(Object.class, constant(1)), CodegenExpressionBuilder.member(resultTypeMember.getMemberId())))
.assignArrayElement(EnumForgeCodegenNames.REF_EPS, constant(forge.streamNumLambda), ref("resultEvent"))
.declareVar(Object[].class, "props", exprDotMethod(ref("resultEvent"), "getProperties"));
CodegenBlock forEach = block.forEach(Object.class, "next", EnumForgeCodegenNames.REF_ENUMCOLL)
.assignArrayElement("props", constant(0), ref("next"))
.declareVar(Object.class, "key", forge.innerExpression.evaluateCodegen(Object.class, methodNode, scope, codegenClassScope))
.declareVar(Collection.class, "value", cast(Collection.class, exprDotMethod(ref("result"), "get", ref("key"))))
.ifRefNull("value")
.assignRef("value", newInstance(ArrayList.class))
.expression(exprDotMethod(ref("result"), "put", ref("key"), ref("value")))
.blockEnd()
.expression(exprDotMethod(ref("value"), "add", ref("next")));
block.methodReturn(ref("result"));
return localMethod(methodNode, args.getEps(), args.getEnumcoll(), args.getIsNewData(), args.getExprCtx());
}
示例6: getEnumForge
import com.espertech.esper.event.arr.ObjectArrayEventType; //导入依赖的package包/类
public EnumForge getEnumForge(EngineImportService engineImportService, EventAdapterService eventAdapterService, StreamTypeService streamTypeService, int statementId, String enumMethodUsedName, List<ExprDotEvalParam> bodiesAndParameters, EventType inputEventType, Class collectionComponentType, int numStreamsIncoming, boolean disablePropertyExpressionEventCollCache) {
ExprDotEvalParam initValueParam = bodiesAndParameters.get(0);
ExprForge initValueEval = initValueParam.getBodyForge();
super.setTypeInfo(EPTypeHelper.singleValue(JavaClassHelper.getBoxedType(initValueEval.getEvaluationType())));
ExprDotEvalParamLambda resultAndAdd = (ExprDotEvalParamLambda) bodiesAndParameters.get(1);
if (inputEventType != null) {
return new EnumAggregateEventsForge(initValueEval,
resultAndAdd.getBodyForge(), resultAndAdd.getStreamCountIncoming(),
(ObjectArrayEventType) resultAndAdd.getGoesToTypes()[0]);
} else {
return new EnumAggregateScalarForge(initValueEval,
resultAndAdd.getBodyForge(), resultAndAdd.getStreamCountIncoming(),
(ObjectArrayEventType) resultAndAdd.getGoesToTypes()[0],
(ObjectArrayEventType) resultAndAdd.getGoesToTypes()[1]);
}
}
示例7: codegen
import com.espertech.esper.event.arr.ObjectArrayEventType; //导入依赖的package包/类
public static CodegenExpression codegen(EnumWhereIndexEventsForge forge, EnumForgeCodegenParams args, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) {
CodegenMember indexTypeMember = codegenClassScope.makeAddMember(ObjectArrayEventType.class, forge.indexEventType);
ExprForgeCodegenSymbol scope = new ExprForgeCodegenSymbol(false, null);
CodegenMethodNode methodNode = codegenMethodScope.makeChildWithScope(Collection.class, EnumWhereIndexEventsForgeEval.class, scope, codegenClassScope).addParam(EnumForgeCodegenNames.PARAMS);
CodegenBlock block = methodNode.getBlock()
.ifCondition(exprDotMethod(EnumForgeCodegenNames.REF_ENUMCOLL, "isEmpty"))
.blockReturn(EnumForgeCodegenNames.REF_ENUMCOLL);
block.declareVar(ArrayDeque.class, "result", newInstance(ArrayDeque.class))
.declareVar(ObjectArrayEventBean.class, "indexEvent", newInstance(ObjectArrayEventBean.class, newArrayByLength(Object.class, constant(1)), member(indexTypeMember.getMemberId())))
.assignArrayElement(EnumForgeCodegenNames.REF_EPS, constant(forge.streamNumLambda + 1), ref("indexEvent"))
.declareVar(Object[].class, "props", exprDotMethod(ref("indexEvent"), "getProperties"))
.declareVar(int.class, "count", constant(-1));
CodegenBlock forEach = block.forEach(EventBean.class, "next", EnumForgeCodegenNames.REF_ENUMCOLL)
.increment("count")
.assignArrayElement("props", constant(0), ref("count"))
.assignArrayElement(EnumForgeCodegenNames.REF_EPS, constant(forge.streamNumLambda), ref("next"));
CodegenLegoBooleanExpression.codegenContinueIfNullOrNotPass(forEach, forge.innerExpression.getEvaluationType(), forge.innerExpression.evaluateCodegen(Boolean.class, methodNode, scope, codegenClassScope));
forEach.expression(exprDotMethod(ref("result"), "add", ref("next")));
block.methodReturn(ref("result"));
return localMethod(methodNode, args.getEps(), args.getEnumcoll(), args.getIsNewData(), args.getExprCtx());
}
示例8: getEnumForge
import com.espertech.esper.event.arr.ObjectArrayEventType; //导入依赖的package包/类
public EnumForge getEnumForge(EngineImportService engineImportService, EventAdapterService eventAdapterService, StreamTypeService streamTypeService, int statementId, String enumMethodUsedName, List<ExprDotEvalParam> bodiesAndParameters, EventType inputEventType, Class collectionComponentType, int numStreamsIncoming, boolean disablePropertyExpressionEventCollCache) {
boolean isDescending = this.getEnumMethodEnum() == EnumMethodEnum.ORDERBYDESC;
if (bodiesAndParameters.isEmpty()) {
super.setTypeInfo(EPTypeHelper.collectionOfSingleValue(collectionComponentType));
return new EnumOrderByAscDescScalarForge(numStreamsIncoming, isDescending);
}
ExprDotEvalParamLambda first = (ExprDotEvalParamLambda) bodiesAndParameters.get(0);
if (inputEventType == null) {
super.setTypeInfo(EPTypeHelper.collectionOfSingleValue(collectionComponentType));
return new EnumOrderByAscDescScalarLambdaForge(first.getBodyForge(), first.getStreamCountIncoming(), isDescending,
(ObjectArrayEventType) first.getGoesToTypes()[0]);
}
super.setTypeInfo(EPTypeHelper.collectionOfEvents(inputEventType));
return new EnumOrderByAscDescEventsForge(first.getBodyForge(), first.getStreamCountIncoming(), isDescending);
}
示例9: getEnumForge
import com.espertech.esper.event.arr.ObjectArrayEventType; //导入依赖的package包/类
public EnumForge getEnumForge(EngineImportService engineImportService, EventAdapterService eventAdapterService, StreamTypeService streamTypeService, int statementId, String enumMethodUsedName, List<ExprDotEvalParam> bodiesAndParameters, EventType inputEventType, Class collectionComponentType, int numStreamsIncoming, boolean disablePropertyExpressionEventCollCache) {
ExprDotEvalParamLambda first = (ExprDotEvalParamLambda) bodiesAndParameters.get(0);
if (inputEventType != null) {
super.setTypeInfo(EPTypeHelper.collectionOfEvents(inputEventType));
if (first.getGoesToNames().size() == 1) {
return new EnumWhereEventsForge(first.getBodyForge(), first.getStreamCountIncoming());
}
return new EnumWhereIndexEventsForge(first.getBodyForge(), first.getStreamCountIncoming(), (ObjectArrayEventType) first.getGoesToTypes()[1]);
}
super.setTypeInfo(EPTypeHelper.collectionOfSingleValue(collectionComponentType));
if (first.getGoesToNames().size() == 1) {
return new EnumWhereScalarForge(first.getBodyForge(), first.getStreamCountIncoming(), (ObjectArrayEventType) first.getGoesToTypes()[0]);
}
return new EnumWhereScalarIndexForge(first.getBodyForge(), first.getStreamCountIncoming(), (ObjectArrayEventType) first.getGoesToTypes()[0], (ObjectArrayEventType) first.getGoesToTypes()[1]);
}
示例10: codegen
import com.espertech.esper.event.arr.ObjectArrayEventType; //导入依赖的package包/类
public static CodegenExpression codegen(EnumGroupByKeyValueSelectorScalarLambdaForge forge, EnumForgeCodegenParams args, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) {
CodegenMember resultTypeMember = codegenClassScope.makeAddMember(ObjectArrayEventType.class, forge.resultEventType);
ExprForgeCodegenSymbol scope = new ExprForgeCodegenSymbol(false, null);
CodegenMethodNode methodNode = codegenMethodScope.makeChildWithScope(Map.class, EnumGroupByKeyValueSelectorScalarLambdaForgeEval.class, scope, codegenClassScope).addParam(EnumForgeCodegenNames.PARAMS);
CodegenBlock block = methodNode.getBlock()
.ifCondition(exprDotMethod(EnumForgeCodegenNames.REF_ENUMCOLL, "isEmpty"))
.blockReturn(staticMethod(Collections.class, "emptyMap"))
.declareVar(Map.class, "result", newInstance(LinkedHashMap.class))
.declareVar(ObjectArrayEventBean.class, "resultEvent", newInstance(ObjectArrayEventBean.class, newArrayByLength(Object.class, constant(1)), member(resultTypeMember.getMemberId())))
.assignArrayElement(EnumForgeCodegenNames.REF_EPS, constant(forge.streamNumLambda), ref("resultEvent"))
.declareVar(Object[].class, "props", exprDotMethod(ref("resultEvent"), "getProperties"));
block.forEach(Object.class, "next", EnumForgeCodegenNames.REF_ENUMCOLL)
.assignArrayElement("props", constant(0), ref("next"))
.declareVar(Object.class, "key", forge.innerExpression.evaluateCodegen(Object.class, methodNode, scope, codegenClassScope))
.declareVar(Object.class, "entry", forge.secondExpression.evaluateCodegen(Object.class, methodNode, scope, codegenClassScope))
.declareVar(Collection.class, "value", cast(Collection.class, exprDotMethod(ref("result"), "get", ref("key"))))
.ifRefNull("value")
.assignRef("value", newInstance(ArrayList.class))
.expression(exprDotMethod(ref("result"), "put", ref("key"), ref("value")))
.blockEnd()
.expression(exprDotMethod(ref("value"), "add", ref("entry")));
block.methodReturn(ref("result"));
return localMethod(methodNode, args.getEps(), args.getEnumcoll(), args.getIsNewData(), args.getExprCtx());
}
示例11: getEnumForge
import com.espertech.esper.event.arr.ObjectArrayEventType; //导入依赖的package包/类
public EnumForge getEnumForge(EngineImportService engineImportService, EventAdapterService eventAdapterService, StreamTypeService streamTypeService, int statementId, String enumMethodUsedName, List<ExprDotEvalParam> bodiesAndParameters, EventType inputEventType, Class collectionComponentType, int numStreamsIncoming, boolean disablePropertyExpressionEventCollCache) {
super.setTypeInfo(EPTypeHelper.singleValue(Map.class));
ExprDotEvalParamLambda first = (ExprDotEvalParamLambda) bodiesAndParameters.get(0);
if (bodiesAndParameters.size() == 2) {
ExprDotEvalParamLambda second = (ExprDotEvalParamLambda) bodiesAndParameters.get(1);
if (inputEventType == null) {
return new EnumGroupByKeyValueSelectorScalarLambdaForge(first.getBodyForge(), first.getStreamCountIncoming(), second.getBodyForge(),
(ObjectArrayEventType) first.getGoesToTypes()[0]);
}
return new EnumGroupByKeyValueSelectorEventsForge(first.getBodyForge(), first.getStreamCountIncoming(), second.getBodyForge());
}
if (inputEventType == null) {
return new EnumGroupByKeySelectorScalarLambdaForge(first.getBodyForge(), first.getStreamCountIncoming(),
(ObjectArrayEventType) first.getGoesToTypes()[0]);
}
return new EnumGroupByKeySelectorEventsForge(first.getBodyForge(), first.getStreamCountIncoming());
}
示例12: EventBeanManufacturerObjectArray
import com.espertech.esper.event.arr.ObjectArrayEventType; //导入依赖的package包/类
/**
* Ctor.
*
* @param eventType type to create
* @param eventAdapterService event factory
* @param properties written properties
*/
public EventBeanManufacturerObjectArray(ObjectArrayEventType eventType, EventAdapterService eventAdapterService, WriteablePropertyDescriptor[] properties) {
this.eventAdapterService = eventAdapterService;
this.eventType = eventType;
Map<String, Integer> indexes = eventType.getPropertiesIndexes();
indexPerWritable = new int[properties.length];
boolean oneToOneMapping = true;
for (int i = 0; i < properties.length; i++) {
String propertyName = properties[i].getPropertyName();
Integer index = indexes.get(propertyName);
if (index == null) {
throw new IllegalStateException("Failed to find property '" + propertyName + "' among the array indexes");
}
indexPerWritable[i] = index;
if (index != i) {
oneToOneMapping = false;
}
}
oneToOne = oneToOneMapping && properties.length == eventType.getPropertyNames().length;
}
示例13: codegen
import com.espertech.esper.event.arr.ObjectArrayEventType; //导入依赖的package包/类
public static CodegenExpression codegen(EnumSumScalarLambdaForge forge, EnumForgeCodegenParams args, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) {
Class innerType = forge.innerExpression.getEvaluationType();
CodegenMember resultTypeMember = codegenClassScope.makeAddMember(ObjectArrayEventType.class, forge.resultEventType);
ExprForgeCodegenSymbol scope = new ExprForgeCodegenSymbol(false, null);
CodegenMethodNode methodNode = codegenMethodScope.makeChildWithScope(forge.sumMethodFactory.getValueType(), EnumSumEventsForgeEval.class, scope, codegenClassScope).addParam(EnumForgeCodegenNames.PARAMS);
CodegenBlock block = methodNode.getBlock();
forge.sumMethodFactory.codegenDeclare(block);
block.declareVar(ObjectArrayEventBean.class, "resultEvent", newInstance(ObjectArrayEventBean.class, newArrayByLength(Object.class, constant(1)), member(resultTypeMember.getMemberId())))
.assignArrayElement(EnumForgeCodegenNames.REF_EPS, constant(forge.streamNumLambda), ref("resultEvent"))
.declareVar(Object[].class, "props", exprDotMethod(ref("resultEvent"), "getProperties"));
CodegenBlock forEach = block.forEach(Object.class, "next", EnumForgeCodegenNames.REF_ENUMCOLL)
.assignArrayElement("props", constant(0), ref("next"))
.declareVar(innerType, "value", forge.innerExpression.evaluateCodegen(innerType, methodNode, scope, codegenClassScope));
if (!innerType.isPrimitive()) {
forEach.ifRefNull("value").blockContinue();
}
forge.sumMethodFactory.codegenEnterNumberTypedNonNull(forEach, ref("value"));
forge.sumMethodFactory.codegenReturn(block);
return localMethod(methodNode, args.getEps(), args.getEnumcoll(), args.getIsNewData(), args.getExprCtx());
}
示例14: codegen
import com.espertech.esper.event.arr.ObjectArrayEventType; //导入依赖的package包/类
public static CodegenExpression codegen(EnumCountOfSelectorScalarForge forge, EnumForgeCodegenParams args, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) {
CodegenMember typeMember = codegenClassScope.makeAddMember(ObjectArrayEventType.class, forge.type);
ExprForgeCodegenSymbol scope = new ExprForgeCodegenSymbol(false, null);
CodegenMethodNode methodNode = codegenMethodScope.makeChildWithScope(int.class, EnumCountOfSelectorScalarForgeEval.class, scope, codegenClassScope).addParam(EnumForgeCodegenNames.PARAMS);
CodegenBlock block = methodNode.getBlock()
.declareVar(int.class, "count", constant(0))
.declareVar(ObjectArrayEventBean.class, "evalEvent", newInstance(ObjectArrayEventBean.class, newArrayByLength(Object.class, constant(1)), member(typeMember.getMemberId())))
.assignArrayElement(EnumForgeCodegenNames.REF_EPS, constant(forge.streamNumLambda), ref("evalEvent"))
.declareVar(Object[].class, "props", exprDotMethod(ref("evalEvent"), "getProperties"));
CodegenBlock forEach = block.forEach(Object.class, "next", EnumForgeCodegenNames.REF_ENUMCOLL)
.assignArrayElement(ref("props"), constant(0), ref("next"));
CodegenLegoBooleanExpression.codegenContinueIfNullOrNotPass(forEach, forge.innerExpression.getEvaluationType(), forge.innerExpression.evaluateCodegen(Boolean.class, methodNode, scope, codegenClassScope));
forEach.increment("count");
block.methodReturn(ref("count"));
return localMethod(methodNode, args.getEps(), args.getEnumcoll(), args.getIsNewData(), args.getExprCtx());
}
示例15: codegen
import com.espertech.esper.event.arr.ObjectArrayEventType; //导入依赖的package包/类
public static CodegenExpression codegen(EnumDistinctScalarLambdaForge forge, EnumForgeCodegenParams args, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) {
CodegenMember typeMember = codegenClassScope.makeAddMember(ObjectArrayEventType.class, forge.resultEventType);
Class innerType = JavaClassHelper.getBoxedType(forge.innerExpression.getEvaluationType());
ExprForgeCodegenSymbol scope = new ExprForgeCodegenSymbol(false, null);
CodegenMethodNode methodNode = codegenMethodScope.makeChildWithScope(Collection.class, EnumDistinctScalarLambdaForgeEval.class, scope, codegenClassScope).addParam(EnumForgeCodegenNames.PARAMS);
CodegenBlock block = methodNode.getBlock()
.ifCondition(relational(exprDotMethod(EnumForgeCodegenNames.REF_ENUMCOLL, "size"), LE, constant(1)))
.blockReturn(EnumForgeCodegenNames.REF_ENUMCOLL)
.declareVar(Map.class, "distinct", newInstance(LinkedHashMap.class))
.declareVar(ObjectArrayEventBean.class, "resultEvent", newInstance(ObjectArrayEventBean.class, newArrayByLength(Object.class, constant(1)), member(typeMember.getMemberId())))
.assignArrayElement(EnumForgeCodegenNames.REF_EPS, constant(forge.streamNumLambda), ref("resultEvent"))
.declareVar(Object[].class, "props", exprDotMethod(ref("resultEvent"), "getProperties"));
block.forEach(Object.class, "next", EnumForgeCodegenNames.REF_ENUMCOLL)
.assignArrayElement("props", constant(0), ref("next"))
.declareVar(innerType, "comparable", forge.innerExpression.evaluateCodegen(innerType, methodNode, scope, codegenClassScope))
.ifCondition(not(exprDotMethod(ref("distinct"), "containsKey", ref("comparable"))))
.expression(exprDotMethod(ref("distinct"), "put", ref("comparable"), ref("next")))
.blockEnd();
block.methodReturn(exprDotMethod(ref("distinct"), "values"));
return localMethod(methodNode, args.getEps(), args.getEnumcoll(), args.getIsNewData(), args.getExprCtx());
}