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


Java ExpressionType.CONJUNCTION_AND属性代码示例

本文整理汇总了Java中org.voltdb.types.ExpressionType.CONJUNCTION_AND属性的典型用法代码示例。如果您正苦于以下问题:Java ExpressionType.CONJUNCTION_AND属性的具体用法?Java ExpressionType.CONJUNCTION_AND怎么用?Java ExpressionType.CONJUNCTION_AND使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.voltdb.types.ExpressionType的用法示例。


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

示例1: conjunction

/**
 * Handy method for creating a conjunction expression. Multiple expressions
 * can be given and they will all be joined with the same type.
 *
 * @param type
 *            The type of conjunction.
 * @param exps
 *            The expressions to conjunct.
 * @return The expression representing the conjunction.
 */
public static Expression conjunction(ExpressionType type, Expression... exps) {
    Expression prev = null;

    for (Expression exp : exps) {
        if (prev != null) {
            if (type == ExpressionType.CONJUNCTION_AND)
                prev = new ConjunctionAnd(prev, exp);
            else if (type == ExpressionType.CONJUNCTION_OR)
                prev = new ConjunctionOr(prev, exp);
            else
                throw new IllegalArgumentException("Type must be a conjunction type");
        } else {
            prev = exp;
        }
    }

    return prev;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:28,代码来源:Verification.java

示例2: combine

/**
 *
 * @param exps
 */
public static AbstractExpression combine(List<AbstractExpression> exps) {
    Stack<AbstractExpression> stack = new Stack<AbstractExpression>();
    stack.addAll(exps);

    if (stack.isEmpty()) {
        return null;
    } else if (stack.size() == 1) {
        return stack.pop();
    }
    AbstractExpression ret = null;
    while (stack.size() > 1) {
        AbstractExpression child_exp = stack.pop();
        //
        // If our return node is null, then we need to make a new one
        //
        if (ret == null) {
            ret = new ConjunctionExpression(ExpressionType.CONJUNCTION_AND);
            ret.setLeft(child_exp);
        //
        // Check whether we can add it to the right side
        //
        } else if (ret.getRight() == null) {
            ret.setRight(child_exp);
            stack.push(ret);
            ret = null;
        }
    }
    if (ret == null) {
        ret = stack.pop();
    } else {
        ret.setRight(stack.pop());
    }
    return ret;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:38,代码来源:ExpressionUtil.java


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