TestUtils.java 文件源码

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

项目:graphflow 作者:
/**
 * Creates a {@link ComparisonPredicate} using the given parameters.
 *
 * @param variable1 A {@code Pair<String, Short>} which will be the left operand in the
 * {@link ComparisonPredicate} to be created.
 * @param variable2 A {@code Pair<String, Short>} which will be the right operand in the
 * {@link ComparisonPredicate} to be created. Mutually exclusive with {@code literal}.
 * @param literal A {@code String} which will be the right operand in the
 * {@link ComparisonPredicate} to be created. Mutually exclusive with {@code variable1}.
 * @param comparisonOperator A {@link ComparisonOperator} specifying the comparison operator
 * of the {@link ComparisonPredicate} to be created.
 *
 * @return A {@link ComparisonPredicate} created using the given parameters.
 */
public static ComparisonPredicate createComparisonPredicate(
    Pair<String, String> variable1, Pair<String, String> variable2, String literal,
    ComparisonOperator comparisonOperator) {
    ComparisonPredicate comparisonPredicate = new ComparisonPredicate();
    comparisonPredicate.setLeftOperand(variable1);
    comparisonPredicate.setRightOperand(variable2);
    comparisonPredicate.setLiteral(literal);
    comparisonPredicate.setComparisonOperator(comparisonOperator);
    if (null == comparisonPredicate.getLiteral()) {
        comparisonPredicate.setPredicateType(PredicateType.
            COMPARATIVE_CLAUSE_TWO_PROPERTY_KEY_OPERANDS);
    } else {
        comparisonPredicate.setPredicateType(PredicateType.
            COMPARATIVE_CLAUSE_PROPERTY_KEY_AND_LITERAL_OPERANDS);
    }
    return comparisonPredicate;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号