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


Java ExpressionType.INVALID属性代码示例

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


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

示例1: validate

public void validate() throws Exception {
    //
    // Validate our children first
    //
    if (m_left != null) {
        m_left.validate();
    }
    if (m_right != null) {
        m_right.validate();
    }
    //
    // Expression Type
    //
    if (m_type == null) {
        throw new Exception("ERROR: The ExpressionType for '" + this + "' is NULL");
    } else if (m_type == ExpressionType.INVALID) {
        throw new Exception("ERROR: The ExpressionType for '" + this + "' is " + m_type);
    //
    // Output Type
    //
    } else if (m_valueType == null) {
        throw new Exception("ERROR: The output VoltType for '" + this + "' is NULL");
    } else if (m_valueType == VoltType.INVALID) {
        throw new Exception("ERROR: The output VoltType for '" + this + "' is " + m_valueType);
    }
    //
    // Since it is possible for an AbstractExpression to be stored with
    // any ExpressionType, we do a simple check to make sure that it is the right class
    //
    Class<?> check_class = m_type.getExpressionClass();
    if (!check_class.isInstance(this)) {
        throw new Exception("ERROR: Expression '" + this + "' is class type '" + getClass().getSimpleName() + "' but needs to be '" + check_class.getSimpleName() + "'");
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:34,代码来源:AbstractExpression.java

示例2: parseOperationExpression

/**
 *
 * @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,代码行数:68,代码来源:AbstractParsedStmt.java


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