wam         2002/06/21 06:27:11

  Modified:    src/share/org/apache/slide/search/basic/expression
                        ComparedProperty.java
  Log:
  return the datatype for known properties (long for getcontentlength...)
  
  Revision  Changes    Path
  1.2       +32 -4     
jakarta-slide/src/share/org/apache/slide/search/basic/expression/ComparedProperty.java
  
  Index: ComparedProperty.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/expression/ComparedProperty.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ComparedProperty.java     20 Jun 2002 05:22:24 -0000      1.1
  +++ ComparedProperty.java     21 Jun 2002 13:27:11 -0000      1.2
  @@ -67,8 +67,10 @@
   import org.jdom.Element;
   import org.apache.slide.search.InvalidQueryException;
   import org.apache.slide.content.NodeProperty.NamespaceCache;
  +import org.apache.slide.common.PropertyName;
   
   import java.util.List;
  +import java.util.ArrayList;
   
   /**
    * represents a property, that is to be compared against a literal
  @@ -78,6 +80,13 @@
    */
   public class ComparedProperty {
       
  +    /** a list of known properties, that have a numeric type */
  +    private static final List NUMERIC_PROPERTIES = new ArrayList ();
  +    static {
  +        NUMERIC_PROPERTIES.add (new PropertyName ("getcontentlength",
  +                                                  NamespaceCache.DEFAULT_URI));
  +    }
  +    
       /** the property's value <literal> */
       protected String literal;
       public void setLiteral (String literal) {
  @@ -142,12 +151,31 @@
           this (e, true);
       }
       
  +    /**
  +     * Creates a compare expression according to Element e.
  +     *
  +     * @param e jdom element, that describes the expression
  +     * @param withLiteral indicates, if a literal is supplied or not (for example:
  +     *        iscollectionhas no literal)
  +     *
  +     */
       public ComparedProperty (Element e, boolean withLiteral) throws 
InvalidQueryException {
           setProperty(e);
           if (withLiteral) {
               literal  = getLiteral (e);
           }
       }
  +    
  +    /**
  +     * Indicates, if this property shall be treated as numeric in compare
  +     *
  +     * @return   a boolean
  +     *
  +     */
  +    public boolean isNumeric () {
  +        return NUMERIC_PROPERTIES.contains (new PropertyName (property, 
propNamespace));
  +    }
  +    
       /**
        * extracts the property name of this expression
        *
  
  
  

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

Reply via email to