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


Java Cmp.EQUAL属性代码示例

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


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

示例1: convertInternal

/**
 * Convert Tinkerpop's comparison operators to Titan's
 *
 * @param p Any predicate
 * @return A TitanPredicate equivalent to the given predicate
 * @throws IllegalArgumentException if the given Predicate is unknown
 */
public static final TitanPredicate convertInternal(BiPredicate p) {
    if (p instanceof TitanPredicate) {
        return (TitanPredicate)p;
    } else if (p instanceof Compare) {
        Compare comp = (Compare)p;
        switch(comp) {
            case eq: return Cmp.EQUAL;
            case neq: return Cmp.NOT_EQUAL;
            case gt: return Cmp.GREATER_THAN;
            case gte: return Cmp.GREATER_THAN_EQUAL;
            case lt: return Cmp.LESS_THAN;
            case lte: return Cmp.LESS_THAN_EQUAL;
            default: throw new IllegalArgumentException("Unexpected comparator: " + comp);
        }
    } else if (p instanceof Contains) {
        Contains con = (Contains)p;
        switch (con) {
            case within: return Contain.IN;
            case without: return Contain.NOT_IN;
            default: throw new IllegalArgumentException("Unexpected container: " + con);

        }
    } else return null;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:31,代码来源:TitanPredicate.java

示例2: getEqualityConditionValues

private static final Map.Entry<Condition,Collection<Object>> getEqualityConditionValues(Condition<TitanElement> condition, RelationType type) {
    for (Condition c : condition.getChildren()) {
        if (c instanceof Or) {
            Map.Entry<RelationType,Collection> orEqual = QueryUtil.extractOrCondition((Or)c);
            if (orEqual!=null && orEqual.getKey().equals(type) && !orEqual.getValue().isEmpty()) {
                return new AbstractMap.SimpleImmutableEntry(c,orEqual.getValue());
            }
        } else if (c instanceof PredicateCondition) {
            PredicateCondition<RelationType, TitanRelation> atom = (PredicateCondition)c;
            if (atom.getKey().equals(type) && atom.getPredicate()==Cmp.EQUAL && atom.getValue()!=null) {
                return new AbstractMap.SimpleImmutableEntry(c,ImmutableList.of(atom.getValue()));
            }
        }

    }
    return null;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:17,代码来源:GraphCentricQueryBuilder.java

示例3: getEqualityConditionValues

private static final Map.Entry<Condition, Collection<Object>> getEqualityConditionValues(Condition<TitanElement> condition, RelationType type) {
    for (Condition c : condition.getChildren()) {
        if (c instanceof Or) {
            Map.Entry<RelationType, Collection> orEqual = QueryUtil.extractOrCondition((Or)c);
            if (orEqual!=null && orEqual.getKey().equals(type) && !orEqual.getValue().isEmpty()) {
                return new AbstractMap.SimpleImmutableEntry(c, orEqual.getValue());
            }
        } else if (c instanceof PredicateCondition) {
            PredicateCondition<RelationType, TitanRelation> atom = (PredicateCondition)c;
            if (atom.getKey().equals(type) && atom.getPredicate()==Cmp.EQUAL && atom.getValue()!=null) {
                return new AbstractMap.SimpleImmutableEntry(c, ImmutableList.of(atom.getValue()));
            }
        }

    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:17,代码来源:GraphCentricQueryBuilder.java

示例4: asTitanCmp

public static final Cmp asTitanCmp(QueryPredicate.Compare predicate) {

      switch(predicate) {
        case EQUAL:              return Cmp.EQUAL;
        case NOT_EQUAL:          return Cmp.NOT_EQUAL;
        case GREATER_THAN:       return Cmp.GREATER_THAN;
        case GREATER_THAN_EQUAL: return Cmp.GREATER_THAN_EQUAL;
        case LESS_THAN:          return Cmp.LESS_THAN;
        case LESS_THAN_EQUAL:    return Cmp.LESS_THAN_EQUAL;
        // NOTE: this shouldn't happen, because we pattern match on all cases of a sealed enum
        default:                 return Cmp.EQUAL;
      }
    }
 
开发者ID:bio4j,项目名称:angulillos-titan,代码行数:13,代码来源:TitanConversions.java

示例5: supports

@Override
public boolean supports(KeyInformation information, TitanPredicate titanPredicate) {
    return titanPredicate == Cmp.EQUAL || titanPredicate == Contain.IN;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:4,代码来源:StandardIndexInformation.java


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