本文整理汇总了Java中com.thinkaurelius.titan.core.attribute.Cmp.LESS_THAN_EQUAL属性的典型用法代码示例。如果您正苦于以下问题:Java Cmp.LESS_THAN_EQUAL属性的具体用法?Java Cmp.LESS_THAN_EQUAL怎么用?Java Cmp.LESS_THAN_EQUAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.thinkaurelius.titan.core.attribute.Cmp
的用法示例。
在下文中一共展示了Cmp.LESS_THAN_EQUAL属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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;
}
}