本文整理汇总了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;
}
}
示例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 );
}
示例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;
}
示例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;
}
示例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 );
}
示例6: enterFilterExpr
import org.jaxen.expr.FilterExpr; //导入依赖的package包/类
void enterFilterExpr(final FilterExpr expr) {
}
示例7: exitFilterExpr
import org.jaxen.expr.FilterExpr; //导入依赖的package包/类
void exitFilterExpr(final FilterExpr expr) {
}