/**
* @see Evaluator#evaluate(ExprNode , String, ServerEntry)
*/
public boolean evaluate( ExprNode node, String dn, ServerEntry record ) throws NamingException
{
ScopeNode snode = ( ScopeNode ) node;
switch ( snode.getScope() )
{
case OBJECT:
return dn.equals( snode.getBaseDn() );
case ONELEVEL:
if ( dn.endsWith( snode.getBaseDn() ) )
{
LdapDN candidateDn = new LdapDN( dn );
LdapDN scopeDn = new LdapDN( snode.getBaseDn() );
return ( scopeDn.size() + 1 ) == candidateDn.size();
}
case SUBTREE:
return dn.endsWith( snode.getBaseDn() );
default:
throw new NamingException( "Unrecognized search scope!" );
}
}