org.apache.slide.search.basic.expression
Class ComparePropertyExpression

java.lang.Object
  extended byorg.apache.slide.search.basic.expression.BasicExpression
      extended byorg.apache.slide.search.basic.expression.GenericBasicExpression
          extended byorg.apache.slide.search.basic.expression.CompareExpression
              extended byorg.apache.slide.search.basic.expression.ComparePropertyExpression
All Implemented Interfaces:
IBasicExpression
Direct Known Subclasses:
CheckResourceTypeExpression, EQExpression, GTEExpression, GTExpression, IsDefinedExpression, LikeExpression, LTEExpression, LTExpression, PropContainsExpression

public abstract class ComparePropertyExpression
extends CompareExpression

Abstract base class for compare expressions (GT, EQ, is-collection ...).

Version:
$Revision: 1.4 $

Field Summary
protected  ComparedProperty comparedProperty
           
 
Fields inherited from class org.apache.slide.search.basic.expression.CompareExpression
propertyProvider, requestedResourcesPool
 
Fields inherited from class org.apache.slide.search.basic.expression.BasicExpression
expressionElement, expressionFactory, resultSet
 
Constructor Summary
  ComparePropertyExpression(org.jdom.Element e, ComparableResourcesPool requestedResourcesPool, boolean expectLiteral)
          Creates a compare expression according to Element e
protected ComparePropertyExpression(org.jdom.Element e, ComparableResourcesPool requestedResourcesPool, ComparedProperty comparedProperty)
          Creates a compare expression according to Element e
 
Method Summary
protected abstract  boolean compare(ComparableResource item)
          The concrete CompareExpression must overwrite this.
protected  java.lang.String getLiteral(org.jdom.Element e)
          extracs the value of of an expression
protected  java.lang.String toString(java.lang.String op)
          String representation for debugging purposes.
 
Methods inherited from class org.apache.slide.search.basic.expression.CompareExpression
execute, getRequestedResourcePool, setRequestedResourcePool
 
Methods inherited from class org.apache.slide.search.basic.expression.BasicExpression
getFactory, setFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

comparedProperty

protected ComparedProperty comparedProperty
Constructor Detail

ComparePropertyExpression

public ComparePropertyExpression(org.jdom.Element e,
                                 ComparableResourcesPool requestedResourcesPool,
                                 boolean expectLiteral)
                          throws InvalidQueryException
Creates a compare expression according to Element e

Parameters:
e - jdom element, that describes the expression
requestedResourcesPool - the pool of resources to apply the expression to.
expectLiteral - indicates if a <literal> is expected.

ComparePropertyExpression

protected ComparePropertyExpression(org.jdom.Element e,
                                    ComparableResourcesPool requestedResourcesPool,
                                    ComparedProperty comparedProperty)
                             throws InvalidQueryException
Creates a compare expression according to Element e

Parameters:
e - jdom element, that describes the expression
requestedResourcesPool - the pool of resources to apply the expression to.
comparedProperty - the property to compare.
Method Detail

compare

protected abstract boolean compare(ComparableResource item)
The concrete CompareExpression must overwrite this.

Specified by:
compare in class CompareExpression
Parameters:
item - one BasicDataItem out of pool
Returns:
a boolean

toString

protected java.lang.String toString(java.lang.String op)
String representation for debugging purposes.

Returns:
this expression as String

getLiteral

protected java.lang.String getLiteral(org.jdom.Element e)
                               throws InvalidQueryException
extracs the value of of an expression

Parameters:
e - an Expression
Returns:
the literal as string
Throws:
InvalidQueryException - if no found in e