org.apache.jackrabbit.commons.predicate
Class DepthPredicate

java.lang.Object
  extended by org.apache.jackrabbit.commons.predicate.DepthPredicate
All Implemented Interfaces:
Predicate
Direct Known Subclasses:
DeclaringTypePredicate, IsMandatoryPredicate, IsNodePredicate, NamePredicate, NodeTypePredicate

public class DepthPredicate
extends Object
implements Predicate

Implements a filter that filters item according to their (passed) depth.


Field Summary
protected  int maxDepth
          The maximal depth
protected  int minDepth
          The minimal depth
 
Fields inherited from interface org.apache.jackrabbit.commons.predicate.Predicate
FALSE, TRUE
 
Constructor Summary
DepthPredicate(int minDepth, int maxDepth)
          Creates a new depth filter for the given depths.
 
Method Summary
 boolean evaluate(Object item)
          Matches if the given depth is greater or equal the minimum depth and less or equal the maximum depth and if the call to matches(Item) returns true.
protected  boolean matches(Item item)
          Returns true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

minDepth

protected final int minDepth
The minimal depth


maxDepth

protected final int maxDepth
The maximal depth

Constructor Detail

DepthPredicate

public DepthPredicate(int minDepth,
                      int maxDepth)
Creates a new depth filter for the given depths.

Parameters:
minDepth - the minimal depth
maxDepth - the maximal depth
Method Detail

evaluate

public boolean evaluate(Object item)
Matches if the given depth is greater or equal the minimum depth and less or equal the maximum depth and if the call to matches(Item) returns true.

Specified by:
evaluate in interface Predicate
Parameters:
item - some object
Returns:
predicate result
See Also:
Predicate.evaluate(java.lang.Object)

matches

protected boolean matches(Item item)
                   throws RepositoryException
Returns true. Subclasses can override to implement something useful that is dependant of the depth.

Parameters:
item - the item to match
Returns:
true if the item matches; false otherwise.
Throws:
RepositoryException - if an error occurs.


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.