• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ExprEvalUtils类的典型用法和代码示例

java 5次浏览

本文整理汇总了Java中com.alibaba.cobar.parser.util.ExprEvalUtils的典型用法代码示例。如果您正苦于以下问题:Java ExprEvalUtils类的具体用法?Java ExprEvalUtils怎么用?Java ExprEvalUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

ExprEvalUtils类属于com.alibaba.cobar.parser.util包,在下文中一共展示了ExprEvalUtils类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: evaluationInternal

点赞 3

import com.alibaba.cobar.parser.util.ExprEvalUtils; //导入依赖的package包/类
@Override
public Object evaluationInternal(Map<? extends Object, ? extends Object> parameters) {
    Object left = leftOprand.evaluation(parameters);
    Object right = rightOprand.evaluation(parameters);
    if (left == UNEVALUATABLE || right == UNEVALUATABLE)
        return UNEVALUATABLE;
    if (left == null)
        return right == null ? LiteralBoolean.TRUE : LiteralBoolean.FALSE;
    if (right == null)
        return LiteralBoolean.FALSE;
    if (left instanceof Number || right instanceof Number) {
        Pair<Number, Number> pair = ExprEvalUtils.convertNum2SameLevel(left, right);
        left = pair.getKey();
        right = pair.getValue();
    }
    return left.equals(right) ? LiteralBoolean.TRUE : LiteralBoolean.FALSE;
}
 

开发者ID:alibaba,
项目名称:cobar,
代码行数:18,
代码来源:ComparisionNullSafeEqualsExpression.java

示例2: evaluationInternal

点赞 2

import com.alibaba.cobar.parser.util.ExprEvalUtils; //导入依赖的package包/类
@Override
public Object evaluationInternal(Map<? extends Object, ? extends Object> parameters) {
    Object operand = getOperand().evaluation(parameters);
    if (operand == null) return null;
    if (operand == UNEVALUATABLE) return UNEVALUATABLE;
    Number num = null;
    if (operand instanceof String) {
        num = ExprEvalUtils.string2Number((String) operand);
    } else {
        num = (Number) operand;
    }
    return ExprEvalUtils.calculate(this, num);
}
 

开发者ID:loye168,
项目名称:tddl5,
代码行数:14,
代码来源:MinusExpression.java

示例3: evaluationInternal

点赞 2

import com.alibaba.cobar.parser.util.ExprEvalUtils; //导入依赖的package包/类
@Override
public Object evaluationInternal(Map<? extends Object, ? extends Object> parameters) {
    Object left = leftOprand.evaluation(parameters);
    Object right = rightOprand.evaluation(parameters);
    if (left == null || right == null) return null;
    if (left == UNEVALUATABLE || right == UNEVALUATABLE) return UNEVALUATABLE;
    Pair<Number, Number> pair = ExprEvalUtils.convertNum2SameLevel(left, right);
    return ExprEvalUtils.calculate(this, pair.getKey(), pair.getValue());
}
 

开发者ID:loye168,
项目名称:tddl5,
代码行数:10,
代码来源:ArithmeticBinaryOperatorExpression.java

示例4: evaluationInternal

点赞 2

import com.alibaba.cobar.parser.util.ExprEvalUtils; //导入依赖的package包/类
@Override
public Object evaluationInternal(Map<? extends Object, ? extends Object> parameters) {
    Object left = leftOprand.evaluation(parameters);
    Object right = rightOprand.evaluation(parameters);
    if (left == UNEVALUATABLE || right == UNEVALUATABLE) return UNEVALUATABLE;
    if (left == null) return right == null ? LiteralBoolean.TRUE : LiteralBoolean.FALSE;
    if (right == null) return LiteralBoolean.FALSE;
    if (left instanceof Number || right instanceof Number) {
        Pair<Number, Number> pair = ExprEvalUtils.convertNum2SameLevel(left, right);
        left = pair.getKey();
        right = pair.getValue();
    }
    return left.equals(right) ? LiteralBoolean.TRUE : LiteralBoolean.FALSE;
}
 

开发者ID:loye168,
项目名称:tddl5,
代码行数:15,
代码来源:ComparisionNullSafeEqualsExpression.java

示例5: evaluationInternal

点赞 2

import com.alibaba.cobar.parser.util.ExprEvalUtils; //导入依赖的package包/类
@Override
public Object evaluationInternal(Map<? extends Object, ? extends Object> parameters) {
    Object left = leftOprand.evaluation(parameters);
    Object right = rightOprand.evaluation(parameters);
    if (left == null || right == null) return null;
    if (left == UNEVALUATABLE || right == UNEVALUATABLE) return UNEVALUATABLE;
    if (left instanceof Number || right instanceof Number) {
        Pair<Number, Number> pair = ExprEvalUtils.convertNum2SameLevel(left, right);
        left = pair.getKey();
        right = pair.getValue();
    }
    return left.equals(right) ? LiteralBoolean.TRUE : LiteralBoolean.FALSE;
}
 

开发者ID:loye168,
项目名称:tddl5,
代码行数:14,
代码来源:ComparisionEqualsExpression.java

示例6: evaluationInternal

点赞 2

import com.alibaba.cobar.parser.util.ExprEvalUtils; //导入依赖的package包/类
@Override
public Object evaluationInternal(Map<? extends Object, ? extends Object> parameters) {
    for (Expression operand : operands) {
        Object val = operand.evaluation(parameters);
        if (val == null) return null;
        if (val == UNEVALUATABLE) return UNEVALUATABLE;
        if (ExprEvalUtils.obj2bool(val)) {
            return LiteralBoolean.TRUE;
        }
    }
    return LiteralBoolean.FALSE;
}
 

开发者ID:loye168,
项目名称:tddl5,
代码行数:13,
代码来源:LogicalOrExpression.java

示例7: evaluationInternal

点赞 2

import com.alibaba.cobar.parser.util.ExprEvalUtils; //导入依赖的package包/类
@Override
public Object evaluationInternal(Map<? extends Object, ? extends Object> parameters) {
    Object operand = getOperand().evaluation(parameters);
    if (operand == null) return null;
    if (operand == UNEVALUATABLE) return UNEVALUATABLE;
    boolean bool = ExprEvalUtils.obj2bool(operand);
    return bool ? LiteralBoolean.FALSE : LiteralBoolean.TRUE;
}
 

开发者ID:loye168,
项目名称:tddl5,
代码行数:9,
代码来源:NegativeValueExpression.java

示例8: evaluationInternal

点赞 2

import com.alibaba.cobar.parser.util.ExprEvalUtils; //导入依赖的package包/类
@Override
public Object evaluationInternal(Map<? extends Object, ? extends Object> parameters) {
    for (Expression operand : operands) {
        Object val = operand.evaluation(parameters);
        if (val == null) return null;
        if (val == UNEVALUATABLE) return UNEVALUATABLE;
        if (!ExprEvalUtils.obj2bool(val)) {
            return LiteralBoolean.FALSE;
        }
    }
    return LiteralBoolean.TRUE;
}
 

开发者ID:loye168,
项目名称:tddl5,
代码行数:13,
代码来源:LogicalAndExpression.java

示例9: evaluationInternal

点赞 2

import com.alibaba.cobar.parser.util.ExprEvalUtils; //导入依赖的package包/类
@Override
public Object evaluationInternal(Map<? extends Object, ? extends Object> parameters) {
    Object left = leftOprand.evaluation(parameters);
    Object right = rightOprand.evaluation(parameters);
    if (left == null || right == null) return null;
    if (left == UNEVALUATABLE || right == UNEVALUATABLE) return UNEVALUATABLE;
    boolean b1 = ExprEvalUtils.obj2bool(left);
    boolean b2 = ExprEvalUtils.obj2bool(right);
    return b1 != b2 ? LiteralBoolean.TRUE : LiteralBoolean.FALSE;
}
 

开发者ID:loye168,
项目名称:tddl5,
代码行数:11,
代码来源:LogicalXORExpression.java

示例10: evaluationInternal

点赞 2

import com.alibaba.cobar.parser.util.ExprEvalUtils; //导入依赖的package包/类
@Override
public Object evaluationInternal(Map<? extends Object, ? extends Object> parameters) {
    Object operand = getOperand().evaluation(parameters);
    if (operand == null)
        return null;
    if (operand == UNEVALUATABLE)
        return UNEVALUATABLE;
    Number num = null;
    if (operand instanceof String) {
        num = ExprEvalUtils.string2Number((String) operand);
    } else {
        num = (Number) operand;
    }
    return ExprEvalUtils.calculate(this, num);
}
 

开发者ID:alibaba,
项目名称:cobar,
代码行数:16,
代码来源:MinusExpression.java

示例11: evaluationInternal

点赞 2

import com.alibaba.cobar.parser.util.ExprEvalUtils; //导入依赖的package包/类
@Override
public Object evaluationInternal(Map<? extends Object, ? extends Object> parameters) {
    Object left = leftOprand.evaluation(parameters);
    Object right = rightOprand.evaluation(parameters);
    if (left == null || right == null)
        return null;
    if (left == UNEVALUATABLE || right == UNEVALUATABLE)
        return UNEVALUATABLE;
    Pair<Number, Number> pair = ExprEvalUtils.convertNum2SameLevel(left, right);
    return ExprEvalUtils.calculate(this, pair.getKey(), pair.getValue());
}
 

开发者ID:alibaba,
项目名称:cobar,
代码行数:12,
代码来源:ArithmeticBinaryOperatorExpression.java

示例12: evaluationInternal

点赞 2

import com.alibaba.cobar.parser.util.ExprEvalUtils; //导入依赖的package包/类
@Override
public Object evaluationInternal(Map<? extends Object, ? extends Object> parameters) {
    Object left = leftOprand.evaluation(parameters);
    Object right = rightOprand.evaluation(parameters);
    if (left == null || right == null)
        return null;
    if (left == UNEVALUATABLE || right == UNEVALUATABLE)
        return UNEVALUATABLE;
    if (left instanceof Number || right instanceof Number) {
        Pair<Number, Number> pair = ExprEvalUtils.convertNum2SameLevel(left, right);
        left = pair.getKey();
        right = pair.getValue();
    }
    return left.equals(right) ? LiteralBoolean.TRUE : LiteralBoolean.FALSE;
}
 

开发者ID:alibaba,
项目名称:cobar,
代码行数:16,
代码来源:ComparisionEqualsExpression.java

示例13: evaluationInternal

点赞 2

import com.alibaba.cobar.parser.util.ExprEvalUtils; //导入依赖的package包/类
@Override
public Object evaluationInternal(Map<? extends Object, ? extends Object> parameters) {
    for (Expression operand : operands) {
        Object val = operand.evaluation(parameters);
        if (val == null)
            return null;
        if (val == UNEVALUATABLE)
            return UNEVALUATABLE;
        if (ExprEvalUtils.obj2bool(val)) {
            return LiteralBoolean.TRUE;
        }
    }
    return LiteralBoolean.FALSE;
}
 

开发者ID:alibaba,
项目名称:cobar,
代码行数:15,
代码来源:LogicalOrExpression.java

示例14: evaluationInternal

点赞 2

import com.alibaba.cobar.parser.util.ExprEvalUtils; //导入依赖的package包/类
@Override
public Object evaluationInternal(Map<? extends Object, ? extends Object> parameters) {
    Object operand = getOperand().evaluation(parameters);
    if (operand == null)
        return null;
    if (operand == UNEVALUATABLE)
        return UNEVALUATABLE;
    boolean bool = ExprEvalUtils.obj2bool(operand);
    return bool ? LiteralBoolean.FALSE : LiteralBoolean.TRUE;
}
 

开发者ID:alibaba,
项目名称:cobar,
代码行数:11,
代码来源:NegativeValueExpression.java

示例15: evaluationInternal

点赞 2

import com.alibaba.cobar.parser.util.ExprEvalUtils; //导入依赖的package包/类
@Override
public Object evaluationInternal(Map<? extends Object, ? extends Object> parameters) {
    for (Expression operand : operands) {
        Object val = operand.evaluation(parameters);
        if (val == null)
            return null;
        if (val == UNEVALUATABLE)
            return UNEVALUATABLE;
        if (!ExprEvalUtils.obj2bool(val)) {
            return LiteralBoolean.FALSE;
        }
    }
    return LiteralBoolean.TRUE;
}
 

开发者ID:alibaba,
项目名称:cobar,
代码行数:15,
代码来源:LogicalAndExpression.java

示例16: evaluationInternal

点赞 2

import com.alibaba.cobar.parser.util.ExprEvalUtils; //导入依赖的package包/类
@Override
public Object evaluationInternal(Map<? extends Object, ? extends Object> parameters) {
    Object left = leftOprand.evaluation(parameters);
    Object right = rightOprand.evaluation(parameters);
    if (left == null || right == null)
        return null;
    if (left == UNEVALUATABLE || right == UNEVALUATABLE)
        return UNEVALUATABLE;
    boolean b1 = ExprEvalUtils.obj2bool(left);
    boolean b2 = ExprEvalUtils.obj2bool(right);
    return b1 != b2 ? LiteralBoolean.TRUE : LiteralBoolean.FALSE;
}
 

开发者ID:alibaba,
项目名称:cobar,
代码行数:13,
代码来源:LogicalXORExpression.java

示例17: compareEvaluatedValue

点赞 2

import com.alibaba.cobar.parser.util.ExprEvalUtils; //导入依赖的package包/类
/**
 * @param obj1 not null
 * @param obj2 not null
 */
private static boolean compareEvaluatedValue(Object obj1, Object obj2) {
    if (obj1.equals(obj2))
        return true;
    try {
        Pair<Number, Number> pair = ExprEvalUtils.convertNum2SameLevel(obj1, obj2);
        return pair.getKey().equals(pair.getValue());
    } catch (Exception e) {
        return false;
    }
}
 

开发者ID:alibaba,
项目名称:cobar,
代码行数:15,
代码来源:PartitionKeyVisitor.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)