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


Java EvalFactoryNode类代码示例

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


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

示例1: exitOnStreamExpr

import com.espertech.esper.pattern.EvalFactoryNode; //导入依赖的package包/类
public void exitOnStreamExpr(EsperEPL2GrammarParser.OnStreamExprContext ctx) {
    String streamAsName = ASTUtil.getStreamNameUnescapedOptional(ctx.identOrTicked());

    // get stream to use (pattern or filter)
    StreamSpecRaw streamSpec;
    if (ctx.eventFilterExpression() != null) {
        streamSpec = new FilterStreamSpecRaw(filterSpec, ViewSpec.EMPTY_VIEWSPEC_ARRAY, streamAsName, StreamSpecOptions.DEFAULT);
    } else if (ctx.patternInclusionExpression() != null) {
        if ((astPatternNodeMap.size() > 1) || ((astPatternNodeMap.isEmpty()))) {
            throw ASTWalkException.from("Unexpected AST tree contains zero or more then 1 child elements for root");
        }
        // Get expression node sub-tree from the AST nodes placed so far
        EvalFactoryNode evalNode = astPatternNodeMap.values().iterator().next();
        PatternLevelAnnotationFlags flags = getPatternFlags(ctx.patternInclusionExpression().annotationEnum());
        streamSpec = new PatternStreamSpecRaw(evalNode, ViewSpec.toArray(viewSpecs), streamAsName, StreamSpecOptions.DEFAULT, flags.isSuppressSameEventMatches(), flags.isDiscardPartialsOnMatch());
        astPatternNodeMap.clear();
    } else {
        throw new IllegalStateException("Invalid AST type node, cannot map to stream specification");
    }
    statementSpec.getStreamSpecs().add(streamSpec);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:22,代码来源:EPLTreeWalkerListener.java

示例2: exitFollowedByExpression

import com.espertech.esper.pattern.EvalFactoryNode; //导入依赖的package包/类
public void exitFollowedByExpression(EsperEPL2GrammarParser.FollowedByExpressionContext ctx) {
    if (ctx.getChildCount() < 2) {
        return;
    }
    List<EsperEPL2GrammarParser.FollowedByRepeatContext> repeats = ctx.followedByRepeat();
    ExprNode[] maxExpressions = new ExprNode[ctx.getChildCount() - 1];
    for (int i = 0; i < repeats.size(); i++) {
        EsperEPL2GrammarParser.FollowedByRepeatContext repeat = repeats.get(i);
        if (repeat.expression() != null) {
            maxExpressions[i] = ASTExprHelper.exprCollectSubNodes(repeat.expression(), 0, astExprNodeMap).get(0);
        }
    }

    List<ExprNode> expressions = Collections.emptyList();
    if (!CollectionUtil.isAllNullArray(maxExpressions)) {
        expressions = Arrays.asList(maxExpressions); // can contain null elements as max/no-max can be mixed
    }

    EvalFactoryNode fbNode = patternNodeFactory.makeFollowedByNode(expressions, configurationInformation.getEngineDefaults().getPatterns().getMaxSubexpressions() != null);
    ASTExprHelper.patternCollectAddSubnodesAddParentNode(fbNode, ctx, astPatternNodeMap);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:22,代码来源:EPLTreeWalkerListener.java

示例3: exitQualifyExpression

import com.espertech.esper.pattern.EvalFactoryNode; //导入依赖的package包/类
public void exitQualifyExpression(EsperEPL2GrammarParser.QualifyExpressionContext ctx) {
    if (ctx.getChildCount() < 2) {
        return;
    }
    if (ctx.matchUntilRange() != null) {
        EvalFactoryNode matchUntil = makeMatchUntil(ctx.matchUntilRange(), false);
        ASTExprHelper.patternCollectAddSubnodesAddParentNode(matchUntil, ctx.guardPostFix(), astPatternNodeMap);
    }

    EvalFactoryNode theNode;
    if (ctx.e != null) {
        theNode = this.patternNodeFactory.makeEveryNode();
    } else if (ctx.n != null) {
        theNode = this.patternNodeFactory.makeNotNode();
    } else if (ctx.d != null) {
        List<ExprNode> exprNodes = ASTExprHelper.exprCollectSubNodes(ctx.distinctExpressionList(), 0, astExprNodeMap);
        theNode = this.patternNodeFactory.makeEveryDistinctNode(exprNodes);
    } else {
        throw ASTWalkException.from("Failed to recognize node");
    }
    ASTExprHelper.patternCollectAddSubnodesAddParentNode(theNode, ctx, astPatternNodeMap);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:23,代码来源:EPLTreeWalkerListener.java

示例4: exitGuardPostFix

import com.espertech.esper.pattern.EvalFactoryNode; //导入依赖的package包/类
public void exitGuardPostFix(EsperEPL2GrammarParser.GuardPostFixContext ctx) {
    if (ctx.getChildCount() < 2) {
        return;
    }
    if (ctx.guardWhereExpression() == null && ctx.guardWhileExpression() == null) { // nested
        return;
    }
    String objectNamespace;
    String objectName;
    List<ExprNode> obsParameters;
    if (ctx.guardWhereExpression() != null) {
        objectNamespace = ctx.guardWhereExpression().getChild(0).getText();
        objectName = ctx.guardWhereExpression().getChild(2).getText();
        obsParameters = ASTExprHelper.exprCollectSubNodes(ctx.guardWhereExpression(), 3, astExprNodeMap);
    } else {
        objectNamespace = GuardEnum.WHILE_GUARD.getNamespace();
        objectName = GuardEnum.WHILE_GUARD.getName();
        obsParameters = ASTExprHelper.exprCollectSubNodes(ctx.guardWhileExpression(), 1, astExprNodeMap);
    }

    PatternGuardSpec guardSpec = new PatternGuardSpec(objectNamespace, objectName, obsParameters);
    EvalFactoryNode guardNode = patternNodeFactory.makeGuardNode(guardSpec);
    ASTExprHelper.patternCollectAddSubnodesAddParentNode(guardNode, ctx, astPatternNodeMap);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:25,代码来源:EPLTreeWalkerListener.java

示例5: endPattern

import com.espertech.esper.pattern.EvalFactoryNode; //导入依赖的package包/类
/**
 * End processing of the AST tree for stand-alone pattern expressions.
 * @throws ASTWalkException is the walk failed
 */
protected void endPattern() throws ASTWalkException
{
    log.debug(".endPattern");

    if ((astPatternNodeMap.size() > 1) || ((astPatternNodeMap.isEmpty())))
    {
        throw new ASTWalkException("Unexpected AST tree contains zero or more then 1 child elements for root");
    }

    // Get expression node sub-tree from the AST nodes placed so far
    EvalFactoryNode evalNode = astPatternNodeMap.values().iterator().next();

    PatternStreamSpecRaw streamSpec = new PatternStreamSpecRaw(evalNode, evalNodeExpressions, new LinkedList<ViewSpec>(), null, new StreamSpecOptions());
    if (evalNodeExpressions != null) {
        evalNodeExpressions = new HashMap<EvalFactoryNode, String>();
    }
    statementSpec.getStreamSpecs().add(streamSpec);
    statementSpec.setSubstitutionParameters(substitutionParamNodes);

    astPatternNodeMap.clear();
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:26,代码来源:EPLTreeWalker.java

示例6: leaveGuard

import com.espertech.esper.pattern.EvalFactoryNode; //导入依赖的package包/类
private void leaveGuard(Tree node) throws ASTWalkException
{
    log.debug(".leaveGuard");
    String objectNamespace;
    String objectName;
    List<ExprNode> obsParameters;
    if (node.getChild(1).getType() == IDENT && node.getChild(2).getType() == IDENT) {
        objectNamespace = node.getChild(1).getText();
        objectName = node.getChild(2).getText();
        obsParameters = ASTExprHelper.getExprNodes(node, 3, astExprNodeMap);
    }
    else {
        objectNamespace = GuardEnum.WHILE_GUARD.getNamespace();
        objectName = GuardEnum.WHILE_GUARD.getName();
        obsParameters = ASTExprHelper.getExprNodes(node, 1, astExprNodeMap);
    }

    PatternGuardSpec guardSpec = new PatternGuardSpec(objectNamespace, objectName, obsParameters);
    EvalFactoryNode guardNode = patternNodeFactory.makeGuardNode(guardSpec);
    addEvalNodeExpression(guardNode, node);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:22,代码来源:EPLTreeWalker.java

示例7: PatternStreamSpecCompiled

import com.espertech.esper.pattern.EvalFactoryNode; //导入依赖的package包/类
public PatternStreamSpecCompiled(EvalFactoryNode evalFactoryNode, LinkedHashMap<String, Pair<EventType, String>> taggedEventTypes, LinkedHashMap<String, Pair<EventType, String>> arrayEventTypes, LinkedHashSet<String> allTags, ViewSpec[] viewSpecs, String optionalStreamName, StreamSpecOptions streamSpecOptions, boolean suppressSameEventMatches, boolean discardPartialsOnMatch) {
    super(optionalStreamName, viewSpecs, streamSpecOptions);
    this.suppressSameEventMatches = suppressSameEventMatches;
    this.discardPartialsOnMatch = discardPartialsOnMatch;
    this.evalFactoryNode = evalFactoryNode;
    this.allTags = allTags;

    LinkedHashMap<String, Pair<EventType, String>> copy = new LinkedHashMap<String, Pair<EventType, String>>();
    copy.putAll(taggedEventTypes);
    this.taggedEventTypes = copy;

    copy = new LinkedHashMap<String, Pair<EventType, String>>();
    copy.putAll(arrayEventTypes);
    this.arrayEventTypes = copy;
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:16,代码来源:PatternStreamSpecCompiled.java

示例8: patternCollectAddSubnodesAddParentNode

import com.espertech.esper.pattern.EvalFactoryNode; //导入依赖的package包/类
public static void patternCollectAddSubnodesAddParentNode(EvalFactoryNode evalNode, Tree node, Map<Tree, EvalFactoryNode> astPatternNodeMap) {
    if (evalNode == null) {
        throw ASTWalkException.from("Invalid null expression node for '" + ASTUtil.printNode(node) + "'");
    }
    for (int i = 0; i < node.getChildCount(); i++) {
        Tree childNode = node.getChild(i);
        EvalFactoryNode childEvalNode = patternGetRemoveTopNode(childNode, astPatternNodeMap);
        if (childEvalNode != null) {
            evalNode.addChildNode(childEvalNode);
        }
    }
    astPatternNodeMap.put(node, evalNode);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:14,代码来源:ASTExprHelper.java

示例9: patternGetRemoveTopNode

import com.espertech.esper.pattern.EvalFactoryNode; //导入依赖的package包/类
public static EvalFactoryNode patternGetRemoveTopNode(Tree node, Map<Tree, EvalFactoryNode> astPatternNodeMap) {
    EvalFactoryNode pattern = astPatternNodeMap.get(node);
    if (pattern != null) {
        astPatternNodeMap.remove(node);
        return pattern;
    }
    for (int i = 0; i < node.getChildCount(); i++) {
        pattern = patternGetRemoveTopNode(node.getChild(i), astPatternNodeMap);
        if (pattern != null) {
            return pattern;
        }
    }
    return null;
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:15,代码来源:ASTExprHelper.java

示例10: exitObserverExpression

import com.espertech.esper.pattern.EvalFactoryNode; //导入依赖的package包/类
public void exitObserverExpression(EsperEPL2GrammarParser.ObserverExpressionContext ctx) {
    String objectNamespace = ctx.ns.getText();
    String objectName = ctx.a != null ? ctx.a.getText() : ctx.nm.getText();
    List<ExprNode> obsParameters = ASTExprHelper.exprCollectSubNodes(ctx, 2, astExprNodeMap);

    PatternObserverSpec observerSpec = new PatternObserverSpec(objectNamespace, objectName, obsParameters);
    EvalFactoryNode observerNode = this.patternNodeFactory.makeObserverNode(observerSpec);
    ASTExprHelper.patternCollectAddSubnodesAddParentNode(observerNode, ctx, astPatternNodeMap);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:10,代码来源:EPLTreeWalkerListener.java

示例11: exitPatternFilterExpression

import com.espertech.esper.pattern.EvalFactoryNode; //导入依赖的package包/类
public void exitPatternFilterExpression(EsperEPL2GrammarParser.PatternFilterExpressionContext ctx) {
    String optionalPatternTagName = null;
    if (ctx.i != null) {
        optionalPatternTagName = ctx.i.getText();
    }

    String eventName = ASTUtil.unescapeClassIdent(ctx.classIdentifier());

    EsperEPL2GrammarParser.PatternFilterAnnotationContext anno = ctx.patternFilterAnnotation();
    Integer consumption = null;
    if (anno != null) {
        String name = ctx.patternFilterAnnotation().i.getText();
        if (!name.toUpperCase(Locale.ENGLISH).equals("CONSUME")) {
            throw new EPException("Unexpected pattern filter @ annotation, expecting 'consume' but received '" + name + "'");
        }
        if (anno.number() != null) {
            Object val = ASTConstantHelper.parse(anno.number());
            consumption = ((Number) val).intValue();
        } else {
            consumption = 1;
        }
    }

    List<ExprNode> exprNodes = ASTExprHelper.exprCollectSubNodes(ctx, 0, astExprNodeMap);

    FilterSpecRaw rawFilterSpec = new FilterSpecRaw(eventName, exprNodes, propertyEvalSpec);
    propertyEvalSpec = null;
    EvalFactoryNode filterNode = patternNodeFactory.makeFilterNode(rawFilterSpec, optionalPatternTagName, consumption);
    ASTExprHelper.patternCollectAddSubnodesAddParentNode(filterNode, ctx, astPatternNodeMap);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:31,代码来源:EPLTreeWalkerListener.java

示例12: exitStartPatternExpressionRule

import com.espertech.esper.pattern.EvalFactoryNode; //导入依赖的package包/类
public void exitStartPatternExpressionRule(EsperEPL2GrammarParser.StartPatternExpressionRuleContext ctx) {
    if ((astPatternNodeMap.size() > 1) || ((astPatternNodeMap.isEmpty()))) {
        throw ASTWalkException.from("Unexpected AST tree contains zero or more then 1 child elements for root");
    }

    // Get expression node sub-tree from the AST nodes placed so far
    EvalFactoryNode evalNode = astPatternNodeMap.values().iterator().next();

    PatternStreamSpecRaw streamSpec = new PatternStreamSpecRaw(evalNode, ViewSpec.EMPTY_VIEWSPEC_ARRAY, null, StreamSpecOptions.DEFAULT, false, false);
    statementSpec.getStreamSpecs().add(streamSpec);
    statementSpec.setSubstitutionParameters(substitutionParamNodes);

    astPatternNodeMap.clear();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:15,代码来源:EPLTreeWalkerListener.java

示例13: exitAndExpression

import com.espertech.esper.pattern.EvalFactoryNode; //导入依赖的package包/类
public void exitAndExpression(EsperEPL2GrammarParser.AndExpressionContext ctx) {
    if (ctx.getChildCount() < 2) {
        return;
    }
    EvalFactoryNode andNode = patternNodeFactory.makeAndNode();
    ASTExprHelper.patternCollectAddSubnodesAddParentNode(andNode, ctx, astPatternNodeMap);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:8,代码来源:EPLTreeWalkerListener.java

示例14: exitOrExpression

import com.espertech.esper.pattern.EvalFactoryNode; //导入依赖的package包/类
public void exitOrExpression(EsperEPL2GrammarParser.OrExpressionContext ctx) {
    if (ctx.getChildCount() < 2) {
        return;
    }
    EvalFactoryNode orNode = patternNodeFactory.makeOrNode();
    ASTExprHelper.patternCollectAddSubnodesAddParentNode(orNode, ctx, astPatternNodeMap);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:8,代码来源:EPLTreeWalkerListener.java

示例15: exitMatchUntilExpression

import com.espertech.esper.pattern.EvalFactoryNode; //导入依赖的package包/类
public void exitMatchUntilExpression(EsperEPL2GrammarParser.MatchUntilExpressionContext ctx) {
    if (ctx.getChildCount() < 2) {
        return;
    }
    EvalFactoryNode node;
    if (ctx.matchUntilRange() != null) {
        node = makeMatchUntil(ctx.matchUntilRange(), ctx.until != null);
    } else {
        node = this.patternNodeFactory.makeMatchUntilNode(null, null, null);
    }
    ASTExprHelper.patternCollectAddSubnodesAddParentNode(node, ctx, astPatternNodeMap);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:13,代码来源:EPLTreeWalkerListener.java


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