當前位置: 首頁>>代碼示例>>Java>>正文


Java EligibilityDesc.getEligibility方法代碼示例

本文整理匯總了Java中com.espertech.esper.epl.join.util.EligibilityDesc.getEligibility方法的典型用法代碼示例。如果您正苦於以下問題:Java EligibilityDesc.getEligibility方法的具體用法?Java EligibilityDesc.getEligibility怎麽用?Java EligibilityDesc.getEligibility使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.espertech.esper.epl.join.util.EligibilityDesc的用法示例。


在下文中一共展示了EligibilityDesc.getEligibility方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: analyzeInNodeMultiIndex

import com.espertech.esper.epl.join.util.EligibilityDesc; //導入方法依賴的package包/類
private static void analyzeInNodeMultiIndex(ExprInNode inNode, QueryGraph queryGraph) {

        ExprNode[] setExpressions = getInNodeSetExpressions(inNode);
        if (setExpressions.length == 0) {
            return;
        }

        Map<Integer, List<ExprNode>> perStreamExprs = new LinkedHashMap<Integer, List<ExprNode>>();
        for (ExprNode exprNodeSet : setExpressions) {
            if (!(exprNodeSet instanceof ExprIdentNode)) {
                continue;
            }
            ExprIdentNode setIdent = (ExprIdentNode) exprNodeSet;
            addToList(setIdent.getStreamId(), setIdent, perStreamExprs);
        }
        if (perStreamExprs.isEmpty()) {
            return;
        }

        ExprNode testExpr = inNode.getChildNodes()[0];
        Class testExprType = JavaClassHelper.getBoxedType(testExpr.getForge().getEvaluationType());
        if (perStreamExprs.size() > 1) {
            return;
        }
        Map.Entry<Integer, List<ExprNode>> entry = perStreamExprs.entrySet().iterator().next();
        ExprNode[] exprNodes = ExprNodeUtilityCore.toArray(entry.getValue());
        for (ExprNode node : exprNodes) {
            Class exprType = node.getForge().getEvaluationType();
            if (JavaClassHelper.getBoxedType(exprType) != testExprType) {
                return;
            }
        }

        Integer testStreamNum;
        int setStream = entry.getKey();
        if (!(testExpr instanceof ExprIdentNode)) {
            EligibilityDesc eligibility = EligibilityUtil.verifyInputStream(testExpr, setStream);
            if (!eligibility.getEligibility().isEligible()) {
                return;
            }
            if (eligibility.getEligibility() == Eligibility.REQUIRE_ONE && setStream == eligibility.getStreamNum()) {
                return;
            }
            testStreamNum = eligibility.getStreamNum();
        } else {
            testStreamNum = ((ExprIdentNode) testExpr).getStreamId();
        }

        if (testStreamNum == null) {
            queryGraph.addInSetMultiIndexUnkeyed(testExpr, setStream, exprNodes);
        } else {
            if (testStreamNum.equals(entry.getKey())) {
                return;
            }
            queryGraph.addInSetMultiIndex(testStreamNum, testExpr, setStream, exprNodes);
        }
    }
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:58,代碼來源:FilterExprAnalyzer.java

示例2: analyzeEqualsNode

import com.espertech.esper.epl.join.util.EligibilityDesc; //導入方法依賴的package包/類
/**
 * Analye EQUALS (=) node.
 *
 * @param equalsNode  - node to analyze
 * @param queryGraph  - store relationships between stream properties
 * @param isOuterJoin indicator for outer join
 */
protected static void analyzeEqualsNode(ExprEqualsNode equalsNode, QueryGraph queryGraph, boolean isOuterJoin) {
    if ((equalsNode.getChildNodes()[0] instanceof ExprIdentNode) &&
            (equalsNode.getChildNodes()[1] instanceof ExprIdentNode)) {
        ExprIdentNode identNodeLeft = (ExprIdentNode) equalsNode.getChildNodes()[0];
        ExprIdentNode identNodeRight = (ExprIdentNode) equalsNode.getChildNodes()[1];

        if (identNodeLeft.getStreamId() != identNodeRight.getStreamId()) {
            queryGraph.addStrictEquals(identNodeLeft.getStreamId(), identNodeLeft.getResolvedPropertyName(), identNodeLeft,
                    identNodeRight.getStreamId(), identNodeRight.getResolvedPropertyName(), identNodeRight);
        }

        return;
    }
    if (isOuterJoin) {      // outerjoins don't use constants or one-way expression-derived information to evaluate join
        return;
    }

    // handle constant-compare or transformation case
    int indexedStream = -1;
    ExprIdentNode indexedPropExpr = null;
    ExprNode exprNodeNoIdent = null;

    if (equalsNode.getChildNodes()[0] instanceof ExprIdentNode) {
        indexedPropExpr = (ExprIdentNode) equalsNode.getChildNodes()[0];
        indexedStream = indexedPropExpr.getStreamId();
        exprNodeNoIdent = equalsNode.getChildNodes()[1];
    } else if (equalsNode.getChildNodes()[1] instanceof ExprIdentNode) {
        indexedPropExpr = (ExprIdentNode) equalsNode.getChildNodes()[1];
        indexedStream = indexedPropExpr.getStreamId();
        exprNodeNoIdent = equalsNode.getChildNodes()[0];
    }
    if (indexedStream == -1) {
        return;     // require property of right/left side of equals
    }

    EligibilityDesc eligibility = EligibilityUtil.verifyInputStream(exprNodeNoIdent, indexedStream);
    if (!eligibility.getEligibility().isEligible()) {
        return;
    }

    if (eligibility.getEligibility() == Eligibility.REQUIRE_NONE) {
        queryGraph.addUnkeyedExpression(indexedStream, indexedPropExpr, exprNodeNoIdent);
    } else {
        queryGraph.addKeyedExpression(indexedStream, indexedPropExpr, eligibility.getStreamNum(), exprNodeNoIdent);
    }
}
 
開發者ID:espertechinc,項目名稱:esper,代碼行數:54,代碼來源:FilterExprAnalyzer.java


注:本文中的com.espertech.esper.epl.join.util.EligibilityDesc.getEligibility方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。