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


Java FilterExpr类代码示例

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


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

示例1: evalToRoot

import org.jaxen.expr.FilterExpr; //导入依赖的package包/类
private static boolean evalToRoot(final Expr expr, final boolean root) {

        if (expr instanceof LocationPath) {
            final LocationPath l = (LocationPath) expr;
            return (root || l.isAbsolute()) && l.getSteps().size() == 1
                    && l.getSteps().get(0) instanceof AllNodeStep;

        } else if (expr instanceof FilterExpr) {
            return evalToRoot(((FilterExpr) expr).getExpr(), root);

        } else if (expr instanceof PathExpr) {
            final PathExpr p = (PathExpr) expr;
            final boolean atRoot = evalToRoot(p.getFilterExpr(), root);
            return evalToRoot(p.getLocationPath(), atRoot);

        } else {
            return false;
        }
    }
 
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:20,代码来源:XPath.java

示例2: addFilter

import org.jaxen.expr.FilterExpr; //导入依赖的package包/类
/** Adds a filter to this pattern
 */
public void addFilter(FilterExpr filter) 
{
    if ( filters == null )
    {
        filters = new ArrayList();
    }
    filters.add( filter );
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:11,代码来源:LocationPathPattern.java

示例3: convertDefaultStep

import org.jaxen.expr.FilterExpr; //导入依赖的package包/类
protected static LocationPathPattern convertDefaultStep(LocationPathPattern path, DefaultStep step) throws JaxenException
{
    List predicates = step.getPredicates();
    if ( ! predicates.isEmpty() ) 
    {
        FilterExpr filter = new DefaultFilterExpr(new PredicateSet());
        for ( Iterator iter = predicates.iterator(); iter.hasNext(); )
        {
            filter.addPredicate( (Predicate) iter.next() );
        }
        path.addFilter( filter );
    }         
    return path;
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:15,代码来源:PatternParser.java

示例4: matches

import org.jaxen.expr.FilterExpr; //导入依赖的package包/类
/** @return true if the pattern matches the given node
      */
    public boolean matches( Object node, Context context ) throws JaxenException
    {
        Navigator navigator = context.getNavigator();

/*        
        if ( isAbsolute() )
        {
            node = navigator.getDocumentNode( node );
        }
*/
        if (! nodeTest.matches(node, context) )
        {
            return false;
        }
        
        if (parentPattern != null) 
        {
            Object parent = navigator.getParentNode( node );
            if ( parent == null ) 
            {
                return false;
            }
            if ( ! parentPattern.matches( parent, context ) ) 
            {
                return false;
            }
        }

        if (ancestorPattern != null) {
            Object ancestor = navigator.getParentNode( node );
            while (true)
            {
                if ( ancestorPattern.matches( ancestor, context ) )
                {
                    break;
                }
                if ( ancestor == null )
                {
                    return false;
                }
                if ( navigator.isDocument( ancestor ) )
                {
                    return false;
                }
                ancestor = navigator.getParentNode( ancestor );
            }
        }
        
        if (filters != null) 
        {
            List list = new SingletonList(node);

            context.setNodeSet( list );
            
            // XXXX: filters aren't positional, so should we clone context?

            boolean answer = true;

            for (Iterator iter = filters.iterator(); iter.hasNext(); ) 
            {
                FilterExpr filter = (FilterExpr) iter.next();

                if ( ! filter.asBoolean( context ) )
                {
                    answer = false;
                    break;
                }
            }
            // restore context

            context.setNodeSet( list );

            return answer;
        }
        return true;
    }
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:79,代码来源:LocationPathPattern.java

示例5: endFilterExpr

import org.jaxen.expr.FilterExpr; //导入依赖的package包/类
public void endFilterExpr() throws JaxenException
{
    Expr expr = (Expr) peekFrame().removeFirst();
    
    FilterExpr filter = getXPathFactory().createFilterExpr( expr );

    Iterator predIter = popFrame().iterator();

    addPredicates( filter,
                   predIter );

    push( filter );
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:14,代码来源:JaxenHandler.java

示例6: enterFilterExpr

import org.jaxen.expr.FilterExpr; //导入依赖的package包/类
void enterFilterExpr(final FilterExpr expr) {

    }
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:4,代码来源:ExprListener.java

示例7: exitFilterExpr

import org.jaxen.expr.FilterExpr; //导入依赖的package包/类
void exitFilterExpr(final FilterExpr expr) {

    }
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:4,代码来源:ExprListener.java


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