public static CodegenExpression makeArray(Collection<NameAndModule> names) { if (names.isEmpty()) { return enumValue(NameAndModule.class, "EMPTY_ARRAY"); } CodegenExpression[] expressions = new CodegenExpression[names.size()]; int count = 0; for (NameAndModule entry : names) { expressions[count++] = entry.make(); } return newArrayWithInit(NameAndModule.class, expressions); }
public static CodegenExpression makeArray(Collection<ModuleIndexMeta> names) { if (names.isEmpty()) { return enumValue(ModuleIndexMeta.class, "EMPTY_ARRAY"); } CodegenExpression[] expressions = new CodegenExpression[names.size()]; int count = 0; for (ModuleIndexMeta entry : names) { expressions[count++] = entry.make(); } return newArrayWithInit(ModuleIndexMeta.class, expressions); }
public static CodegenExpression makeArray(Collection<NameParamNumAndModule> names) { if (names.isEmpty()) { return enumValue(NameParamNumAndModule.class, "EMPTY_ARRAY"); } CodegenExpression[] expressions = new CodegenExpression[names.size()]; int count = 0; for (NameParamNumAndModule entry : names) { expressions[count++] = entry.make(); } return newArrayWithInit(NameParamNumAndModule.class, expressions); }
public CodegenExpression evaluateCodegenUninstrumented(Class requiredType, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { if (value == null) { return constantNull(); } if (value.getClass().isEnum()) { return enumValue(value.getClass(), value.toString()); } if (enumValue != null) { return publicConstValue(enumValue.getEnumClass(), enumValue.getEnumField().getName()); } return constant(value); }
public CodegenExpression make(CodegenMethod method, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { CodegenExpression resolveTable = table == null ? constantNull() : TableDeployTimeResolver.makeResolveTable(table, symbols.getAddInitSvc(method)); return newInstance(OutputStrategyPostProcessFactory.class, constant(isRouted), enumValue(SelectClauseStreamSelectorEnum.class, insertIntoStreamSelector.name()), enumValue(SelectClauseStreamSelectorEnum.class, selectStreamSelector.name()), constant(routeToFront), resolveTable); } }
protected static CodegenExpression codegenLDTZDTMinMax(CodegenExpression val, boolean max, CalendarFieldEnum fieldName) { CodegenExpression chronoField = enumValue(ChronoField.class, fieldName.getChronoField().name()); CodegenExpression valueRange = exprDotMethod(val, "range", chronoField); return exprDotMethod(val, "with", chronoField, exprDotMethod(valueRange, max ? "getMaximum" : "getMinimum")); } }
public CodegenExpression codegenCreateReader(CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { CodegenMethod method = parent.makeChild(AggregationMultiFunctionAggregationMethod.class, this.getClass(), classScope); method.getBlock() .methodReturn(staticMethod(AggregationMethodSortedNoParamFactory.class, "makeSortedAggregationNoParam", enumValue(AggregationMethodSortedEnum.class, aggMethod.name()), constant(underlyingClass))); return localMethod(method); }
private CodegenExpression codegenLDTZDT(CodegenExpression val, Class type) { CodegenExpression chronoUnit = enumValue(ChronoUnit.class, fieldName.getChronoUnit().name()); if (code == ApacheCommonsDateUtils.MODIFY_TRUNCATE) { return exprDotMethod(val, "truncatedTo", chronoUnit); } else if (code == ApacheCommonsDateUtils.MODIFY_CEILING) { return exprDotMethodChain(val).add("plus", constant(1), chronoUnit).add("truncatedTo", chronoUnit); } else { throw new EPException("Round-half operation not supported for " + type.getSimpleName()); } } }
public CodegenExpression make(CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { CodegenMethod method = parent.makeChild(QueryGraphValueEntryRangeRelOp.class, this.getClass(), classScope); method.getBlock() .declareVar(ExprEvaluator.class, "expression", ExprNodeUtilityCodegen.codegenEvaluatorNoCoerce(expression.getForge(), method, this.getClass(), classScope)) .methodReturn(newInstance(QueryGraphValueEntryRangeRelOp.class, enumValue(QueryGraphRangeEnum.class, type.name()), ref("expression"), constant(isBetweenPart))); return localMethod(method); } }
public CodegenExpression initCtorScoped() { if (mathContext == null) { return constantNull(); } return newInstance(MathContext.class, constant(mathContext.getPrecision()), enumValue(RoundingMode.class, mathContext.getRoundingMode().name())); }
public CodegenExpression codegenCreateReader(CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { CodegenMethod method = parent.makeChild(AggregationMultiFunctionAggregationMethod.class, this.getClass(), classScope); method.getBlock() .declareVar(ExprEvaluator.class, "keyEval", ExprNodeUtilityCodegen.codegenEvaluator(key.getForge(), method, this.getClass(), classScope)) .methodReturn(staticMethod(AggregationMethodSortedKeyedFactory.class, "makeSortedAggregationWithKey", ref("keyEval"), enumValue(AggregationMethodSortedEnum.class, aggMethod.name()), constant(underlyingClass))); return localMethod(method); }
public CodegenExpression make(Class optCoercionType, CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { CodegenMethod method = parent.makeChild(QueryGraphValueEntryRange.class, this.getClass(), classScope); method.getBlock() .declareVar(ExprEvaluator.class, "expression", ExprNodeUtilityCodegen.codegenEvaluatorWCoerce(expression.getForge(), optCoercionType, method, this.getClass(), classScope)) .methodReturn(newInstance(QueryGraphValueEntryRangeRelOp.class, enumValue(QueryGraphRangeEnum.class, type.name()), ref("expression"), constant(isBetweenPart))); return localMethod(method); }
public CodegenExpression make(Class optCoercionType, CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { CodegenMethod method = parent.makeChild(QueryGraphValueEntryRange.class, this.getClass(), classScope); method.getBlock() .declareVar(ExprEvaluator.class, "start", ExprNodeUtilityCodegen.codegenEvaluatorWCoerce(exprStart.getForge(), optCoercionType, method, this.getClass(), classScope)) .declareVar(ExprEvaluator.class, "end", ExprNodeUtilityCodegen.codegenEvaluatorWCoerce(exprEnd.getForge(), optCoercionType, method, this.getClass(), classScope)) .methodReturn(newInstance(QueryGraphValueEntryRangeIn.class, enumValue(QueryGraphRangeEnum.class, type.name()), ref("start"), ref("end"), constant(allowRangeReversal))); return localMethod(method); }
public CodegenExpression make(CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { CodegenMethod method = parent.makeChild(QueryGraphValueEntryRangeIn.class, this.getClass(), classScope); method.getBlock() .declareVar(ExprEvaluator.class, "start", ExprNodeUtilityCodegen.codegenEvaluator(exprStart.getForge(), method, this.getClass(), classScope)) .declareVar(ExprEvaluator.class, "end", ExprNodeUtilityCodegen.codegenEvaluator(exprEnd.getForge(), method, this.getClass(), classScope)) .methodReturn(newInstance(QueryGraphValueEntryRangeIn.class, enumValue(QueryGraphRangeEnum.class, type.name()), ref("start"), ref("end"), constant(allowRangeReversal))); return localMethod(method); } }
public CodegenExpression codegenCreateReader(CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { CodegenMethod method = parent.makeChild(AggregationMultiFunctionAggregationMethod.class, this.getClass(), classScope); method.getBlock() .declareVar(ExprEvaluator.class, "fromKeyEval", ExprNodeUtilityCodegen.codegenEvaluator(fromKey.getForge(), method, this.getClass(), classScope)) .declareVar(ExprEvaluator.class, "fromInclusiveEval", ExprNodeUtilityCodegen.codegenEvaluator(fromInclusive.getForge(), method, this.getClass(), classScope)) .declareVar(ExprEvaluator.class, "toKeyEval", ExprNodeUtilityCodegen.codegenEvaluator(toKey.getForge(), method, this.getClass(), classScope)) .declareVar(ExprEvaluator.class, "toInclusiveEval", ExprNodeUtilityCodegen.codegenEvaluator(toInclusive.getForge(), method, this.getClass(), classScope)) .methodReturn(staticMethod(AggregationMethodSortedSubmapFactory.class, "makeSortedAggregationSubmap", ref("fromKeyEval"), ref("fromInclusiveEval"), ref("toKeyEval"), ref("toInclusiveEval"), enumValue(AggregationMethodSortedEnum.class, aggMethod.name()), constant(underlyingClass))); return localMethod(method); }
public CodegenMethod makeCodegen(CodegenClassScope classScope, CodegenMethodScope parent, SAIFFInitializeSymbolWEventType symbols) { CodegenMethod method = parent.makeChild(FilterSpecParamAdvancedIndexQuadTreePointRegion.class, this.getClass(), classScope); method.getBlock() .declareVar(ExprFilterSpecLookupable.class, "lookupable", localMethod(lookupable.makeCodegen(method, symbols, classScope))) .declareVar(FilterOperator.class, "op", enumValue(FilterOperator.class, filterOperator.name())) .declareVar(FilterSpecParamAdvancedIndexQuadTreePointRegion.class, "fpai", newInstance(FilterSpecParamAdvancedIndexQuadTreePointRegion.class, ref("lookupable"), ref("op"))) .exprDotMethod(ref("fpai"), "setxEval", makeAnonymous(xEval, this.getClass(), classScope, method)) .exprDotMethod(ref("fpai"), "setyEval", makeAnonymous(yEval, this.getClass(), classScope, method)) .methodReturn(ref("fpai")); return method; }
public CodegenMethod makeCodegen(CodegenClassScope classScope, CodegenMethodScope parent, SAIFFInitializeSymbolWEventType symbols) { CodegenMethod method = parent.makeChild(FilterSpecParam.class, FilterSpecParamConstantForge.class, classScope); method.getBlock() .declareVar(ExprFilterSpecLookupable.class, "lookupable", localMethod(lookupable.makeCodegen(method, symbols, classScope))) .declareVar(FilterOperator.class, "op", enumValue(FilterOperator.class, filterOperator.name())); CodegenExpressionNewAnonymousClass inner = newAnonymousClass(method.getBlock(), FilterSpecParam.class, Arrays.asList(ref("lookupable"), ref("op"))); CodegenMethod getFilterValue = CodegenMethod.makeParentNode(Object.class, this.getClass(), classScope).addParam(FilterSpecParam.GET_FILTER_VALUE_FP); inner.addMethod("getFilterValue", getFilterValue); getFilterValue.getBlock().methodReturn(constant(filterConstant)); method.getBlock().methodReturn(inner); return method; }
private static CodegenMethod obtainIteratorCodegen(ResultSetProcessorRowForAllForge forge, CodegenClassScope classScope, CodegenMethod parent, CodegenInstanceAux instance) { CodegenMethod selectList = getSelectListEventsAsArrayCodegen(forge, classScope, instance); CodegenMethod method = parent.makeChild(Iterator.class, ResultSetProcessorRowForAllImpl.class, classScope); method.getBlock().declareVar(EventBean[].class, "events", localMethod(selectList, constantTrue(), constantTrue(), constantFalse())) .ifRefNull("events") .blockReturn(enumValue(CollectionUtil.class, "NULL_EVENT_ITERATOR")) .methodReturn(newInstance(SingleEventIterator.class, arrayAtIndex(ref("events"), constant(0)))); return method; }
public static CodegenExpression codegenZDT(CalendarSetForge forge, CodegenExpression zdt, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { ChronoField chronoField = forge.fieldName.getChronoField(); CodegenMethod methodNode = codegenMethodScope.makeChild(ZonedDateTime.class, CalendarSetForgeOp.class, codegenClassScope).addParam(ZonedDateTime.class, "zdt"); 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("zdt")) .methodReturn(exprDotMethod(ref("zdt"), "with", enumValue(ChronoField.class, chronoField.name()), ref("value"))); return localMethod(methodNode, zdt); } }
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); }