AbstractPQLQuery.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:PQL 作者:
protected boolean interpretSetComparison(ParseTree tree) {      
    Set<PQLTask> A = interpretSetOfTasks(tree.getChild(0));
    Set<PQLTask> B = interpretSetOfTasks(tree.getChild(2));

    ParseTree child = tree.getChild(1).getChild(0);
    int ruleIndex = ((RuleNode)child).getRuleContext().getRuleIndex();

    switch (ruleIndex) {
        case PQLParser.RULE_identical:
            return A.equals(B) ? true : false;
        case PQLParser.RULE_different:
            return A.equals(B) ? false : true;
        case PQLParser.RULE_overlapsWith:
            for (PQLTask task : A) 
                if (B.contains(task)) return true;

            return false;
        case PQLParser.RULE_subsetOf:
            return B.containsAll(A) ? true : false;
        case PQLParser.RULE_properSubsetOf:
            return B.containsAll(A) && !A.equals(B) ? true : false;
    }

    return false;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号