001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *  
010 *    http://www.apache.org/licenses/LICENSE-2.0
011 *  
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License. 
018 *  
019 */
020package org.apache.directory.server.xdbm.search.evaluator;
021
022
023import org.apache.directory.api.ldap.model.entry.Entry;
024import org.apache.directory.api.ldap.model.exception.LdapException;
025import org.apache.directory.api.ldap.model.filter.UndefinedNode;
026import org.apache.directory.server.core.api.partition.PartitionTxn;
027import org.apache.directory.server.xdbm.IndexEntry;
028import org.apache.directory.server.xdbm.search.Evaluator;
029
030
031/**
032 * An Evaluator that always return false, for the case we have no entry to return
033 *
034 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
035 */
036public class EmptyEvaluator implements Evaluator<UndefinedNode>
037{
038    /**
039     * Create a new instance of the PassThroughEvaluator
040     */
041    public EmptyEvaluator()
042    {
043    }
044
045
046    /**
047     * {@inheritDoc}
048     */
049    public boolean evaluate( PartitionTxn partitionTxn, IndexEntry<?, String> indexEntry ) throws LdapException
050    {
051        return false;
052    }
053
054
055    /**
056     * {@inheritDoc}
057     */
058    public boolean evaluate( Entry entry ) throws LdapException
059    {
060        return false;
061    }
062
063
064    /**
065     * Gets the expression used by this expression Evaluator.
066     *
067     * @return the AST for the expression
068     */
069    public UndefinedNode getExpression()
070    {
071        return UndefinedNode.UNDEFINED_NODE;
072    }
073
074
075    /**
076     * @see Object#toString()
077     */
078    public String toString( String tabs )
079    {
080        StringBuilder sb = new StringBuilder();
081
082        sb.append( tabs ).append( "EmptyEvaluator\n" );
083
084        return sb.toString();
085    }
086
087
088    /**
089     * @see Object#toString()
090     */
091    public String toString()
092    {
093        return toString( "" );
094    }
095}