wam         02/03/08 04:07:19

  Modified:    src/share/org/apache/slide/search/basic BasicExpression.java
  Added:       src/share/org/apache/slide/search/basic EmptyExpression.java
  Log:
  enable EmptyExpression
  
  Revision  Changes    Path
  1.2       +13 -7     
jakarta-slide/src/share/org/apache/slide/search/basic/BasicExpression.java
  
  Index: BasicExpression.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicExpression.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BasicExpression.java      14 Feb 2002 17:02:46 -0000      1.1
  +++ BasicExpression.java      8 Mar 2002 12:07:19 -0000       1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicExpression.java,v 
1.1 2002/02/14 17:02:46 wam Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/02/14 17:02:46 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicExpression.java,v 
1.2 2002/03/08 12:07:19 wam Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/03/08 12:07:19 $
    *
    * ====================================================================
    *
  @@ -81,7 +81,7 @@
    *
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Wallmer</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public abstract class BasicExpression {
       
  @@ -97,7 +97,7 @@
       /**
        * prevent from being instantiated from outside, use factory method
        */
  -    private BasicExpression () {}
  +    protected BasicExpression () {}
       
       /**
        * constructor. Only called by the conrecte expressions
  @@ -108,7 +108,6 @@
           this.expressionElement = e;
       }
       
  -    
       /**
        * Factory method to create the concrete expression.
        *
  @@ -121,9 +120,15 @@
       static public BasicExpression createExpression
           (Element e) throws InvalidQueryException
       {
  -        String name = e.getName();
  +        
           BasicExpression result = null;
           
  +        if (e == null) {
  +            result = new EmptyExpression ();
  +        }
  +        else {
  +        String name = e.getName();
  +        
           if (name.equals (Literals.AND))
               result = new AndExpression (e);
               
  @@ -142,6 +147,7 @@
           else
               throw new InvalidQueryException
                   ("operator " + name + " is an unprocessable entity");
  +        }
           
           return result;
           
  
  
  
  1.1                  
jakarta-slide/src/share/org/apache/slide/search/basic/EmptyExpression.java
  
  Index: EmptyExpression.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/EmptyExpression.java,v 
1.1 2002/03/08 12:07:19 wam Exp $
   * $Revision: 1.1 $
   * $Date: 2002/03/08 12:07:19 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  
  
  package org.apache.slide.search.basic;
  
  import org.jdom.Element;
  
  import java.util.Set;
  import java.util.HashSet;
  
  
  /**
   * Represents an AND expression.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Wallmer</a>
   * @version $Revision: 1.1 $
   */
  public class EmptyExpression extends BasicExpression {
      
      
      /**
       * Creates an empty expression. This occurs when no <where> clause
       * was supplied
       *
       * @param e jdom element, that describes the expression
       *
       */
      protected EmptyExpression () {
          
      }
      
      /**
       * Resolve this expression.
       *
       * @param    pool out of this Set of BasicDataItems the result set
       *           is created
       */
      protected void resolve (Set pool) {
          resultSet = pool;
          isResolved = true;
      }
      
      
      
      /**
       * String representation for debugging purposes.
       *
       * @return   this expression as String
       */
      public String toString () {
          return "";
      }
      
  }
  
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to