本文整理汇总了Java中com.redhat.lightblue.query.UnaryLogicalOperator类的典型用法代码示例。如果您正苦于以下问题:Java UnaryLogicalOperator类的具体用法?Java UnaryLogicalOperator怎么用?Java UnaryLogicalOperator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnaryLogicalOperator类属于com.redhat.lightblue.query包,在下文中一共展示了UnaryLogicalOperator类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rewrite
import com.redhat.lightblue.query.UnaryLogicalOperator; //导入依赖的package包/类
@Override
public QueryExpression rewrite(QueryExpression q) {
UnaryLogicalExpression le = dyncast(UnaryLogicalExpression.class, q);
if (le != null && le.getOp() == UnaryLogicalOperator._not) {
ValueComparisonExpression vce = dyncast(ValueComparisonExpression.class, le.getQuery());
if (vce != null) {
return new ValueComparisonExpression(vce.getField(), vce.getOp().negate(), vce.getRvalue());
} else {
FieldComparisonExpression fce = dyncast(FieldComparisonExpression.class, le.getQuery());
if (fce != null) {
return new FieldComparisonExpression(fce.getField(), fce.getOp().negate(), fce.getRfield());
} else {
NaryValueRelationalExpression nre = dyncast(NaryValueRelationalExpression.class, le.getQuery());
if (nre != null) {
return new NaryValueRelationalExpression(nre.getField(), nre.getOp().negate(), nre.getValues());
} else {
NaryFieldRelationalExpression nfe = dyncast(NaryFieldRelationalExpression.class, le.getQuery());
if (nfe != null) {
return new NaryFieldRelationalExpression(nfe.getField(), nfe.getOp().negate(), nfe.getRfield());
}
}
}
}
}
return q;
}
示例2: testbuild_UnaryLogicalExpression_NOT
import com.redhat.lightblue.query.UnaryLogicalOperator; //导入依赖的package包/类
@Test
public void testbuild_UnaryLogicalExpression_NOT(){
QueryExpression query = new UnaryLogicalExpression(
UnaryLogicalOperator._not,
new ValueComparisonExpression(new Path("somekey"), BinaryComparisonOperator._eq, new Value("somevalue")));
Filter filter = new FilterBuilder(new TrivialLdapFieldNameTranslator()).build(query);
assertEquals("(!(somekey=somevalue))", filter.toString());
}
示例3: rewrite
import com.redhat.lightblue.query.UnaryLogicalOperator; //导入依赖的package包/类
@Override
public QueryExpression rewrite(QueryExpression q) {
UnaryLogicalExpression le = dyncast(UnaryLogicalExpression.class, q);
if (le != null && le.getOp() == UnaryLogicalOperator._not) {
NaryLogicalExpression oreq = dyncast(NaryLogicalExpression.class, le.getQuery());
if (oreq != null && oreq.getOp() == NaryLogicalOperator._or) {
List<QueryExpression> newList = new ArrayList<>(oreq.getQueries().size());
for (QueryExpression x : oreq.getQueries()) {
newList.add(new UnaryLogicalExpression(UnaryLogicalOperator._not, x));
}
return new NaryLogicalExpression(NaryLogicalOperator._and, newList);
}
}
return q;
}
示例4: rewrite
import com.redhat.lightblue.query.UnaryLogicalOperator; //导入依赖的package包/类
@Override
public QueryExpression rewrite(QueryExpression q) {
UnaryLogicalExpression le = dyncast(UnaryLogicalExpression.class, q);
if (le != null && le.getOp() == UnaryLogicalOperator._not) {
UnaryLogicalExpression oreq = dyncast(UnaryLogicalExpression.class, le.getQuery());
if (oreq != null && oreq.getOp() == UnaryLogicalOperator._not) {
return oreq.getQuery();
}
}
return q;
}
示例5: _not
import com.redhat.lightblue.query.UnaryLogicalOperator; //导入依赖的package包/类
private QueryExpression _not(QueryExpression q) {
return new UnaryLogicalExpression(UnaryLogicalOperator._not, q);
}