當前位置: 首頁>>代碼示例>>Java>>正文


Java UnaryLogicalOperator類代碼示例

本文整理匯總了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;
}
 
開發者ID:lightblue-platform,項目名稱:lightblue-core,代碼行數:27,代碼來源:EliminateNOT.java

示例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());
}
 
開發者ID:lightblue-platform,項目名稱:lightblue-ldap,代碼行數:10,代碼來源:FilterBuilderTest.java

示例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;
}
 
開發者ID:lightblue-platform,項目名稱:lightblue-core,代碼行數:16,代碼來源:EliminateNOTOR.java

示例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;
}
 
開發者ID:lightblue-platform,項目名稱:lightblue-core,代碼行數:12,代碼來源:EliminateNOTNOT.java

示例5: _not

import com.redhat.lightblue.query.UnaryLogicalOperator; //導入依賴的package包/類
private QueryExpression _not(QueryExpression q) {
    return new UnaryLogicalExpression(UnaryLogicalOperator._not, q);
}
 
開發者ID:lightblue-platform,項目名稱:lightblue-core,代碼行數:4,代碼來源:QueryRewriterTest.java


注:本文中的com.redhat.lightblue.query.UnaryLogicalOperator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。