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


Java ExpressionType.get方法代码示例

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


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

示例1: parseOperationExpression

import org.voltdb.types.ExpressionType; //导入方法依赖的package包/类
/**
 *
 * @param exprNode
 * @param attrs
 * @param db
 * @return
 */
AbstractExpression parseOperationExpression(Node exprNode, NamedNodeMap attrs, Database db) {
    String type = attrs.getNamedItem("type").getNodeValue();
    ExpressionType exprType = ExpressionType.get(type);
    AbstractExpression expr = null;

    if (exprType == ExpressionType.INVALID) {
        throw new PlanningErrorException("Unsupported operation type '" + type + "'");
    }
    try {
        expr = exprType.getExpressionClass().newInstance();
    } catch (Exception e) {
        e.printStackTrace();
        System.exit(-1);
    }
    expr.setExpressionType(exprType);

    // Allow expressions to read expression-specific data from exprNode.
    // Looks like the design fully abstracts other volt classes from
    // the XML serialization?  Putting this here instead of in derived
    // Expression implementations.

    if (expr instanceof AggregateExpression) {
        Node node;
        if ((node = attrs.getNamedItem("distinct")) != null) {
            AggregateExpression ae = (AggregateExpression)expr;
            ae.m_distinct = Boolean.parseBoolean(node.getNodeValue());
        }
    }

    // setup for children access
    NodeList children = exprNode.getChildNodes();
    int i = 0;

    // get the first (left) node that is an element
    Node leftExprNode = children.item(i++);
    while ((leftExprNode != null) && (leftExprNode.getNodeType() != Node.ELEMENT_NODE))
        leftExprNode = children.item(i++);
    assert(leftExprNode != null);

    // get the second (right) node that is an element (might be null)
    Node rightExprNode = children.item(i++);
    while ((rightExprNode != null) && (rightExprNode.getNodeType() != Node.ELEMENT_NODE))
        rightExprNode = children.item(i++);

    // recursively parse the left subtree (could be another operator or
    // a constant/tuple/param value operand).
    AbstractExpression leftExpr = parseExpressionTree(leftExprNode, db);
    assert((leftExpr != null) || (exprType == ExpressionType.AGGREGATE_COUNT));
    expr.setLeft(leftExpr);

    if (ExpressionUtil.needsRightExpression(expr)) {
        assert(rightExprNode != null);

        // recursively parse the right subtree
        AbstractExpression rightExpr = parseExpressionTree(rightExprNode, db);
        assert(rightExpr != null);
        expr.setRight(rightExpr);
    }

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


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