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


Java OrPredicate类代码示例

本文整理汇总了Java中prefuse.data.expression.OrPredicate的典型用法代码示例。如果您正苦于以下问题:Java OrPredicate类的具体用法?Java OrPredicate怎么用?Java OrPredicate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getOrIterator

import prefuse.data.expression.OrPredicate; //导入依赖的package包/类
protected static IntIterator getOrIterator(Table t, OrPredicate op) {
    int size = op.size();
    if ( size > 1 ) {
        // if all subclauses can be optimized, we can optimize the query
        IntIterator[] rows = new IntIterator[size];
        for ( int i=0; i<rows.length; ++i ) {
            rows[i] = getOptimizedIterator(t, op.get(i));
            
            // all clauses must be optimized to avoid linear scan
            if ( rows[i] == null ) return null;
        }
        // group iterators, and filter for uniqueness
        return new UniqueRowIterator(new CompositeIntIterator(rows));
    } else if ( size == 1 ) {
        // only one clause, optimize for that
        return getOptimizedIterator(t, op.get(0));
    } else {
        // no woman, no cry
        return null;
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:22,代码来源:FilterIteratorFactory.java

示例2: valueChanged

import prefuse.data.expression.OrPredicate; //导入依赖的package包/类
public void valueChanged(ListSelectionEvent e) {
    ListModel model = (ListModel)e.getSource();
    OrPredicate orP = (OrPredicate)m_query;
    
    if ( model.isSelectionEmpty() )
    {
        orP.clear();
    }
    else if ( m_includeAll && model.isSelectedIndex(0) )
    {
        orP.set(BooleanLiteral.TRUE);
    }
    else
    {
        int min   = model.getMinSelectionIndex();
        int max   = model.getMaxSelectionIndex();
        int count = 0;
        for ( int i=min; i<=max; ++i ) {
            if ( model.isSelectedIndex(i) )
                ++count;
        }
    
        if ( count == model.getSize() ) {
            orP.set(BooleanLiteral.TRUE);
        } else if ( count == 1 ) {
            orP.set(getComparison(model.getElementAt(min)));
        } else {
            Predicate[] p = new Predicate[count];
            for ( int i=min, j=0; i<=max; ++i ) {
                if ( model.isSelectedIndex(i) )
                    p[j++] = getComparison(model.getElementAt(i));
            }
            orP.set(p);
        }
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:37,代码来源:ListQueryBinding.java

示例3: initPredicate

import prefuse.data.expression.OrPredicate; //导入依赖的package包/类
private void initPredicate() {
    // set up predicate
    OrPredicate orP = new OrPredicate();
    orP.add(BooleanLiteral.TRUE);
    setPredicate(orP);
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:7,代码来源:ListQueryBinding.java

示例4: getOptimizedIterator

import prefuse.data.expression.OrPredicate; //导入依赖的package包/类
/**
 * Get an optimized iterator over the rows of a table, if possible.
 * @param t the Table to iterator over
 * @param p the filter predicate
 * @return an optimized iterator, or null if no optimization was found
 */
protected static IntIterator getOptimizedIterator(Table t, Predicate p) {
    if ( t.getRowCount() < OPTIMIZATION_THRESHOLD ) 
        return null; // avoid overhead for small tables
    
    if ( p instanceof ColumnExpression ) {
        // try to optimize a boolean column
        return getColumnIterator(t,
                ((ColumnExpression)p).getColumnName(), true);
    }
    else if ( p instanceof NotPredicate )
    {
        // try to optimize the negation a boolean column
        Predicate pp = ((NotPredicate)p).getPredicate();
        if ( pp instanceof ColumnExpression ) {
            return getColumnIterator(t,
                    ((ColumnExpression)pp).getColumnName(), false);
        }
    }
    else if ( p instanceof AndPredicate )
    {
        // try to optimize an and clause
        return getAndIterator(t, (AndPredicate)p);
    }
    else if ( p instanceof OrPredicate )
    {
        // try to optimize an or clause
        return getOrIterator(t, (OrPredicate)p);
    }
    else if ( p instanceof ComparisonPredicate )
    {
        // try to optimize a comparison (=, !=, <, > ,etc)
        return getComparisonIterator(t,(ComparisonPredicate)p);
    }
    else if ( p instanceof RangePredicate )
    {
        // try to optimize a bounded range of values
        return getRangeIterator(t, (RangePredicate)p); 
    }
    
    return null;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:48,代码来源:FilterIteratorFactory.java

示例5: setPredicate

import prefuse.data.expression.OrPredicate; //导入依赖的package包/类
/**
 * Set the test predicate used to determine visibility.
 * @param p the test predicate to set
 */
protected void setPredicate(Predicate p) {
    m_predicate = p;
    m_filter = new OrPredicate(p, VisiblePredicate.TRUE);
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:9,代码来源:VisibilityFilter.java


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