当前位置: 首页>>代码示例>>Java>>正文


Java ExprDeclaredNode类代码示例

本文整理汇总了Java中com.espertech.esper.epl.declexpr.ExprDeclaredNode的典型用法代码示例。如果您正苦于以下问题:Java ExprDeclaredNode类的具体用法?Java ExprDeclaredNode怎么用?Java ExprDeclaredNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExprDeclaredNode类属于com.espertech.esper.epl.declexpr包,在下文中一共展示了ExprDeclaredNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visit

import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
public void visit(ExprNode exprNode) {

        if (exprNode instanceof ExprDotNode) {
            chainedExpressionsDot.add((ExprDotNode) exprNode);
        }

        if (exprNode instanceof ExprDeclaredNode) {
            declaredExpressions.add((ExprDeclaredNode) exprNode);
        }

        if (!(exprNode instanceof ExprSubselectNode)) {
            return;
        }

        ExprSubselectNode subselectNode = (ExprSubselectNode) exprNode;
        subselects.add(subselectNode);
    }
 
开发者ID:espertechinc,项目名称:esper,代码行数:18,代码来源:ExprNodeSubselectDeclaredDotVisitor.java

示例2: getDeclaredExpressionCallHierarchy

import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
public static Map<ExprDeclaredNode, List<ExprDeclaredNode>> getDeclaredExpressionCallHierarchy(ExprDeclaredNode[] declaredExpressions) {
    ExprNodeSubselectDeclaredDotVisitor visitor = new ExprNodeSubselectDeclaredDotVisitor();
    Map<ExprDeclaredNode, List<ExprDeclaredNode>> calledToCallerMap = new HashMap<ExprDeclaredNode, List<ExprDeclaredNode>>();
    for (ExprDeclaredNode node : declaredExpressions) {
        visitor.reset();
        node.accept(visitor);
        for (ExprDeclaredNode called : visitor.getDeclaredExpressions()) {
            if (called == node) {
                continue;
            }
            List<ExprDeclaredNode> callers = calledToCallerMap.get(called);
            if (callers == null) {
                callers = new ArrayList<ExprDeclaredNode>(2);
                calledToCallerMap.put(called, callers);
            }
            callers.add(node);
        }
        if (!calledToCallerMap.containsKey(node)) {
            calledToCallerMap.put(node, Collections.<ExprDeclaredNode>emptyList());
        }
    }
    return calledToCallerMap;
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:24,代码来源:ExprNodeUtilityRich.java

示例3: determineTableAccessNodes

import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
private Set<ExprTableAccessNode> determineTableAccessNodes(Set<ExprTableAccessNode> statementDirectTableAccess, ExprNodeSubselectDeclaredDotVisitor visitor) {
    Set<ExprTableAccessNode> tableAccessNodes = new HashSet<ExprTableAccessNode>();
    if (statementDirectTableAccess != null) {
        tableAccessNodes.addAll(statementDirectTableAccess);
    }
    // include all declared expression usages
    ExprNodeTableAccessVisitor tableAccessVisitor = new ExprNodeTableAccessVisitor(tableAccessNodes);
    for (ExprDeclaredNode declared : visitor.getDeclaredExpressions()) {
        declared.getBody().accept(tableAccessVisitor);
    }
    // include all subqueries (and their declared expressions)
    // This is nested as declared expressions can have more subqueries, however all subqueries are in this list.
    for (ExprSubselectNode subselectNode : visitor.getSubselects()) {
        if (subselectNode.getStatementSpecRaw().getTableExpressions() != null) {
            tableAccessNodes.addAll(subselectNode.getStatementSpecRaw().getTableExpressions());
        }
    }
    return tableAccessNodes;
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:20,代码来源:StatementLifecycleSvcImpl.java

示例4: visit

import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
public void visit(ExprNode exprNode, ExprNode parentExprNode) {

        if (exprNode instanceof ExprDotNode)
        {
            chainedExpressionsDot.add((ExprDotNode) exprNode);
        }

        if (exprNode instanceof ExprDeclaredNode)
        {
            declaredExpressions.add((ExprDeclaredNode) exprNode);
        }

        if (!(exprNode instanceof ExprSubselectNode))
        {
            return;
        }

        ExprSubselectNode subselectNode = (ExprSubselectNode) exprNode;
        subselects.add(subselectNode);
    }
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:21,代码来源:ExprNodeSubselectDeclaredDotVisitor.java

示例5: findColumnNameForAggregation

import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
private static String findColumnNameForAggregation(Map<ExprNode, String> selectClauseNamedNodes, List<ExprDeclaredNode> declaredExpressions, ExprAggregateNode aggregationNode) {
    if (selectClauseNamedNodes.containsKey(aggregationNode)) {
        return selectClauseNamedNodes.get(aggregationNode);
    }

    for (ExprDeclaredNode node : declaredExpressions) {
        if (node.getBody() == aggregationNode) {
            return node.getPrototype().getName();
        }
    }

    return null;
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:14,代码来源:AggregationServiceFactoryFactory.java

示例6: validateIndexNamedParameter

import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
private void validateIndexNamedParameter(ExprValidationContext validationContext) throws ExprValidationException {
    if (indexNamedParameter.length != 1 || !(indexNamedParameter[0] instanceof ExprDeclaredNode)) {
        throw getIndexNameMessage("requires an expression name");
    }
    ExprDeclaredNode node = (ExprDeclaredNode) indexNamedParameter[0];
    if (!(node.getBody() instanceof ExprDotNode)) {
        throw getIndexNameMessage("requires an index expression");
    }
    ExprDotNode dotNode = (ExprDotNode) node.getBody();
    if (dotNode.getChainSpec().size() > 1) {
        throw getIndexNameMessage("invalid chained index expression");
    }
    List<ExprNode> params = dotNode.getChainSpec().get(0).getParameters();
    String indexTypeName = dotNode.getChainSpec().get(0).getName();
    optionalIndexName = node.getPrototype().getName();

    AdvancedIndexFactoryProvider provider;
    try {
        provider = validationContext.getEngineImportService().resolveAdvancedIndexProvider(indexTypeName);
    } catch (EngineImportException e) {
        throw new ExprValidationException(e.getMessage(), e);
    }

    if (!indexTypeName.toLowerCase(Locale.ENGLISH).equals(indexTypeName())) {
        throw new ExprValidationException("Invalid index type '" + indexTypeName + "', expected '" + indexTypeName() + "'");
    }

    optionalIndexConfig = provider.validateConfigureFilterIndex(optionalIndexName, indexTypeName, ExprNodeUtilityCore.toArray(params), validationContext);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:30,代码来源:EngineImportApplicationDotMethodBase.java

示例7: recursiveAggregateHandleSpecial

import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
private static void recursiveAggregateHandleSpecial(ExprNode topNode, Map<Integer, List<ExprAggregateNode>> aggregateExprPerLevel, int level) {
    if (topNode instanceof ExprNodeInnerNodeProvider) {
        ExprNodeInnerNodeProvider parameterized = (ExprNodeInnerNodeProvider) topNode;
        List<ExprNode> additionalNodes = parameterized.getAdditionalNodes();
        for (ExprNode additionalNode : additionalNodes) {
            recursiveAggregateEnter(additionalNode, aggregateExprPerLevel, level);
        }
    }

    if (topNode instanceof ExprDeclaredNode) {
        ExprDeclaredNode declared = (ExprDeclaredNode) topNode;
        recursiveAggregateEnter(declared.getBody(), aggregateExprPerLevel, level);
    }
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:15,代码来源:ExprAggregateNodeUtil.java

示例8: planSubSelect

import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
protected static SubSelectStrategyCollection planSubSelect(EPServicesContext services,
                                                           StatementContext statementContext,
                                                           boolean queryPlanLogging,
                                                           SubSelectActivationCollection subSelectStreamDesc,
                                                           String[] outerStreamNames,
                                                           EventType[] outerEventTypesSelect,
                                                           String[] outerEventTypeNamees,
                                                           ExprDeclaredNode[] declaredExpressions,
                                                           ContextPropertyRegistry contextPropertyRegistry)
        throws ExprValidationException, ViewProcessingException {
    int subqueryNum = -1;
    SubSelectStrategyCollection collection = new SubSelectStrategyCollection();

    Map<ExprDeclaredNode, List<ExprDeclaredNode>> declaredExpressionCallHierarchy = null;
    if (declaredExpressions.length > 0) {
        declaredExpressionCallHierarchy = ExprNodeUtilityRich.getDeclaredExpressionCallHierarchy(declaredExpressions);
    }

    for (Map.Entry<ExprSubselectNode, SubSelectActivationHolder> entry : subSelectStreamDesc.getSubqueries().entrySet()) {
        subqueryNum++;
        ExprSubselectNode subselect = entry.getKey();
        SubSelectActivationHolder subSelectActivation = entry.getValue();

        try {
            SubSelectStrategyFactoryDesc factoryDesc = planSubSelectInternal(subqueryNum, subselect, subSelectActivation,
                    services, statementContext, queryPlanLogging, subSelectStreamDesc,
                    outerStreamNames, outerEventTypesSelect, outerEventTypeNamees,
                    declaredExpressions, contextPropertyRegistry, declaredExpressionCallHierarchy);
            collection.add(subselect, factoryDesc);
        } catch (Exception ex) {
            throw new ExprValidationException("Failed to plan " + getSubqueryInfoText(subqueryNum, subselect) + ": " + ex.getMessage(), ex);
        }
    }

    return collection;
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:37,代码来源:EPStatementStartMethodHelperSubselect.java

示例9: StatementSpecCompiled

import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
/**
 * Ctor.
 */
public StatementSpecCompiled()
{
    onTriggerDesc = null;
    createWindowDesc = null;
    createIndexDesc = null;
    createVariableDesc = null;
    createSchemaDesc = null;
    insertIntoDesc = null;
    selectStreamDirEnum = SelectClauseStreamSelectorEnum.RSTREAM_ISTREAM_BOTH;
    selectClauseSpec = new SelectClauseSpecCompiled(false);
    streamSpecs = new ArrayList<StreamSpecCompiled>();
    outerJoinDescList = new ArrayList<OuterJoinDesc>();
    filterExprRootNode = null;
    groupByExpressions = new ArrayList<ExprNode>();
    havingExprRootNode = null;
    outputLimitSpec = null;
    orderByList = new ArrayList<OrderByItem>();
    subSelectExpressions = new ArrayList<ExprSubselectNode>();
    declaredExpressions = new ArrayList<ExprDeclaredNode>();
    variableReferences = new HashSet<String>();
    rowLimitSpec = null;
    eventTypeReferences = new HashSet<String>();
    annotations = new Annotation[0];
    updateSpec = null;
    matchRecognizeSpec = null;
    forClauseSpec = null;
    sqlParameters = null;
    contextDesc = null;
    optionalContextName = null;
    createGraphDesc = null;
    createExpressionDesc = null;
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:36,代码来源:StatementSpecCompiled.java

示例10: ExprNodeSubselectDeclaredDotVisitor

import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
/**
 * Ctor.
 */
public ExprNodeSubselectDeclaredDotVisitor()
{
    subselects = new ArrayList<ExprSubselectNode>(1);
    chainedExpressionsDot = new ArrayList<ExprDotNode>(1);
    declaredExpressions = new ArrayList<ExprDeclaredNode>(1);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:10,代码来源:ExprNodeSubselectDeclaredDotVisitor.java

示例11: attach

import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
public void attach(EventType parentEventType, StatementContext statementContext, ViewFactory optionalParentFactory, List<ViewFactory> parentViewFactories) throws ViewParameterException {
    this.eventType = parentEventType;

    // define built-in fields
    Map<String, Object> builtinTypeDef = ExpressionViewOAFieldEnum.asMapOfTypes(eventType);
    builtinMapType = statementContext.getEventAdapterService().createAnonymousObjectArrayType(statementContext.getStatementId() + "_exprview", builtinTypeDef);
    StreamTypeService streamTypeService = new StreamTypeServiceImpl(new EventType[]{eventType, builtinMapType}, new String[2], new boolean[2], statementContext.getEngineURI(), false, false);

    // validate expression
    expiryExpression = ViewFactorySupport.validateExpr(getViewName(), statementContext, expiryExpression, streamTypeService, 0);

    ExprNodeSummaryVisitor summaryVisitor = new ExprNodeSummaryVisitor();
    expiryExpression.accept(summaryVisitor);
    if (summaryVisitor.isHasSubselect() || summaryVisitor.isHasStreamSelect() || summaryVisitor.isHasPreviousPrior()) {
        throw new ViewParameterException("Invalid expiry expression: Sub-select, previous or prior functions are not supported in this context");
    }
    expiryExpressionEvaluator = ExprNodeCompiler.allocateEvaluator(expiryExpression.getForge(), statementContext.getEngineImportService(), ExpressionViewFactoryBase.class, false, statementContext.getStatementName());

    Class returnType = expiryExpression.getForge().getEvaluationType();
    if (JavaClassHelper.getBoxedType(returnType) != Boolean.class) {
        throw new ViewParameterException("Invalid return value for expiry expression, expected a boolean return value but received " + JavaClassHelper.getParameterAsString(returnType));
    }

    // determine variables used, if any
    ExprNodeVariableVisitor visitor = new ExprNodeVariableVisitor(statementContext.getVariableService());
    expiryExpression.accept(visitor);
    variableNames = visitor.getVariableNames();

    // determine aggregation nodes, if any
    List<ExprAggregateNode> aggregateNodes = new ArrayList<ExprAggregateNode>();
    ExprAggregateNodeUtil.getAggregatesBottomUp(expiryExpression, aggregateNodes);
    if (!aggregateNodes.isEmpty()) {
        try {
            AggregationServiceForgeDesc forge = AggregationServiceFactoryFactory.getService(Collections.<ExprAggregateNode>emptyList(), Collections.<ExprNode, String>emptyMap(), Collections.<ExprDeclaredNode>emptyList(), null, aggregateNodes, Collections.<ExprAggregateNode>emptyList(), Collections.<ExprAggregateNodeGroupKey>emptyList(), false, statementContext.getAnnotations(), statementContext.getVariableService(), false, false, null, null, statementContext.getAggregationServiceFactoryService(), streamTypeService.getEventTypes(), null, statementContext.getContextName(), null, null, false, false, false, statementContext.getEngineImportService(), statementContext.getStatementName(), statementContext.getTimeAbacus());
            AggregationServiceFactory factory = AggregationServiceFactoryCompiler.allocate(forge.getAggregationServiceFactoryForge(), statementContext, false);
            aggregationServiceFactoryDesc = new AggregationServiceFactoryDesc(factory, forge.getExpressions(), forge.getGroupKeyExpressions());
        } catch (ExprValidationException ex) {
            throw new ViewParameterException(ex.getMessage(), ex);
        }
    }
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:42,代码来源:ExpressionViewFactoryBase.java

示例12: matchBindingsAssignColumnNumbers

import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
private static BindingMatchResult matchBindingsAssignColumnNumbers(IntoTableSpec bindings,
                                                                   TableMetadata metadata,
                                                                   List<AggregationServiceAggExpressionDesc> aggregations,
                                                                   Map<ExprNode, String> selectClauseNamedNodes,
                                                                   List<ExprForge[]> methodAggForgesList,
                                                                   List<ExprDeclaredNode> declaredExpressions,
                                                                   EngineImportService engineImportService,
                                                                   String statementName,
                                                                   boolean isFireAndForget)
        throws ExprValidationException {
    Map<AggregationServiceAggExpressionDesc, TableMetadataColumnAggregation> methodAggs = new LinkedHashMap<AggregationServiceAggExpressionDesc, TableMetadataColumnAggregation>();
    Map<AggregationServiceAggExpressionDesc, TableMetadataColumnAggregation> accessAggs = new LinkedHashMap<AggregationServiceAggExpressionDesc, TableMetadataColumnAggregation>();
    for (AggregationServiceAggExpressionDesc aggDesc : aggregations) {

        // determine assigned name
        String columnName = findColumnNameForAggregation(selectClauseNamedNodes, declaredExpressions, aggDesc.getAggregationNode());
        if (columnName == null) {
            throw new ExprValidationException("Failed to find an expression among the select-clause expressions for expression '" + ExprNodeUtilityCore.toExpressionStringMinPrecedenceSafe(aggDesc.getAggregationNode()) + "'");
        }

        // determine binding metadata
        TableMetadataColumnAggregation columnMetadata = (TableMetadataColumnAggregation) metadata.getTableColumns().get(columnName);
        if (columnMetadata == null) {
            throw new ExprValidationException("Failed to find name '" + columnName + "' among the columns for table '" + bindings.getName() + "'");
        }

        // validate compatible
        validateIntoTableCompatible(bindings.getName(), columnName, columnMetadata, aggDesc);

        if (!columnMetadata.getFactory().isAccessAggregation()) {
            methodAggs.put(aggDesc, columnMetadata);
        } else {
            accessAggs.put(aggDesc, columnMetadata);
        }
    }

    // handle method-aggs
    TableColumnMethodPair[] methodPairs = new TableColumnMethodPair[methodAggForgesList.size()];
    int methodIndex = -1;
    for (Map.Entry<AggregationServiceAggExpressionDesc, TableMetadataColumnAggregation> methodEntry : methodAggs.entrySet()) {
        methodIndex++;
        int targetIndex = methodEntry.getValue().getMethodOffset();
        ExprForge[] forges = methodAggForgesList.get(methodIndex);
        ExprEvaluator evaluator = ExprNodeUtilityRich.getEvaluatorMayCompileWMultiValue(forges, engineImportService, AggregationServiceFactoryFactory.class, isFireAndForget, statementName);
        methodPairs[methodIndex] = new TableColumnMethodPair(evaluator, forges, targetIndex, methodEntry.getKey().getAggregationNode());
        methodEntry.getKey().setColumnNum(targetIndex);
    }

    // handle access-aggs
    Map<Integer, ExprNode> accessSlots = new LinkedHashMap<Integer, ExprNode>();
    List<AggregationAccessorSlotPairForge> accessReadPairs = new ArrayList<>();
    int accessIndex = -1;
    List<AggregationAgentForge> agents = new ArrayList<>();
    for (Map.Entry<AggregationServiceAggExpressionDesc, TableMetadataColumnAggregation> accessEntry : accessAggs.entrySet()) {
        accessIndex++;
        int slot = accessEntry.getValue().getAccessAccessorSlotPair().getSlot();
        AggregationMethodFactory aggregationMethodFactory = accessEntry.getKey().getFactory();
        AggregationAccessorForge accessorForge = aggregationMethodFactory.getAccessorForge();
        accessSlots.put(slot, accessEntry.getKey().getAggregationNode());
        accessReadPairs.add(new AggregationAccessorSlotPairForge(slot, accessorForge));
        accessEntry.getKey().setColumnNum(metadata.getNumberMethodAggregations() + accessIndex);
        agents.add(aggregationMethodFactory.getAggregationStateAgent(engineImportService, statementName));
    }
    AggregationAgentForge[] agentArr = agents.toArray(new AggregationAgentForge[agents.size()]);
    AggregationAccessorSlotPairForge[] accessReads = accessReadPairs.toArray(new AggregationAccessorSlotPairForge[accessReadPairs.size()]);

    int[] targetStates = new int[accessSlots.size()];
    ExprNode[] accessStateExpr = new ExprNode[accessSlots.size()];
    int count = 0;
    for (Map.Entry<Integer, ExprNode> entry : accessSlots.entrySet()) {
        targetStates[count] = entry.getKey();
        accessStateExpr[count] = entry.getValue();
        count++;
    }

    return new BindingMatchResult(methodPairs, accessReads, targetStates, accessStateExpr, agentArr);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:78,代码来源:AggregationServiceFactoryFactory.java

示例13: ExprNodeDeclaredVisitor

import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
/**
 * Ctor.
 */
public ExprNodeDeclaredVisitor() {
    declaredExpressions = new ArrayList<ExprDeclaredNode>(1);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:7,代码来源:ExprNodeDeclaredVisitor.java

示例14: getDeclaredExpressions

import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
public List<ExprDeclaredNode> getDeclaredExpressions() {
    return declaredExpressions;
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:4,代码来源:ExprNodeDeclaredVisitor.java

示例15: visit

import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
public void visit(ExprNode exprNode) {

        if (exprNode instanceof ExprDeclaredNode) {
            declaredExpressions.add((ExprDeclaredNode) exprNode);
        }
    }
 
开发者ID:espertechinc,项目名称:esper,代码行数:7,代码来源:ExprNodeDeclaredVisitor.java


注:本文中的com.espertech.esper.epl.declexpr.ExprDeclaredNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。